예제 #1
0
        public void SetFragment(MobileNavigationTabType tabType, Fragment fragment)
        {
            //var transaction = _fragmentManager.BeginTransaction();
            int index = _fragments.FindIndex(x => x.Item1 == tabType);
            if (index == -1)
            {
                // New fragment 
                _fragments.Add(new Tuple<MobileNavigationTabType, Fragment>(tabType, fragment));
                //transaction.Add(_viewPager.Id, fragment);
            }
            else
            {
                // Replace fragment
                //transaction.Remove(_fragments[index].Item2);
                _fragments[index] = new Tuple<MobileNavigationTabType, Fragment>(tabType, fragment);
                //transaction.Add(_viewPager.Id, fragment);
            }

            NotifyDataSetChanged();
        }
예제 #2
0
        public void PushTabView(MobileNavigationTabType type, UIViewController viewController)
        {
			Console.WriteLine("AppDelegate - PushTabView - tabType: {0} viewController: {1}", type, viewController.GetType().FullName);
            InvokeOnMainThread(() => {
                if (viewController is PlayerViewController)
                    viewController.HidesBottomBarWhenPushed = true;

                var navCtrl = _navigationControllers.FirstOrDefault(x => x.Key == type).Value;
                navCtrl.PushViewController(viewController, true);
            });
        }
 public override void NotifyMobileLibraryBrowserQueryChange(MobileNavigationTabType type, MobileLibraryBrowserType browserType,
     LibraryQuery query)
 {
 }
예제 #4
0
 public override void CreatePlayerView(MobileNavigationTabType tabType)
 {
     var intent = new Intent(SessionsApplication.GetApplicationContext(), typeof (PlayerActivity));
     intent.AddFlags(ActivityFlags.NewTask);
     SessionsApplication.GetApplicationContext().StartActivity(intent);
 }
예제 #5
0
 public override void PushTabView(MobileNavigationTabType type, IBaseView view)
 {
     AppDelegate.PushTabView(type, (UIViewController)view);
 }
예제 #6
0
        public virtual void BindMobileLibraryBrowserView(IMobileLibraryBrowserView view, MobileNavigationTabType tabType, MobileLibraryBrowserType browserType, LibraryQuery query)
        {
            var key = new Tuple<MobileNavigationTabType, MobileLibraryBrowserType>(tabType, browserType);
            view.OnViewDestroy = (view2) =>
            {
                // The view list can be accessed from different threads.
                lock (_locker)
                {
                    Tracing.Log("MobileNavigationManager - CreateMobileLibraryBrowserView - Destroying view - type: {0}", tabType.ToString());
                    if (_mobileLibraryBrowserList.ContainsKey(key))
                    {
                        _mobileLibraryBrowserList[key].Item2.ViewDestroyed();
                        _mobileLibraryBrowserList.Remove(key);
                    }
                }
            };

            lock (_locker)
            {
                var presenter = Bootstrapper.GetContainer().Resolve<IMobileLibraryBrowserPresenter>(new NamedParameterOverloads() { { "tabType", tabType }, { "browserType", browserType }, { "query", query } });
                presenter.BindView(view);
                _mobileLibraryBrowserList.Add(key, new Tuple<IMobileLibraryBrowserView, IMobileLibraryBrowserPresenter>(view, presenter));
            }
        }
