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

            // get the orientation state. WE consider unknown- 1, profile 0, landscape 1,
            int orientationState = SpringboardViewController.IsDeviceLandscape( ) == true ? 1 : 0;

            // if the states are in disagreement, correct it
            if (OrientationState != orientationState)
            {
                OrientationState = orientationState;

                // get the offset scrolled before changing our frame (which will cause us to lose it)
                nfloat scrollOffsetPercent = UIScrollView.ContentOffset.Y / ( nfloat )Math.Max(1, UIScrollView.ContentSize.Height);

                //note: the frame height of the nav bar is what it CURRENTLY is, not what it WILL be after we rotate. So, when we go from Portrait to Landscape,
                // it says 40, but it's gonna be 32. Conversely, going back, we use 32 and it's actually 40, which causes us to start this view 8px too high.
                if (MobileApp.Shared.Network.RockLaunchData.Instance.Data.DeveloperModeEnabled == true)
                {
                    // add the refresh button if necessary
                    if (RefreshButton.Superview == null)
                    {
                        View.AddSubview(RefreshButton);
                    }

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

                    UIScrollView.Frame          = new CGRect(0, 0, View.Bounds.Width, View.Bounds.Height - RefreshButton.Frame.Height);
                    UIScrollView.Layer.Position = new CGPoint(UIScrollView.Layer.Position.X, UIScrollView.Layer.Position.Y + RefreshButton.Frame.Bottom);
                }
                else
                {
                    // remove the refresh button if necessary
                    if (RefreshButton.Superview != null)
                    {
                        RefreshButton.RemoveFromSuperview( );
                    }

                    UIScrollView.Frame          = new CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
                    UIScrollView.Layer.Position = new CGPoint(UIScrollView.Layer.Position.X, UIScrollView.Layer.Position.Y);
                }

                Indicator.Layer.Position = new CGPoint(View.Bounds.Width / 2, View.Bounds.Height / 2);

                // re-create our notes with the new dimensions
                PrepareCreateNotes(scrollOffsetPercent, false);

                // since we're changing orientations, hide the tutorial screen
                AnimateTutorialScreen(false);

                ResultView.SetBounds(View.Bounds.ToRectF( ));
            }
        }
Example #3
0
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            // only allow panning if the task is ok with it AND we're in portrait mode.
            if (CurrentTask.CanContainerPan(touches, evt) == true &&
                SpringboardViewController.IsDeviceLandscape( ) == false)
            {
                PanGesture.Enabled = true;
            }
            else
            {
                PanGesture.Enabled = false;
            }
        }
        public void LayoutChanging( )
        {
            UpdateBackButton( );

            if (SpringboardViewController.IsDeviceLandscape( ) == true)
            {
                EnableSpringboardRevealButton(false);
            }
            else
            {
                EnableSpringboardRevealButton(true);
            }

            if (CurrentTask != null)
            {
                CurrentTask.LayoutChanging( );
            }
        }
Example #5
0
        public override void LayoutChanged( )
        {
            base.LayoutChanged( );

            // get the orientation state. WE consider unknown- 1, profile 0, landscape 1,
            int orientationState = SpringboardViewController.IsDeviceLandscape( ) == true ? 1 : 0;

            // if the states are in disagreement, correct it
            if (OrientationState != orientationState)
            {
                OrientationState = orientationState;

                BibleWebView.Frame          = new CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
                BibleWebView.Layer.Position = new CGPoint(BibleWebView.Layer.Position.X, BibleWebView.Layer.Position.Y);

                BlockerView.SetBounds(View.Bounds.ToRectF( ));
                ResultView.SetBounds(View.Bounds.ToRectF( ));
            }
        }
        public override void ViewDidLayoutSubviews()
        {
            // get the orientation state. WE consider unknown- 1, profile 0, landscape 1,
            int orientationState = SpringboardViewController.IsDeviceLandscape( ) == true ? 1 : 0;

            // if the states are in disagreement, correct it
            if (OrientationState != orientationState)
            {
                OrientationState = orientationState;

                Toolbar.Frame = new CGRect(0, View.Bounds.Height - 40, View.Bounds.Width, 40);

                NSString cancelLabel = new NSString(PrivateImageCropConfig.CropCancelButton_Text);
                CGSize   buttonSize  = cancelLabel.StringSize(CancelButton.Font);
                CancelButton.Bounds = new CGRect(0, 0, buttonSize.Width, buttonSize.Height);


                NSString editLabel = new NSString(PrivateImageCropConfig.CropOkButton_Text);
                buttonSize        = editLabel.StringSize(EditButton.Font);
                EditButton.Bounds = new CGRect(0, 0, buttonSize.Width, buttonSize.Height);

                ImageView.Frame = GetImageViewFrame( );

                ButtonContainer.Frame = new CGRect(0, View.Bounds.Height - 40, View.Bounds.Width, 40);
                CancelButton.Frame    = new CGRect((CancelButton.Frame.Width / 2), 0, CancelButton.Frame.Width, CancelButton.Frame.Height);
                EditButton.Frame      = new CGRect(ButtonContainer.Frame.Width - (EditButton.Frame.Width * 2.5f), 0, EditButton.Frame.Width, EditButton.Frame.Height);

                DisplayLayout( );

                // make sure we reset to editing mode
                if (CropMode.Editing != Mode)
                {
                    SetMode(CropMode.Editing);
                }
                else
                {
                    AnimateBlocker(true);
                }
            }
        }