Example #1
0
        protected virtual UIView createBottomToolbar()
        {
            var bottomBarFrame = getRootViewFrameRect();

            bottomBarFrame.Y     += bottomBarFrame.Height - DefaultToolbarHeight;
            bottomBarFrame.Height = DefaultToolbarHeight;

            var bottomBar = new UIToolbar(bottomBarFrame);

            bottomBar.SetBackgroundImage(new UIImage(), UIToolbarPosition.Any, UIBarMetrics.Default);
            bottomBar.SetShadowImage(new UIImage(), UIToolbarPosition.Any);
            bottomBar.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth;

            createToolbarButton(bottomBar, DocumentActionTypes.NavigateToFirstPage, "navigateToFirst.png", openFirstPage);
            createToolbarButton(bottomBar, DocumentActionTypes.NavigateToPriorPage, "navigateToPrior.png", openPriorPage);
            createToolbarButton(bottomBar, DocumentActionTypes.NavigateToPage, "navigateToPage.png", () => {
                var vc = new GotoPageVC(p => OpenDocumentPage((int)p));
                vc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
                PresentViewController(vc, true, null);
            });
            createToolbarButton(bottomBar, DocumentActionTypes.NavigateToNextPage, "navigateToNext.png", openNextPage);
            createToolbarButton(bottomBar, DocumentActionTypes.NavigateToLastPage, "navigateToLast.png", openLastPage);
            createToolbarSeparator(bottomBar);

            var pageNumberLeft       = bottomBarFrame.Width - PageNumberWidth - DefaultMargin;
            var pageNumberLabelFrame = new CGRect(pageNumberLeft, (bottomBarFrame.Height - PageNumberHeight) / 2, PageNumberWidth, PageNumberHeight);

            _pageNumberLabel = new UILabel(pageNumberLabelFrame);
            _pageNumberLabel.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin;
            _pageNumberLabel.Font             = UIFont.SystemFontOfSize(12.0f);
            _pageNumberLabel.TextAlignment    = UITextAlignment.Center;
            _pageNumberLabel.TextColor        = UIColor.Gray;
            bottomBar.AddSubview(_pageNumberLabel);

            var sliderWidth = pageNumberLeft - SliderLeft - DefaultMargin;
            var sliderFrame = new CGRect(SliderLeft, (bottomBarFrame.Height - SliderHeight) / 2, sliderWidth, SliderHeight);

            _slider                  = new UISlider(sliderFrame);
            _slider.MinValue         = 1;
            _slider.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            _slider.ValueChanged    += delegate {
                if (_pageNumberLabel != null)
                {
                    _pageNumberLabel.Text = string.Format(@"{0}/{1}", (int)_slider.Value, PDFDocument.PageCount);
                }
            };
            _slider.TouchUpInside += delegate(object sender, EventArgs e) {
                OpenDocumentPage((int)_slider.Value);
            };
            bottomBar.AddSubview(_slider);

            return(bottomBar);
        }
Example #2
0
        protected virtual UIView createTopToolbar()
        {
            var toolBarFrame = getRootViewFrameRect();

            toolBarFrame.Height = DefaultToolbarHeight;

            var toolBar = new UIToolbar(toolBarFrame);

            toolBar.SetBackgroundImage(new UIImage(), UIToolbarPosition.Any, UIBarMetrics.Default);
            toolBar.SetShadowImage(new UIImage(), UIToolbarPosition.Any);
            toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth;

            createToolbarButton(toolBar, DocumentActionTypes.ZoomOut, "zoomOut.png", zoomOut);
            createToolbarButton(toolBar, DocumentActionTypes.ZoomIn, "zoomIn.png", zoomIn);
            createToolbarSeparator(toolBar);

            //			createToolbarButton(toolBar, DocumentActionTypes.Note, "note.png", () => {
            //				var note = MgrAccessor.DocumentNoteMgr.Load(_documentId);
            //				var vc = new NoteVC(note);
            //				vc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
            //				PresentViewController(vc, true, null);
            //			});
            //			createToolbarButton(toolBar, DocumentActionTypes.Bookmarks, "bookmarksList.png", () => {
            //				var bookmarks = MgrAccessor.DocumentBookmarkMgr.GetAllForDocument(_documentId);
            //				var vc = new BookmarksVC(_documentId, bookmarks, PDFDocument.CurrentPageNumber, p => OpenDocumentPage((int)p));
            //				vc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
            //				PresentViewController(vc, true, null);
            //			});
            //			createToolbarButton(toolBar, DocumentActionTypes.Thumbs, "thumbs.png", () => {
            //				var vc = new ThumbsVC(p => OpenDocumentPage((int)p));
            //				vc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
            //				PresentViewController(vc, true, null);
            //			});
            createToolbarSeparator(toolBar);

            _btnAutoWidth  = createToolbarButton(toolBar, DocumentActionTypes.AutoWidth, getImagePathForButton(DocumentActionTypes.AutoWidth), setAutoWidth);
            _btnAutoHeight = createToolbarButton(toolBar, DocumentActionTypes.AutoHeight, getImagePathForButton(DocumentActionTypes.AutoHeight), setAutoHeight);
            createToolbarSeparator(toolBar);

            return(toolBar);
        }
            public FullScreenVideoView()
            {
                TintColor     = UIColor.White;
                Add(videoView = new VideoView {
                    Tapped = Toggle
                });

                Add(topToolbar = new UIToolbar {
                    BackgroundColor = UIColor.Clear,
                    Items           = new UIBarButtonItem [] {
                        new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                        new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => {
                            Parent.DismissViewControllerAsync(true);
                        }),
                        new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace)
                        {
                            Width = 10
                        },
                    }
                });
                topToolbar.SetBackgroundImage(new UIImage(), UIToolbarPosition.Any, UIBarMetrics.Default);
                topToolbar.SetShadowImage(new UIImage(), UIToolbarPosition.Any);
                topToolbar.SizeToFit();
                Add(playPauseButton = new SimpleButton {
                    BackgroundColor = UIColor.Black.ColorWithAlpha(.5f),
                    Frame           = new CoreGraphics.CGRect(0, 0, 50, 50),
                    Layer           =
                    {
                        CornerRadius = 25,
                    },
                    Tapped = (b) => PlaybackManager.Shared.PlayPause(),
                });
                timeLabel = new UILabel {
                    Text = "0000:00"
                }.StyleAsSubText();
                timeLabel.TextColor = UIColor.White;
                timeLabel.SizeToFit();
                timeRemaingLabel = new UILabel {
                    Text = "0000:00", TextAlignment = UITextAlignment.Right
                }.StyleAsSubText();
                timeRemaingLabel.TextColor = UIColor.White;
                timeRemaingLabel.SizeToFit();
                slider = new ProgressView();
                slider.EditingStarted = () => timer.Stop();
                slider.EditingEnded   = () => ResetTimer();
                Add(bottomToolbar     = new UIToolbar {
                    BackgroundColor = UIColor.Clear,
                    Items           = new UIBarButtonItem[] {
                        new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace)
                        {
                            Width = 10
                        },
                        new UIBarButtonItem(timeLabel),

                        new UIBarButtonItem(slider),

                        new UIBarButtonItem(timeRemaingLabel),
                        new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace)
                        {
                            Width = 10
                        },
                    }
                });

                bottomToolbar.SetBackgroundImage(new UIImage(), UIToolbarPosition.Any, UIBarMetrics.Default);
                bottomToolbar.SetShadowImage(new UIImage(), UIToolbarPosition.Any);
                bottomToolbar.SizeToFit();
                timer          = new Timer(5000);
                timer.Elapsed += Timer_Elapsed;
            }