Example #1
0
        public override void ViewDidLoad()
        {
            tableView.WeakDataSource = this;
            tableView.WeakDelegate = this;

            var btnDone = new SessionsFlatButton();
            btnDone.Label.Text = "Done";
            btnDone.Frame = new RectangleF(0, 0, 70, 44);
            btnDone.OnButtonClick += () => {
                NavigationController.DismissViewController(true, null);
            };
            var btnDoneView = new UIView(new RectangleF(0, 0, 70, 44));
            var rect = new RectangleF(btnDoneView.Bounds.X + 16, btnDoneView.Bounds.Y, btnDoneView.Bounds.Width, btnDoneView.Bounds.Height);
            btnDoneView.Bounds = rect;
            btnDoneView.AddSubview(btnDone);
            _btnDone = new UIBarButtonItem(btnDoneView);

            _btnFlatEdit = new SessionsFlatButton();
            _btnFlatEdit.LabelAlignment = UIControlContentHorizontalAlignment.Right;
            _btnFlatEdit.Label.Text = "Edit";
            _btnFlatEdit.Label.TextAlignment = UITextAlignment.Right;
            _btnFlatEdit.Label.Frame = new RectangleF(0, 0, 44, 44);
            _btnFlatEdit.ImageChevron.Hidden = true;
            _btnFlatEdit.Frame = new RectangleF(0, 0, 60, 44);
            _btnFlatEdit.OnButtonClick += HandleEditTouchUpInside;
            var btnEditView = new UIView(new RectangleF(UIScreen.MainScreen.Bounds.Width - 60, 0, 60, 44));
            var rect2 = new RectangleF(btnEditView.Bounds.X - 16, btnEditView.Bounds.Y, btnEditView.Bounds.Width, btnEditView.Bounds.Height);
            btnEditView.Bounds = rect2;
            btnEditView.AddSubview(_btnFlatEdit);
            _btnEdit = new UIBarButtonItem(btnEditView);           

            NavigationItem.SetLeftBarButtonItem(_btnDone, true);
            NavigationItem.SetRightBarButtonItem(_btnEdit, true);

            var btnNew = new SessionsButton();
            btnNew.SetTitle("New", UIControlState.Normal);
            btnNew.Font = UIFont.FromName("HelveticaNeue", 12.0f);
            btnNew.Frame = new RectangleF(0, 12, 50, 30);
            btnNew.TouchUpInside += HandleNewTouchUpInside;
            _btnNew = new UIBarButtonItem(btnNew);

            var btnShuffle = new SessionsButton();
            btnShuffle.SetTitle("Shuffle", UIControlState.Normal);
            btnShuffle.Font = UIFont.FromName("HelveticaNeue", 12.0f);
            btnShuffle.Frame = new RectangleF(0, 12, 70, 30);
            btnShuffle.TouchUpInside += HandleShuffleTouchUpInside;
            _btnShuffle = new UIBarButtonItem(btnShuffle);

            toolbar.Items = new UIBarButtonItem[2]{ _btnNew, _btnShuffle };

            base.ViewDidLoad();

            var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            navigationManager.BindPlaylistView(null, this);
        }
