Beispiel #1
0
 public IndexFragment(string title, Pubblicazione pub, Documento doc, int page, MuPDFCore core = null) : base(title)
 {
     _pubblicazione = pub;
     _documento     = doc;
     _currentPage   = page;
     _pdfCore       = core;
 }
Beispiel #2
0
        public void SetPagePdf(MuPDFCore pdfCore, int page, string basePath)
        {
            //PdfToImage.SetImage(_imgPage, pdfCore, page, new Point(300,300));

            PdfPagePreview mPdfPreview = new PdfPagePreview(this.Context, pdfCore, basePath);

            _lblPage.Text = string.Format(this.Context.GetString(Resource.String.pub_pagina), (page + 1));

            mPdfPreview.DrawPageImageView(_imgPage, page);
        }
        public MuPageAdapter(Context context, FilePicker.IFilePickerSupport filePickerSupport, MuPDFCore core, Documento doc, ViewerScreen docView) : base(context, filePickerSupport, core)
        {
            _doc     = doc;
            mCore    = core;
            mContext = context;
            _docView = docView;

            _pages = new SparseArray <MuPageView> ();           // new MuPageView[core.CountPages()];

            mPageSizes = new SparseArray <PointF>();
        }
Beispiel #4
0
        public PdfPagePreview(Context context, MuPDFCore core, string basePath)
        {
            mCore    = core;
            mContext = context;

            System.IO.FileInfo file = new System.IO.FileInfo(basePath);

            string dir = System.IO.Path.GetFileNameWithoutExtension(basePath) + "_" + file.LastWriteTime.ToString("yyyyMMddhhmmss");

            mPath = System.IO.Path.Combine(context.ExternalCacheDir.ToString(), dir);

            //mLoadingBitmap = BitmapFactory.DecodeResource(mContext.Resources, Resource.Drawable.darkdenim3);

            //mPath = context.ExternalCacheDir + "/" + System.IO.Path.GetFileNameWithoutExtension(basePath) + "/";
        }
        private MuPDFCore openFile(String path)
        {
            try
            {
                MuPDFCore core = new MuPDFCore(this, path);
                OutlineActivityData.Set(null);
                return(core);
            }
            catch (Exception e)
            {
                Console.WriteLine("MuPDFCore-openFile: (error)" + e);

                return(null);
            }
        }
Beispiel #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.hymn_layout);
            var page = int.Parse(Intent.GetStringExtra("page")) - 1;

            mPDFView = (Android.Widget.RelativeLayout)FindViewById(Resource.Id.pdfView);

            var path      = new Android_Path();
            var file_path = Android.Net.Uri.Parse("file://" + path.getLocalPath("Hymn", "hymn.pdf"));
            var uri       = Android.Net.Uri.Decode(file_path.EncodedPath);

            _core = openFile(uri);
            setMuPDFView(page);
        }
        public PDFPagesAdapter(Context context, MuPDFCore core, string basePath, int index = -1, int[] pages = null)
        {
            mContext      = context;
            mCore         = core;
            mCurrentIndex = index;
            mPages        = pages;

            mPdfPreview = new PdfPagePreview(mContext, mCore, basePath);

            /*mPath = context.ExternalCacheDir + "/" + System.IO.Path.GetFileNameWithoutExtension(basePath) + "/";
             *
             * File mCacheDirectory = new File(mPath);
             * if (!mCacheDirectory.Exists())
             *      mCacheDirectory.Mkdirs();
             *
             * mLoadingBitmap = BitmapFactory.DecodeResource(mContext.Resources, Resource.Drawable.darkdenim3);*/
        }
