Esempio n. 1
0
        public void UpdateBackButton( )
        {
            // if there are VCs in the stack
            if (SubNavigationController.ViewControllers.Length > 1)
            {
                // only allow back if we're in regular landscape or portrait mode
                bool allowBack = false;
                if (SpringboardViewController.IsLandscapeWide( ) == true || SpringboardViewController.IsDevicePortrait( ) == true)
                {
                    allowBack = true;
                }

                // OR, if there's a current task, ask it if there should be an override
                if (CurrentTask != null)
                {
                    // if they return true, read their override result.
                    bool overrideBackResult = false;
                    if (CurrentTask.WantOverrideBackButton(ref overrideBackResult))
                    {
                        allowBack = overrideBackResult;
                    }
                }
                SubNavToolbar.SetBackButtonEnabled(allowBack);
            }
            else
            {
                SubNavToolbar.SetBackButtonEnabled(false);
            }
        }
Esempio n. 2
0
        public override void TouchesEnded(TaskUIViewController taskUIViewController, NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(taskUIViewController, touches, evt);

            // immediately hide the toolbar on the main page
            if (ActiveViewController == MainViewController)
            {
                NavToolbar.Reveal(false);
            }
            // allow it as long as it's the watch window in portrait mode or landscape wide mode.
            else if ((ActiveViewController as NotesWatchUIViewController) != null)
            {
                if (SpringboardViewController.IsLandscapeWide( ) || SpringboardViewController.IsDevicePortrait( ))
                {
                    //NavToolbar.RevealForTime( 3.0f );
                }
            }
        }
Esempio n. 3
0
        public void LayoutChanging( )
        {
            // for landscape regular, permanantly reveal the springboard
            if (SpringboardViewController.IsLandscapeWide( ) == true)
            {
                View.Frame = new CGRect(PrivatePrimaryContainerConfig.SlideAmount_iOS, 0, SpringboardViewController.TraitSize.Width - PrivatePrimaryContainerConfig.SlideAmount_iOS, SpringboardViewController.TraitSize.Height);

                SpringboardRevealed = true;
                Container.View.UserInteractionEnabled = true;

                DarkPanel.Hidden        = true;
                DarkPanel.Layer.Opacity = 0.0f;

                PanGesture.Enabled = false;
            }
            else
            {
                View.Frame = new CGRect(0, 0, SpringboardViewController.TraitSize.Width, SpringboardViewController.TraitSize.Height);

                DarkPanel.Hidden        = false;
                DarkPanel.Layer.Opacity = 0.0f;

                SpringboardRevealed = false;
                Container.View.UserInteractionEnabled = true;

                // only allow panning if we're in portrait. We COULD be going into normal Landscape
                if (SpringboardViewController.IsDevicePortrait( ) == true)
                {
                    PanGesture.Enabled = true;
                }
                else
                {
                    PanGesture.Enabled = false;
                }
            }

            DarkPanel.Bounds = View.Bounds;

            ApplyEdgeShadow( );

            Container.LayoutChanging( );
        }
Esempio n. 4
0
        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            Rock.Mobile.Util.Debug.WriteLine("Touches Ended");

            // for base.TouchesEnded, we do not want to call that FIRST if we're destroying the notes and switching to another page within the App.

            // if the tutorial is showing, all we want to do is hide it.
            // If we process input, it's possible they'll tap thru it to a URL, which will
            // switch pages and cause a lot of user confustion
            if (TutorialShowing( ))
            {
                AnimateTutorialScreen(false);
            }
            else
            {
                UITouch touch = touches.AnyObject as UITouch;
                if (touch != null)
                {
                    if (Note != null)
                    {
                        // should we visit a website?
                        bool urlLaunchesExternalBrowser = false;
                        bool urlUsesRockImpersonation   = false;

                        string activeUrl = Note.TouchesEnded(touch.LocationInView(UIScrollView).ToPointF( ), out urlLaunchesExternalBrowser, out urlUsesRockImpersonation);
                        if (string.IsNullOrEmpty(activeUrl) == false)
                        {
                            // see if the task should handle it (as in its a redirect within the app)
                            if (SpringboardViewController.IsAppURL(activeUrl) == true)
                            {
                                // HACK JHM 9-1-2017: We don't currently have the ability to transition from a landscape Note to a portrait Task.
                                // Because of that, they either need to be on an iPad, or have their phone in portrait mode. This isn't ideal,
                                // but without adding support for landscape->portrait, we don't have any other choice.
                                if (SpringboardViewController.SupportsLandscapeWide( ) == true || SpringboardViewController.IsDevicePortrait( ) == true)
                                {
                                    SaveNoteState(UIScrollView.ContentOffset.Y / ( nfloat )Math.Max(1, UIScrollView.ContentSize.Height));
                                    DestroyNotes( );

                                    // if the url uses the rock impersonation token, it's safe to assume they tapped the takeaway.
                                    if (urlUsesRockImpersonation)
                                    {
                                        MessageAnalytic.Instance.Trigger(MessageAnalytic.Takeaway, activeUrl);
                                    }

                                    Task.HandleAppURL(activeUrl);
                                }
                            }
                            else
                            {
                                // cleanup the notes before leaving
                                SaveNoteState(UIScrollView.ContentOffset.Y / ( nfloat )Math.Max(1, UIScrollView.ContentSize.Height));
                                DestroyNotes( );

                                // if not, it's either a websie or bible verse
                                Task.NavToolbar.Reveal(true);
                                Task.NavToolbar.SetBackButtonEnabled(true);

                                if (App.Shared.BibleRenderer.IsBiblePrefix(activeUrl))
                                {
                                    BiblePassageViewController viewController = new BiblePassageViewController(activeUrl, Task);
                                    Task.PerformSegue(this, viewController);
                                }
                                else
                                {
                                    TaskWebViewController.HandleUrl(urlLaunchesExternalBrowser, urlUsesRockImpersonation, activeUrl, Task, this, true, false, false);
                                }
                            }
                        }
                    }
                }

                // when a touch is released, re-enabled scrolling
                UIScrollView.ScrollEnabled = true;
            }

            // Process TouchesEnded AFTER handling locally- we need to do this
            // in case the Note above wants to switch to another activity within the app.
            base.TouchesEnded(touches, evt);
        }