예제 #7
0
        public virtual void BindPlayerView(MobileNavigationTabType tabType, IPlayerView view)
        {
            _playerView = view;
            _playerView.OnViewDestroy = (view2) =>
            {
                _playerPresenter.ViewDestroyed();
                _playerPresenter = null;
                _playerView = null;
            };
            _playerPresenter = Bootstrapper.GetContainer().Resolve<IPlayerPresenter>();
            _playerPresenter.BindView(view);

            // Create sub views
            var playerMetadata = CreatePlayerMetadataView();
            var loops = CreateLoopsView();
            var markers = CreateMarkersView();
            var timeShifting = CreateTimeShiftingView();
            var pitchShifting = CreatePitchShiftingView();

            _playerView.PushSubView(playerMetadata);
            _playerView.PushSubView(loops);
            _playerView.PushSubView(markers);
            _playerView.PushSubView(timeShifting);
            _playerView.PushSubView(pitchShifting);

            // Check if the Start Resume Playback view must be shown after startup
            if (_resumeCloudDeviceInfo != null)
            {
                Tracing.Log("MobileNavigationManager - BindPlayerView - showing Start Resume Playback view...");
                var startResumePlaybackView = CreateStartResumePlaybackView();
                PushDialogView(MobileDialogPresentationType.Overlay, "Resume Playback", _playerView, startResumePlaybackView);
                _resumeCloudDeviceInfo = null;
            }
        }
 public override void NotifyMobileLibraryBrowserQueryChange(MobileNavigationTabType type, MobileLibraryBrowserType browserType,
     LibraryQuery query)
 {
     Debug.WriteLine("WindowsPhoneNavigationManager - NotifyMobileLibraryBrowserQueryChange");
 }
예제 #9
0
        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);
        }
예제 #10
0
 public override void PushTabView(MobileNavigationTabType type, IBaseView view)
 {
     Debug.WriteLine("WindowsPhoneNavigationManager - PushTabView");
 }
예제 #11
0
 public override void PushTabView(MobileNavigationTabType type, MobileLibraryBrowserType browserType, LibraryQuery query, IBaseView view)
 {
     Debug.WriteLine("WindowsPhoneNavigationManager - PushTabView");
 }
예제 #12
0
 public override void AddTab(MobileNavigationTabType type, string title, MobileLibraryBrowserType browserType, LibraryQuery query,
     IBaseView view)
 {
     Debug.WriteLine("WindowsPhoneNavigationManager - AddTab");
 }
예제 #13
0
 public override void AddTab(MobileNavigationTabType type, string title, IBaseView view)
 {
     Debug.WriteLine("WindowsPhoneNavigationManager - AddTab");
 }
예제 #14
0
 public MobileLibraryBrowserFragment(MobileNavigationTabType tabType, MobileLibraryBrowserType browserType, LibraryQuery query) : base()
 {
     _tabType = tabType;
     _browserType = browserType;
     _query = query;
 }
예제 #15
0
 public abstract void PushTabView(MobileNavigationTabType type, IBaseView view);
예제 #16
0
        public void AddTab(MobileNavigationTabType type, string title, MobileLibraryBrowserType browserType, LibraryQuery query, IBaseView view)
        {
			//Tracing.Log("MainViewController - AddTab - type: {0} title: {1} browserType: {2}", type, title, browserType);
            var appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
            appDelegate.AddTab(type, title, (UIViewController)view);
        }
예제 #17
0
        public virtual IMobileLibraryBrowserView CreateMobileLibraryBrowserView(MobileNavigationTabType tabType, MobileLibraryBrowserType browserType, LibraryQuery query)
        {
            var key = new Tuple<MobileNavigationTabType, MobileLibraryBrowserType>(tabType, browserType);
            
            // Check if view already exists
            if(_mobileLibraryBrowserList.ContainsKey(key))
            {
                Tuple<IMobileLibraryBrowserView, IMobileLibraryBrowserPresenter> viewPresenter;
                if (_mobileLibraryBrowserList.TryGetValue(key, out viewPresenter))
                {
                    if (viewPresenter != null)
                    {
                        viewPresenter.Item2.ChangeQuery(browserType, query);
                        return viewPresenter.Item1;
                    }
                }
            }

            var view = Bootstrapper.GetContainer().Resolve<IMobileLibraryBrowserView>(new NamedParameterOverloads() { { "tabType", tabType }, { "browserType", browserType }, { "query", query } });
            return view;
        }
예제 #18
0
 public override void AddTab(MobileNavigationTabType type, string title, IBaseView view)
 {
 }
예제 #19
0
        public virtual void CreatePlayerView(MobileNavigationTabType tabType)
        {
            if (_playerView == null)
                _playerView = Bootstrapper.GetContainer().Resolve<IPlayerView>();

            // This is only used on iOS. Shouldn't this be routed to the main view? IMobileMainView.PushTabView?
            PushTabView(tabType, _playerView);
        }