Beispiel #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            this.SetContentView(Resource.Layout.ContentsTable);

            if (ActionBar != null)
            {
                ActionBar.SetDisplayUseLogoEnabled(false);
                ActionBar.SetIcon(new ColorDrawable(Color.Transparent));
                ActionBar.SetHomeButtonEnabled(false);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ActionBar.SetDisplayShowHomeEnabled(true);
                ActionBar.SetDisplayShowTitleEnabled(true);
            }

            this.Title = "Contenuti";

            _currentPage   = Intent.GetIntExtra("currentPage", 0);
            _pubblicazione = (Pubblicazione)ActivitiesBringe.GetObject("pub");
            _documento     = (Documento)ActivitiesBringe.GetObject("doc");
            _pdfCore       = (MuPDFCore)ActivitiesBringe.GetObject("pdfCore");

            ViewPager viewPager = (ViewPager)this.FindViewById <ViewPager>(Resource.Id.pagesViewPager);
            ArrayList fragments = getFragments();

            TitleFragmentAdapter ama = new TitleFragmentAdapter(this.SupportFragmentManager, fragments);

            viewPager.Adapter = ama;

            TabPageIndicator indicator = this.FindViewById <TabPageIndicator> (Resource.Id.pagesIndicator);

            indicator.SetViewPager(viewPager);



            /*StateListDrawable bgColorList = new StateListDrawable();
             *
             * bgColorList.AddState(new int[] { Android.Resource.Attribute.StateActivated }, new ColorDrawable(Color.Transparent.FromHex("ff0000")));
             * bgColorList.AddState(new int[] { }, new ColorDrawable(Color.Transparent));
             *
             * indicator.Background = bgColorList;*/

            viewPager.CurrentItem = Intent.GetIntExtra("currentItem", 0);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.pdf_layout);
            var page = Intent.GetIntExtra("page", 1) - 1;

            mPDFView = (Android.Widget.RelativeLayout)FindViewById(Resource.Id.pdfView);


            var file_path = Android.Net.Uri.Parse("file://" + Intent.GetStringExtra("fileName"));
            var uri       = Android.Net.Uri.Decode(file_path.EncodedPath);

            Console.WriteLine(file_path);
            Console.WriteLine(uri);
            Console.WriteLine("lay me me");
            _core = openFile(uri);
            setMuPDFView(page);
        }
        private void ClearPDF()
        {
            if (mDocView != null)
            {
                DisposeReaderView();
                mDocView.Dispose();
                mPDFView.Dispose();
                mAdapter.ReleaseBitmaps();
                mAdapter.Dispose();


                if (_core != null)
                {
                    _core.OnDestroy();
                    _core.Dispose();
                    _core    = null;
                    mAdapter = null;
                    mDocView = null;
                    mPDFView = null;
                }
            }
        }
Beispiel #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _currentPage   = Intent.GetIntExtra("currentPage", 0);
            _pubblicazione = (Pubblicazione)ActivitiesBringe.GetObject("pub");
            _documento     = (Documento)ActivitiesBringe.GetObject("doc");
            _pdfCore       = (MuPDFCore)ActivitiesBringe.GetObject("pdfCore");

            SetContentView(Resource.Layout.SearchDialog);

            Window.SetSoftInputMode(SoftInput.AdjustNothing);

            if (ActionBar != null)
            {
                this.Title = ActionBar.Title = GetString(Resource.String.search);

                ActionBar.SetDisplayUseLogoEnabled(false);
                ActionBar.SetIcon(new ColorDrawable(Color.Transparent));
                ActionBar.SetHomeButtonEnabled(false);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ActionBar.SetDisplayShowHomeEnabled(true);
                ActionBar.SetDisplayShowTitleEnabled(true);
            }

            _pageList = (ListView)FindViewById <ListView>(Resource.Id.pageList);

            _searchView = (SearchView)FindViewById <SearchView>(Resource.Id.searchView);

            int  searchPlateId = _searchView.Context.Resources.GetIdentifier("android:id/search_plate", null, null);
            View searchPlate   = _searchView.FindViewById(searchPlateId);

            searchPlate.Background.Colorize(DataManager.Get <ISettingsManager>().Settings.ButtonColor);

            _searchView.Focusable = true;
            _searchView.Iconified = false;
            _searchView.RequestFocusFromTouch();

            _searchView.QueryTextChange += (sender, e) =>
            {
                SearchPages(e.NewText);
            };

            _searchView.QueryTextSubmit += (sender, e) =>
            {
                _searchView.ClearFocus();
            };

            _pageList.ItemClick += (sender, e) =>
            {
                var art = _articoli[e.Position];

                Intent myIntent = new Intent(this, typeof(ViewerScreen));
                myIntent.PutExtra("doc", art.IdDocumento);
                myIntent.PutExtra("page", (art.Index - 1).ToString());
                myIntent.PutExtra("action", "page");

                SetResult(Result.Ok, myIntent);
                Finish();
            };

            //paramentro ricerca
            var str = ActivitiesBringe.GetObject("search");

            if (str != null)
            {
                string search = (string)str;

                _searchView.SetQuery(search, true);

                _searchView.RequestFocus();
            }
        }
Beispiel #12
0
 public SizingTask(MuPDFCore core, int index, MuPageView pageView) : base()
 {
     this.Core     = core;
     this.index    = index;
     this.PageView = pageView;
 }
Beispiel #13
0
 public MuPageView(Context c, FilePicker.IFilePickerSupport filePickerSupport, MuPDFCore muPdfCore, Point parentSize, Bitmap sharedHqBm, Documento doc, ViewerScreen docView) : base(c, filePickerSupport, muPdfCore, parentSize, sharedHqBm)
 {
     _documento = doc;
     //_parentSize = parentSize;
     _docView = docView;
 }