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);
            }
        }
        public override void LayoutChanged()
        {
            base.LayoutChanged();

            // center the movie window.
            nfloat movieHeight = 0.00f;
            nfloat movieWidth  = View.Frame.Width;

            // if we have the movie size, correctly resize it
            if (MoviePlayer.NaturalSize.Width != 0 && MoviePlayer.NaturalSize.Height != 0)
            {
                // fit the video into the width of the view
                nfloat aspectRatio = MoviePlayer.NaturalSize.Height / MoviePlayer.NaturalSize.Width;
                movieWidth  = View.Frame.Width;
                movieHeight = movieWidth * aspectRatio;

                // if the height is still too large, scale the width down from what our height is
                if (movieHeight > View.Frame.Height)
                {
                    aspectRatio = MoviePlayer.NaturalSize.Width / MoviePlayer.NaturalSize.Height;

                    movieHeight = View.Frame.Height;
                    movieWidth  = View.Frame.Height * aspectRatio;
                }
            }
            else
            {
                // otherwise as a temporary measure, use half the viewing width
                movieWidth  = View.Frame.Width;
                movieHeight = View.Frame.Height;
            }

            // center the movie frame and activity indicator
            MoviePlayer.View.Frame = new CGRect((View.Frame.Width - movieWidth) / 2, (View.Frame.Height - movieHeight) / 2, movieWidth, movieHeight);

            ActivityIndicator.Layer.Position = new CGPoint((View.Frame.Width - ActivityIndicator.Frame.Width) / 2,
                                                           (View.Frame.Height - ActivityIndicator.Frame.Height) / 2);

            // landscape wide devices MAY show the nav toolbar
            if (SpringboardViewController.IsLandscapeWide( ) == true)
            {
                //Task.NavToolbar.RevealForTime( 3.0f );
                Task.NavToolbar.Reveal(true);
                Task.NavToolbar.SetBackButtonEnabled(true);
            }
            // landscape non-wide devices should not
            else if (SpringboardViewController.IsDeviceLandscape( ) == true)
            {
                Task.NavToolbar.Reveal(false);
            }
            else
            {
                //Task.NavToolbar.RevealForTime( 3.0f );
                Task.NavToolbar.Reveal(true);
                Task.NavToolbar.SetBackButtonEnabled(true);
            }

            ResultView.SetBounds(View.Frame.ToRectF( ));
        }
Beispiel #3
0
        public void RevealSpringboard(bool wantReveal)
        {
            // only do something if there's a change
            //if( wantReveal != SpringboardRevealed )
            {
                // of course don't allow a change while we're animating it.
                if (Animating == false)
                {
                    Animating = true;

                    // Animate the front panel out
                    UIView.Animate(PrivatePrimaryContainerConfig.SlideRate, 0, UIViewAnimationOptions.CurveEaseInOut,
                                   new Action(
                                       delegate
                    {
                        float endPos = 0.0f;
                        if (wantReveal == true)
                        {
                            endPos = (float)PrivatePrimaryContainerConfig.SlideAmount_iOS;
                            DarkPanel.Layer.Opacity = PrivatePrimaryContainerConfig.SlideDarkenAmount;
                        }
                        else
                        {
                            endPos = 0.00f;
                            DarkPanel.Layer.Opacity = 0.0f;
                        }

                        float moveAmount    = (float)(endPos - View.Layer.Position.X);
                        View.Layer.Position = new CGPoint(View.Layer.Position.X + moveAmount, View.Layer.Position.Y);
                    })

                                   , new Action(
                                       delegate
                    {
                        Animating = false;

                        SpringboardRevealed = wantReveal;

                        // if the springboard is open, disable input on app stuff if the device doesn't support
                        // regular landscape
                        if (SpringboardViewController.IsLandscapeWide( ) == false)
                        {
                            Container.View.UserInteractionEnabled = !SpringboardRevealed;
                        }
                    })
                                   );
                }
            }
        }
Beispiel #4
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 );
                }
            }
        }
Beispiel #5
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( );
        }
Beispiel #6
0
        public bool ActivateTask(Task task)
        {
            // don't allow switching activites while we're animating.
            if (Animating == false)
            {
                Container.ActivateTask(task);

                // I don't think this call does anything, but getting this close to
                // shipping, i don't want to remove it.
                PopToRootViewController(false);

                // task activation should only close the springboard if our device isn't wide landscape
                if (SpringboardViewController.IsLandscapeWide( ) == false)
                {
                    RevealSpringboard(false);
                }

                return(true);
            }

            return(false);
        }