예제 #20
0
 public override void AddTab(MobileNavigationTabType type, string title, MobileLibraryBrowserType browserType, LibraryQuery query,
     IBaseView view)
 {
 }
예제 #21
0
        public void AddTab(MobileNavigationTabType type, string title, MobileLibraryBrowserType browserType, LibraryQuery query, IBaseView view)
        {
            Console.WriteLine("MainActivity - Adding tab {0}", title);

            //_tabHistory.Add(new Tuple<MobileNavigationTabType, List<Tuple<MobileLibraryBrowserType, LibraryQuery>>>(type, new List<Tuple<MobileLibraryBrowserType, LibraryQuery>>() {
            //   new Tuple<MobileLibraryBrowserType, LibraryQuery>(browserType, query)
            //}));

            _fragment = (Fragment)view;
            FragmentTransaction transaction = FragmentManager.BeginTransaction();
            transaction.Replace(Resource.Id.main_fragmentContainer, _fragment);
            transaction.Commit();
        }
예제 #22
0
 public override void PushTabView(MobileNavigationTabType type, IBaseView view)
 {
 }
예제 #23
0
 public override void PushTabView(MobileNavigationTabType type, IBaseView view)
 {
     // Not used on Android
 }
예제 #24
0
 public override void PushTabView(MobileNavigationTabType type, MobileLibraryBrowserType browserType, LibraryQuery query, IBaseView view)
 {
 }
예제 #25
0
 public override void CreatePlayerView(MobileNavigationTabType tabType)
 {
     var view = Bootstrapper.GetContainer().Resolve<IPlayerView>();
     AppDelegate.PushTabView(tabType, (PlayerViewController)view);
 }
예제 #26
0
        public void AddTab(MobileNavigationTabType type, string title, UIViewController viewController)
        {
            InvokeOnMainThread(() => {
                UITextAttributes attr = new UITextAttributes();
                attr.Font = UIFont.FromName("HelveticaNeue", 11);
                attr.TextColor = UIColor.LightGray;
                attr.TextShadowColor = UIColor.Clear;
                UITextAttributes attrSelected = new UITextAttributes();
                attrSelected.Font = UIFont.FromName("HelveticaNeue", 11);
                attrSelected.TextColor = UIColor.White;
                attrSelected.TextShadowColor = UIColor.Clear;

                var navCtrl = new SessionsNavigationController(type);
                navCtrl.SetTitle(title);
                navCtrl.TabBarItem.SetTitleTextAttributes(attr, UIControlState.Normal);
                navCtrl.TabBarItem.SetTitleTextAttributes(attrSelected, UIControlState.Selected);
                navCtrl.TabBarItem.Title = title;
                if(title.ToUpper() == "MORE")
                    navCtrl.TabBarItem.Image = UIImage.FromBundle("Images/Tabs/more");
                else if(title.ToUpper() == "ARTISTS")
                    navCtrl.TabBarItem.Image = UIImage.FromBundle("Images/Tabs/artists");
                else if(title.ToUpper() == "ALBUMS")
                    navCtrl.TabBarItem.Image = UIImage.FromBundle("Images/Tabs/albums");
                else if(title.ToUpper() == "SONGS")
                    navCtrl.TabBarItem.Image = UIImage.FromBundle("Images/Tabs/songs");
				else if(title.ToUpper() == "PLAYLISTS")
                    navCtrl.TabBarItem.Image = UIImage.FromBundle("Images/Tabs/sessions");

                navCtrl.PushViewController(viewController, false);
                _navigationControllers.Add(new KeyValuePair<MobileNavigationTabType, SessionsNavigationController>(type, navCtrl));

                var list = new List<UIViewController>();
				if (_mainViewController.TabBarController.ViewControllers != null)
					list = _mainViewController.TabBarController.ViewControllers.ToList();
                list.Add(navCtrl);
				_mainViewController.TabBarController.ViewControllers = list.ToArray();
            });
        }