Example #2
0
        public override void ViewDidLoad()
        {
            tableView.WeakDataSource = this;
            tableView.WeakDelegate = this;

            this.View.BackgroundColor = GlobalTheme.BackgroundColor;
            viewSync.BackgroundColor = GlobalTheme.BackgroundColor;
            btnSelect.SetTitle("Select all", UIControlState.Normal);
            activityIndicator.StartAnimating();

            UILongPressGestureRecognizer longPress = new UILongPressGestureRecognizer(HandleLongPress);
            longPress.MinimumPressDuration = 0.7f;
            longPress.WeakDelegate = this;
            tableView.AddGestureRecognizer(longPress);

            var btnSync = new SessionsFlatButton();
            btnSync.LabelAlignment = UIControlContentHorizontalAlignment.Right;
            btnSync.Label.Text = "Sync";
            btnSync.Label.TextAlignment = UITextAlignment.Right;
            btnSync.Label.Frame = new RectangleF(0, 0, 44, 44);
            btnSync.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron_blue");
            btnSync.ImageChevron.Frame = new RectangleF(70 - 22, 0, 22, 44);
            btnSync.Frame = new RectangleF(0, 0, 70, 44);
            btnSync.OnButtonClick += HandleButtonSyncTouchUpInside;
            var btnSyncView = new UIView(new RectangleF(UIScreen.MainScreen.Bounds.Width - 70, 0, 70, 44));
            var rect2 = new RectangleF(btnSyncView.Bounds.X - 16, btnSyncView.Bounds.Y, btnSyncView.Bounds.Width, btnSyncView.Bounds.Height);
            btnSyncView.Bounds = rect2;
            btnSyncView.AddSubview(btnSync);
            _btnSync = new UIBarButtonItem(btnSyncView);

            NavigationItem.SetRightBarButtonItem(_btnSync, true);

			viewLoading.Hidden = false;
			viewSync.Hidden = true;
			tableView.Hidden = true;

            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                NavigationController.InteractivePopGestureRecognizer.WeakDelegate = this;
                NavigationController.InteractivePopGestureRecognizer.Enabled = true;
            }

			var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
			navigationManager.BindSyncMenuView(this, _device);

            base.ViewDidLoad();
        }       
        public override void ViewDidLoad()
        {
			scrollView.BackgroundColor = GlobalTheme.BackgroundColor;
            toolbar.BackgroundColor = GlobalTheme.MainColor;
            viewOptions.BackgroundColor = GlobalTheme.BackgroundColor;
            lblPresetName.TextColor = UIColor.White;
            
            // Add padding to text field (http://stackoverflow.com/questions/3727068/set-padding-for-uitextfield-with-uitextborderstylenone)
            UIView paddingView = new UIView(new RectangleF(0, 0, 5, 20));
            txtPresetName.LeftView = paddingView;
            txtPresetName.LeftViewMode = UITextFieldViewMode.Always;

            // Make sure the Done key closes the keyboard
            txtPresetName.ShouldReturn = (a) => {
                txtPresetName.ResignFirstResponder();
                return true;
            };

            var btnBack = new SessionsFlatButton();
            btnBack.Label.Text = "Back";
            btnBack.Frame = new RectangleF(0, 0, 70, 44);
            btnBack.OnButtonClick += HandleButtonBackClick;
            var btnBackView = new UIView(new RectangleF(0, 0, 70, 44));
            var rect = new RectangleF(btnBackView.Bounds.X + 16, btnBackView.Bounds.Y, btnBackView.Bounds.Width, btnBackView.Bounds.Height);
            btnBackView.Bounds = rect;
            btnBackView.AddSubview(btnBack);
            _btnBack = new UIBarButtonItem(btnBackView);

            var btnSave = new SessionsFlatButton();
            btnSave.LabelAlignment = UIControlContentHorizontalAlignment.Right;
            btnSave.Label.Text = "Save";
            btnSave.Label.TextAlignment = UITextAlignment.Right;
            btnSave.Label.Frame = new RectangleF(0, 0, 44, 44);
            btnSave.ImageChevron.Hidden = true;
            btnSave.Frame = new RectangleF(0, 0, 60, 44);
            btnSave.OnButtonClick += HandleButtonSaveTouchUpInside;
            var btnSaveView = new UIView(new RectangleF(UIScreen.MainScreen.Bounds.Width - 60, 0, 60, 44));
            var rect2 = new RectangleF(btnSaveView.Bounds.X - 16, btnSaveView.Bounds.Y, btnSaveView.Bounds.Width, btnSaveView.Bounds.Height);
            btnSaveView.Bounds = rect2;
            btnSaveView.AddSubview(btnSave);
            _btnSave = new UIBarButtonItem(btnSaveView);

            var btnReset = new SessionsButton();
            btnReset.SetTitle("Reset", UIControlState.Normal);
            btnReset.Font = UIFont.FromName("HelveticaNeue", 12.0f);
            btnReset.Frame = new RectangleF(0, 12, 60, 40);
            btnReset.TouchUpInside += HandleButtonResetTouchUpInside;
            _btnReset = new UIBarButtonItem(btnReset);

            var btnNormalize = new SessionsButton();
            btnNormalize.SetTitle("Normalize", UIControlState.Normal);
            btnNormalize.Font = UIFont.FromName("HelveticaNeue", 12.0f);
            btnNormalize.Frame = new RectangleF(0, 12, 80, 40);
            btnNormalize.TouchUpInside += HandleButtonNormalizeTouchUpInside;
            _btnNormalize = new UIBarButtonItem(btnNormalize);

            NavigationItem.SetLeftBarButtonItem(_btnBack, true);
            NavigationItem.SetRightBarButtonItem(_btnSave, true);
            toolbar.Items = new UIBarButtonItem[2]{ _btnNormalize, _btnReset };
            
            var navCtrl = (SessionsNavigationController)NavigationController;
            navCtrl.SetBackButtonVisible(false);
            navCtrl.SetTitle("Equalizer Preset");

            for(int a = 0; a < 18; a++)
                AddFaderToScrollView(a.ToString() + ".0 kHz");

            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                NavigationController.InteractivePopGestureRecognizer.WeakDelegate = this;
                NavigationController.InteractivePopGestureRecognizer.Enabled = true;
            }

            base.ViewDidLoad();

            var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            navigationManager.BindEqualizerPresetDetailsView(null, this, _presetId);
        }
        public override void ViewDidLoad()
        {
            var screenSize = UIKitHelper.GetDeviceSize();

            tableView.WeakDataSource = this;
            tableView.WeakDelegate = this;

            UILongPressGestureRecognizer longPress = new UILongPressGestureRecognizer(HandleLongPress);
            longPress.MinimumPressDuration = 0.7f;
            longPress.WeakDelegate = this;
            tableView.AddGestureRecognizer(longPress);

            viewOptions.BackgroundColor = GlobalTheme.BackgroundColor;
            switchBypass.OnTintColor = GlobalTheme.SecondaryColor;
            switchBypass.On = false;
            switchBypass.ValueChanged += HandleSwitchBypassValueChanged;

            //sliderMasterVolume.SetThumbImage(UIImage.FromBundle("Images/Sliders/thumb"), UIControlState.Normal);
            //sliderMasterVolume.SetMinTrackImage(UIImage.FromBundle("Images/Sliders/slider2").CreateResizableImage(new UIEdgeInsets(0, 8, 0, 8), UIImageResizingMode.Tile), UIControlState.Normal);
            //sliderMasterVolume.SetMaxTrackImage(UIImage.FromBundle("Images/Sliders/slider").CreateResizableImage(new UIEdgeInsets(0, 8, 0, 8), UIImageResizingMode.Tile), UIControlState.Normal);
            //sliderMasterVolume.ValueChanged += HandleSliderMasterVolumeValueChanged;

            var btnDone = new SessionsFlatButton();
            btnDone.Label.Text = "Done";
            btnDone.Frame = new RectangleF(0, 0, 70, 44);
            btnDone.OnButtonClick += () => {
                NavigationController.DismissViewController(true, null);
            };
            var btnDoneView = new UIView(new RectangleF(0, 0, 70, 44));
            var rect = new RectangleF(btnDoneView.Bounds.X + 16, btnDoneView.Bounds.Y, btnDoneView.Bounds.Width, btnDoneView.Bounds.Height);
            btnDoneView.Bounds = rect;
            btnDoneView.AddSubview(btnDone);
            _btnDone = new UIBarButtonItem(btnDoneView);

            var btnAdd = new SessionsFlatButton();
            btnAdd.LabelAlignment = UIControlContentHorizontalAlignment.Right;
            btnAdd.Label.Text = "Add";
            btnAdd.Label.TextAlignment = UITextAlignment.Right;
            btnAdd.Label.Frame = new RectangleF(0, 0, 44, 44);
            btnAdd.ImageChevron.Image = UIImage.FromBundle("Images/Tables/plus_blue");
            btnAdd.ImageChevron.Frame = new RectangleF(70 - 22, 0, 22, 44);
            btnAdd.Frame = new RectangleF(0, 0, 70, 44);
            btnAdd.OnButtonClick += HandleButtonAddTouchUpInside;
            var btnAddView = new UIView(new RectangleF(UIScreen.MainScreen.Bounds.Width - 70, 0, 70, 44));
            var rect2 = new RectangleF(btnAddView.Bounds.X - 16, btnAddView.Bounds.Y, btnAddView.Bounds.Width, btnAddView.Bounds.Height);
            btnAddView.Bounds = rect2;
            btnAddView.AddSubview(btnAdd);
            _btnAdd = new UIBarButtonItem(btnAddView);

            NavigationItem.SetLeftBarButtonItem(_btnDone, true);
            NavigationItem.SetRightBarButtonItem(_btnAdd, true);

            var navCtrl = (SessionsNavigationController)NavigationController;
            navCtrl.SetBackButtonVisible(false);

            // Create MPVolumeView (only visible on physical iOS device)
            RectangleF rectVolume;
            if (UserInterfaceIdiomIsPhone)
                rectVolume = new RectangleF(74, 25, 236, 46);
            else
                rectVolume = new RectangleF(74, 25, 236, 46);
            _volumeView = new MPVolumeView(rectVolume);
            _volumeView.SetMinimumVolumeSliderImage(UIImage.FromBundle("Images/Sliders/slider2").CreateResizableImage(new UIEdgeInsets(0, 8, 0, 8), UIImageResizingMode.Tile), UIControlState.Normal);
            _volumeView.SetMaximumVolumeSliderImage(UIImage.FromBundle("Images/Sliders/slider").CreateResizableImage(new UIEdgeInsets(0, 8, 0, 8), UIImageResizingMode.Tile), UIControlState.Normal);
            _volumeView.SetVolumeThumbImage(UIImage.FromBundle("Images/Sliders/thumbbig"), UIControlState.Normal);
            this.View.AddSubview(_volumeView);

            base.ViewDidLoad();

            var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            navigationManager.BindEqualizerPresetsView(null, this);
        }
        public override void ViewDidLoad()
        {
            this.View.BackgroundColor = GlobalTheme.BackgroundColor;
            btnDeleteMarker.BackgroundColor = GlobalTheme.SecondaryColor;
            btnDeleteMarker.Layer.CornerRadius = 8;

            sliderPosition.SetThumbImage(UIImage.FromBundle("Images/Sliders/thumb"), UIControlState.Normal);
            sliderPosition.SetMinTrackImage(UIImage.FromBundle("Images/Sliders/slider2").CreateResizableImage(new UIEdgeInsets(0, 8, 0, 8), UIImageResizingMode.Tile), UIControlState.Normal);
            sliderPosition.SetMaxTrackImage(UIImage.FromBundle("Images/Sliders/slider").CreateResizableImage(new UIEdgeInsets(0, 8, 0, 8), UIImageResizingMode.Tile), UIControlState.Normal);

            sliderPosition.Transform = CGAffineTransform.MakeScale(0.7f, 0.7f);
            sliderPosition.Frame = new RectangleF(90, sliderPosition.Frame.Y + 1, sliderPosition.Frame.Width * 1.4f, sliderPosition.Frame.Height);

            // Add padding to text field (http://stackoverflow.com/questions/3727068/set-padding-for-uitextfield-with-uitextborderstylenone)
            UIView paddingView = new UIView(new RectangleF(0, 0, 5, 20));
            txtName.LeftView = paddingView;
            txtName.LeftViewMode = UITextFieldViewMode.Always;

            // Make sure the Done key closes the keyboard
            txtName.ShouldReturn = (a) => {
                txtName.ResignFirstResponder();
                return true;
            };
            textViewComments.ShouldBeginEditing = (a) => {
                UIView.Animate(0.2f, () => {
                    View.Bounds = new RectangleF(View.Bounds.X, View.Bounds.Y + 100, View.Bounds.Width, View.Bounds.Height);
                });
                return true;
            };
            textViewComments.ShouldEndEditing = (a) => {
                textViewComments.ResignFirstResponder();
                UIView.Animate(0.2f, () => {
                    View.Bounds = new RectangleF(View.Bounds.X, View.Bounds.Y - 100, View.Bounds.Width, View.Bounds.Height);
                });
                return true;
            };

            sliderPosition.ValueChanged += HandleSliderPositionValueChanged;

            var btnDone = new SessionsFlatButton();
            btnDone.Label.Text = "Done";
            btnDone.Frame = new RectangleF(0, 0, 70, 44);
            btnDone.OnButtonClick += () => {
                _marker.Name = txtName.Text;
                _marker.Comments = textViewComments.Text;
                _marker.Position = lblPosition.Text;
				OnUpdateMarkerDetails(_marker);
                this.DismissViewController(true, null);
            };
            var btnBackView = new UIView(new RectangleF(0, 0, 70, 44));
            var rect = new RectangleF(btnBackView.Bounds.X + 5, btnBackView.Bounds.Y, btnBackView.Bounds.Width, btnBackView.Bounds.Height);
            btnBackView.Bounds = rect;
            btnBackView.AddSubview(btnDone);
            _btnDone = new UIBarButtonItem(btnBackView);
            NavigationItem.SetLeftBarButtonItem(_btnDone, true);
            
            var navCtrl = (SessionsNavigationController)NavigationController;
            navCtrl.SetBackButtonVisible(false);
            navCtrl.SetTitle("Marker Details");

            base.ViewDidLoad();

            var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            navigationManager.BindMarkerDetailsView(this, _markerId);
        }
        public SessionsNavigationController(MobileNavigationTabType tabType) : base(typeof(SessionsNavigationBar), typeof(UIToolbar))
        {
            TabType = tabType;
            WeakDelegate = this;

            // Create messenger hub to listen to player changes
            _messengerHub = Bootstrapper.GetContainer().Resolve<ITinyMessengerHub>();
            _messengerHub.Subscribe<PlayerPlaylistIndexChangedMessage>((message) => {
                //Console.WriteLine("NavCtrl (" + TabType.ToString() + ") - PlayerPlaylistIndexChangedMessage");
                UpdateNowPlayingView();
            });
            _messengerHub.Subscribe<PlayerStatusMessage>((message) => {
                //Console.WriteLine("NavCtrl (" + TabType.ToString() + ") - PlayerStatusMessage - Status=" + message.Status.ToString());
                if(message.Status == PlayerStatusType.Playing ||
                   message.Status == PlayerStatusType.Paused)
                    _isPlayerPlaying = true;
                else
                    _isPlayerPlaying = false;
                
                UpdateNowPlayingView();
            });

            // Create controls
            _lblTitle = new UILabel(new RectangleF(60, 4, UIScreen.MainScreen.Bounds.Width - 120, 20));
            _lblTitle.TextColor = UIColor.White;
            _lblTitle.BackgroundColor = UIColor.Clear;
            _lblTitle.Text = "";
            _lblTitle.TextAlignment = UITextAlignment.Center;
            _lblTitle.AdjustsFontSizeToFitWidth = true;
            _lblTitle.MinimumScaleFactor = 14f/16f; // min:14pt max:16pt
            _lblTitle.Font = UIFont.FromName("HelveticaNeue", 16);

            _imageViewIcon = new UIImageView();
            _imageViewIcon.Image = UIImage.FromBundle("Images/Nav/album");
            _imageViewIcon.BackgroundColor = UIColor.Clear;

            _btnBack = new SessionsFlatButton();
            _btnBack.Alpha = 0;
            _btnBack.Frame = new RectangleF(0, 0, 70, 44);
            _btnBack.OnButtonClick += () =>  {

                var viewController = (BaseViewController)VisibleViewController;
                if (viewController.ConfirmBackButton && !_confirmedViewPop)
                {
                    var alertView = new UIAlertView(viewController.ConfirmBackButtonTitle, viewController.ConfirmBackButtonMessage, null, "OK", new string[1] { "Cancel" });
                    alertView.Clicked += (object sender, UIButtonEventArgs e) => {
                        Console.WriteLine("AlertView button index: {0}", e.ButtonIndex);
                        switch(e.ButtonIndex)
                        {
                            case 0:
                                viewController.ConfirmedBackButton();
                                _confirmedViewPop = true;
								Console.WriteLine("NavCtrl - PopViewController A");
                                PopViewControllerAnimated(true);
                                break;
                            default:
                                break;
                        }
                    };
                    alertView.Show();
                    return;
                }

                _confirmedViewPop = false;
                if(ViewControllers.Length > 1)
				{
					Console.WriteLine("NavCtrl - PopViewController B");
                    PopViewControllerAnimated(true);
				}
            };

            _btnPlaylist = new SessionsFlatButton();
            _btnPlaylist.LabelAlignment = UIControlContentHorizontalAlignment.Right;
			_btnPlaylist.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 80, 0, 80, 44);
            _btnPlaylist.Alpha = 0;
            _btnPlaylist.Label.TextAlignment = UITextAlignment.Right;
			_btnPlaylist.Label.Text = "Playlist";
			_btnPlaylist.Label.Frame = new RectangleF(0, 0, 54, 44);
            _btnPlaylist.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron_blue");
			_btnPlaylist.ImageChevron.Frame = new RectangleF(80 - 22, 0, 22, 44);
            _btnPlaylist.OnButtonClick += () => {
				_messengerHub.PublishAsync<MobileNavigationManagerCommandMessage>(new MobileNavigationManagerCommandMessage(this, MobileNavigationManagerCommandMessageType.ShowPlaylistView));
            };

            _btnNowPlaying = new SessionsFlatButton();
            _btnNowPlaying.LabelAlignment = UIControlContentHorizontalAlignment.Right;
            _btnNowPlaying.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 70, 0, 70, 44);
            _btnNowPlaying.Alpha = 0;
            _btnNowPlaying.Label.TextAlignment = UITextAlignment.Right;
            _btnNowPlaying.Label.Frame = new RectangleF(0, 0, 44, 44);
            _btnNowPlaying.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron_blue");
            _btnNowPlaying.ImageChevron.Frame = new RectangleF(70 - 22, 0, 22, 44);
            _btnNowPlaying.Label.Text = "Player";
            _btnNowPlaying.OnButtonClick += () => {
                _messengerHub.PublishAsync<MobileNavigationManagerCommandMessage>(new MobileNavigationManagerCommandMessage(this, MobileNavigationManagerCommandMessageType.ShowPlayerView));
            };

            this.NavigationBar.AddSubview(_btnBack);
            this.NavigationBar.AddSubview(_btnPlaylist);
            this.NavigationBar.AddSubview(_btnNowPlaying);
            this.NavigationBar.AddSubview(_lblTitle);
            this.NavigationBar.AddSubview(_imageViewIcon);
        }