コード例 #1
0
        public void SetPage(string imgPath, int page)
        {
            if (System.IO.File.Exists(imgPath))
            {
                MBImageLoader.DisplayDiskImage(imgPath, _imgPage, new PointF(400, 400));
            }

            _lblPage.Text = string.Format(this.Context.GetString(Resource.String.pub_pagina), (page + 1));
        }
コード例 #2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var item = _Items[position];

            View view = null;

            if (convertView != null)
            {
                view = convertView;
            }
            else
            {
                view = _context.LayoutInflater.Inflate(Resource.Layout.EdicolaListItem, parent, false);
            }

            var imgCover    = view.FindViewById <ImageView>(Resource.Id.edicolaImgCover);
            var txtTitolo   = view.FindViewById <TextView>(Resource.Id.edicolaTxtTitolo);
            var txtDettagli = view.FindViewById <TextView>(Resource.Id.edicolaTxtDettagli);
            var btnInfo     = view.FindViewById <ImageView>(Resource.Id.btnInfo);

            TextView txtLabel = view.FindViewById <TextView>(Resource.Id.txtLabel);

            //copertina
            if (item.IsPDF)
            {
                imgCover.SetImageResource(Resource.Drawable.pdf_icon);
                imgCover.SetScaleType(ImageView.ScaleType.FitCenter);
            }
            else
            {
                string imgPath = System.IO.Path.Combine(item.Path, "copertina.jpg");
                if (System.IO.File.Exists(imgPath))
                {
                    MBImageLoader.DisplayDiskImage(imgPath, imgCover, new PointF(280, 280));
                }
            }

            //titolo
            txtTitolo.SetText(item.Titolo, TextView.BufferType.Normal);

            //dettagli
            if (txtDettagli != null)
            {
                txtDettagli.SetText(item.Autore, TextView.BufferType.Normal);
            }

            //pulsanti
            if (btnInfo != null)
            {
                btnInfo.Visibility = ViewStates.Gone;
            }

            return(view);
        }
コード例 #3
0
        private void LoadMultistato()
        {
            if (_multistato.Stati.Count() == 0)
            {
                return;
            }

            _imgSwitcher = new ImageSwitcher(this.Context);
            _imgSwitcher.SetFactory(this);

            string imgPath = System.IO.Path.Combine(_basePath, _multistato.Stati[0].Path);

            MBImageLoader.DisplayDiskImage(imgPath, _imgSwitcher, new PointF(_frame.Width(), _frame.Height()));

            this.AddView(_imgSwitcher, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent));

            //transizione
            this.SetAnimation();

            //scorrimento temporizzato
            _changeHandler  = new Handler(Looper.MainLooper);
            _changeRunnable = new Runnable(() => {
                try
                {
                    this.NextState();
                }
                finally
                {
                    _changeHandler.PostDelayed(_changeRunnable, _multistato.Delay);
                }
            });

            //gesture
            if (_multistato.Swipe || _multistato.SwipeContinuo || _multistato.ZoomEnabled)
            {
                _gestureDetector = new GestureDetector(this.Context, new GestureListener(this));
            }

            //loop
            this._partialLoop = _multistato.Loop;

            //autoplay

            /*if(_multistato.Autoplay)
             * {
             *      this.Start();
             * }*/

            this.SetOnClick();
        }
コード例 #4
0
        public void GoToState(int index)
        {
            if (_imgSwitcher == null || index == _currentIndex)
            {
                return;
            }

            string imgPath = System.IO.Path.Combine(_basePath, _multistato.Stati[index].Path);

            MBImageLoader.DisplayDiskImage(imgPath, _imgSwitcher, new PointF(_frame.Width(), _frame.Height()));


            _currentIndex = index;
        }
コード例 #5
0
        private void LoadImage()
        {
            string path = GetPathForState();

            this.RecycleBitmap();

            if (!File.Exists(path))
            {
                this.SetImageBitmap(null);
            }
            else
            {
                MBImageLoader.DisplayDiskImage(path, this, new PointF(_frame.Width(), _frame.Height()));
            }
        }
コード例 #6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            this.Window.RequestFeature(WindowFeatures.NoTitle);

            SetContentView(Resource.Layout.EdicolaDetails);

            this.SetTitle(_pubblicazione.Titolo);

            TextView  txtTitolo     = FindViewById <TextView>(Resource.Id.txtTitolo);
            TextView  txtAutore     = FindViewById <TextView>(Resource.Id.txtAutore);
            TextView  txtPubblicato = FindViewById <TextView>(Resource.Id.txtPubblicato);
            TextView  txtScadenza   = FindViewById <TextView>(Resource.Id.txtScadenza);
            ImageView imgCover      = FindViewById <ImageView>(Resource.Id.imgCover);
            Button    btnOpen       = FindViewById <Button>(Resource.Id.btnOpen);
            Button    btnDelete     = FindViewById <Button>(Resource.Id.btnDelete);

            txtTitolo.Text = _pubblicazione.Titolo;
            txtAutore.Text = _pubblicazione.Autore.Trim();

            string imgPath = System.IO.Path.Combine(_pubblicazione.Path, "copertina.jpg");

            if (System.IO.File.Exists(imgPath))
            {
                MBImageLoader.DisplayDiskImage(imgPath, imgCover, new PointF(360, 360));
            }

            if (_pubblicazione.DataPubblicazione != DateTime.MinValue)
            {
                txtPubblicato.Text = string.Format(Context.GetString(Resource.String.pub_publishedOn), _pubblicazione.DataPubblicazione.ToString("dd-MM-yyyy"));
            }
            else
            {
                txtPubblicato.Visibility = ViewStates.Gone;
            }

            if (_pubblicazione.DataScadenza != DateTime.MinValue)
            {
                txtScadenza.Text = string.Format(Context.GetString(Resource.String.pub_expireOn), _pubblicazione.DataScadenza.ToString("dd-MM-yyyy"));
            }
            else
            {
                txtScadenza.Visibility = ViewStates.Gone;
            }

            //pulsante apri
            btnOpen.SetTextColor(Color.Transparent.FromHex(DataManager.Get <ISettingsManager>().Settings.ButtonColor));
            btnOpen.Text   = Context.GetString(Resource.String.pub_open);
            btnOpen.Click += delegate
            {
                if (OpenAction != null)
                {
                    OpenAction();
                }
            };

            //pulsante elimina
            btnDelete.SetTextColor(Color.Transparent.FromHex(DataManager.Get <ISettingsManager>().Settings.ButtonColor));
            btnDelete.Text   = Context.GetString(Resource.String.pub_delete);
            btnDelete.Click += delegate
            {
                if (DeleteAction != null)
                {
                    DeleteAction();
                }
            };
        }
コード例 #7
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var item = _Items[position];

            int absPage = _pubblicazione.RelativeToAbsolutePage(item.IdDocumento, item.Index);

            PageItem view = null;

            if (convertView == null)
            {
                view = new PageItem(_context);
            }
            else
            {
                view = convertView as PageItem;
            }

            //se è la pagina corrente setto il testo in grassetto
            view.SetBold(false);
            if (item.IdDocumento == _documento.ID && item.Index == _currentIndex + 1)
            {
                view.SetBold();
            }

            if (view.AbsPage == absPage)
            {
                return(view);
            }

            if (_bookmarks != null && position < _bookmarks.Count && _bookmarks[position].Titolo != "")
            {
                view.Title = _bookmarks[position].Titolo;
            }
            else
            {
                if (Utils.CompareVersion(_pubblicazione.Script, "4.6.0") >= 0)
                {
                    view.Title = item.Titolo;

                    if (item.Titolo == "")
                    {
                        view.Title = absPage.ToString();
                    }
                    else if (item.Titolo != absPage.ToString())
                    {
                        view.Title += " (" + absPage.ToString() + ")";
                    }
                }
                else
                {
                    view.Title = string.Format(_context.GetString(Resource.String.pub_pagina), absPage.ToString());
                }
            }

            var doc = _pubblicazione.GetDocumento(item.IdDocumento);

            if (doc != null)
            {
                string imgPath = System.IO.Path.Combine(doc.Path, item.Path, "miniatura.jpg");
                if (System.IO.File.Exists(imgPath))
                {
                    MBImageLoader.DisplayDiskImage(imgPath, view.ImgCover, new PointF(100, 100));
                    //Koush.UrlImageViewHelper.SetUrlDrawable(imgThumb, new Uri(imgPath).AbsoluteUri);
                }
            }

            view.AbsPage = absPage;

            return(view);
        }