public void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            // This API sometime cannot return the correct value.
            // Maybe this is the Xamarin or iOS bug
            // https://bugzilla.xamarin.com/show_bug.cgi?id=37064
            var menu = _basePage.SlideMenu;
            double NavigationBarHeight = 0;
            // this is used for rotation
            double bigValue = UIScreen.MainScreen.Bounds.Height > UIScreen.MainScreen.Bounds.Width ? UIScreen.MainScreen.Bounds.Height : UIScreen.MainScreen.Bounds.Width;
            double smallValue = UIScreen.MainScreen.Bounds.Height < UIScreen.MainScreen.Bounds.Width ? UIScreen.MainScreen.Bounds.Height : UIScreen.MainScreen.Bounds.Width;
            if (toSize.Width < toSize.Height) {
                ScreenSizeHelper.ScreenHeight = bigValue;
                // this is used for mutiltasking
                ScreenSizeHelper.ScreenWidth = toSize.Width < smallValue ? toSize.Width : smallValue;
                NavigationBarHeight = bigValue - toSize.Height;
            } else {
                ScreenSizeHelper.ScreenHeight = smallValue;
                ScreenSizeHelper.ScreenWidth = toSize.Width < bigValue ? toSize.Width : bigValue;
                NavigationBarHeight = smallValue - toSize.Height;
            }
            if (_dragGesture == null)
                return;

            menu.PageBottomOffset = NavigationBarHeight;

            _dragGesture.UpdateLayoutSize (menu);
            var rect = _dragGesture.GetHidePosition ();
            menu.Layout (new Xamarin.Forms.Rectangle (
                rect.left,
                rect.top,
                (rect.right - rect.left),
                (rect.bottom - rect.top)));
            _dragGesture.LayoutHideStatus ();
        }
		public override void ViewWillTransitionToSize (CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
		{
			if (toSize.Width > 320.0f) {
				ForcedTraitCollection = UITraitCollection.FromHorizontalSizeClass (UIUserInterfaceSizeClass.Regular);
			} else {
				ForcedTraitCollection = new UITraitCollection ();
			}

			base.ViewWillTransitionToSize (toSize, coordinator);
		}
		public override void ViewWillTransitionToSize (CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
		{
			base.ViewWillTransitionToSize (toSize, coordinator);

			var corner = stickyBehavior.CurrentCorner;
			stickyBehavior.Enabled = false;
			stickyBehavior.UpdateFieldsInBounds (new CGRect (CGPoint.Empty, toSize));

			coordinator.AnimateAlongsideTransition (context => {
				itemView.Center = stickyBehavior.GetPositionForCorner (corner);
			}, context => {
				stickyBehavior.Enabled = true;
			});
		}
Example #4
0
 public override void ViewWillTransitionToSize(CoreGraphics.CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     View.SetNeedsLayout();
 }
        public override void WillTransitionToTraitCollection(UITraitCollection traitCollection, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.WillTransitionToTraitCollection(traitCollection, coordinator);

            CurrentTraitCollection = traitCollection;
        }
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize( toSize, coordinator );

            TraitSize = toSize;

            if ( NavViewController != null )
            {
                NavViewController.LayoutChanging( );
                NavViewController.LayoutChanged( );
            }
        }
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.ViewWillTransitionToSize(toSize, coordinator);
     collectionView.CollectionViewLayout.InvalidateLayout();
 }
 public override void WillTransitionToTraitCollection(UITraitCollection traitCollection, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.WillTransitionToTraitCollection(traitCollection, coordinator);
     coordinator.AnimateAlongsideTransition((UIViewControllerTransitionCoordinatorContext) => {
         UpdateConstraintsForTraitCollection(traitCollection);
         View.SetNeedsLayout();
     }, (UIViewControllerTransitionCoordinatorContext) => {
     });
 }
Example #9
0
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            scrollValid = false;
        }
		public override void WillTransitionToTraitCollection (UITraitCollection traitCollection, IUIViewControllerTransitionCoordinator coordinator)
		{
			base.WillTransitionToTraitCollection (traitCollection, coordinator);
			coordinator.AnimateAlongsideTransition ((UIViewControllerTransitionCoordinatorContext) => {
				UpdateConstraintsForTraitCollection (traitCollection);
				View.SetNeedsLayout ();
			}, (UIViewControllerTransitionCoordinatorContext) => {
			});
		}
 // Update the image when the device is rotated.
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     ImageView.SetNeedsDisplay();
 }
 public override void WillTransitionToTraitCollection(UITraitCollection traitCollection, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.WillTransitionToTraitCollection(traitCollection, coordinator);
     UpdatePreferredContentSizeWithTraitCollection(traitCollection);
 }
 public override void WillTransitionToTraitCollection(UITraitCollection traitCollection, IUIViewControllerTransitionCoordinator coordinator)
 {
     adjustOffsetForTransition();
 }
 public override void ViewWillTransitionToSize(CoreGraphics.CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     adjustOffsetForTransition();
 }
		public override void ViewWillTransitionToSize (CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
		{
			base.ViewWillTransitionToSize (toSize, coordinator);

			UIDeviceOrientation deviceOrientation = UIDevice.CurrentDevice.Orientation;
			if (deviceOrientation.IsPortrait () || deviceOrientation.IsLandscape ()) {
				var previewLayer = (AVCaptureVideoPreviewLayer)PreviewView.Layer;
				var connection = PreviewLayer.Connection;
				if(connection != null)
					connection.VideoOrientation = (AVCaptureVideoOrientation)deviceOrientation;
			}
		}
		// Update the image when the device is rotated.
		public override void ViewWillTransitionToSize (CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
		{
			ImageView.SetNeedsDisplay ();
		}
		public override void ViewWillTransitionToSize (CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
		{
			base.ViewWillTransitionToSize (toSize, coordinator);
			// Note that the app delegate controls the device orientation notifications required to use the device orientation.
			UIDeviceOrientation deviceOrientation = UIDevice.CurrentDevice.Orientation;
			if (deviceOrientation.IsPortrait () || deviceOrientation.IsLandscape ()) {
				var previewLayer = (AVCaptureVideoPreviewLayer)PreviewView.Layer;
				previewLayer.Connection.VideoOrientation = (AVCaptureVideoOrientation)(long)deviceOrientation;
			}
		}
        public override void ViewWillTransitionToSize(SizeF toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            //TODO Item 1
            //ForcedTraitCollection = toSize.Width > 320.0f ? UITraitCollection.FromHorizontalSizeClass(UIUserInterfaceSizeClass.Regular)
            //	: new UITraitCollection();

            base.ViewWillTransitionToSize(toSize, coordinator);
        }
		public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
			CGSize oldSize = View.Bounds.Size;

            if (oldSize != toSize)
            {
                UIInterfaceOrientation prevOrientation = InterfaceOrientation;

                // In iOS 8+ DidRotate is no longer called after a rotation
                // But we need to notify iOSGamePlatform to update back buffer so we explicitly call it 

                // We do this within the animateAlongside action, which at the point of calling
                // will have the new InterfaceOrientation set
                coordinator.AnimateAlongsideTransition((context) =>
                    {
                        DidRotate(prevOrientation);
                    }, (context) => 
                    {
                    });

            }

            base.ViewWillTransitionToSize(toSize, coordinator);
        }
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.ViewWillTransitionToSize (toSize, coordinator);
     if (ViewWillTransitionToSizeEvent != null)
         ViewWillTransitionToSizeEvent (toSize, coordinator);
 }
		public override void ViewWillTransitionToSize (CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
		{
			base.ViewWillTransitionToSize (toSize, coordinator);

			var videoPreviewLayerConnection = PreviewView.VideoPreviewLayer.Connection;
			if (videoPreviewLayerConnection != null) {
				var deviceOrientation = UIDevice.CurrentDevice.Orientation;
				if (!deviceOrientation.IsPortrait () && !deviceOrientation.IsLandscape ())
					return;

				var newVideoOrientation = VideoOrientationFor (deviceOrientation);
				var oldSize = View.Frame.Size;
				var oldVideoOrientation = videoPreviewLayerConnection.VideoOrientation;
				videoPreviewLayerConnection.VideoOrientation = newVideoOrientation;

				// When we transition to the new size, we need to adjust the region
				// of interest's origin and size so that it stays anchored relative
				// to the camera.
				coordinator.AnimateAlongsideTransition (context => {
					var oldRegion = PreviewView.RegionOfInterest;
					var newRegion = new CGRect ();

					if (oldVideoOrientation == LandscapeRight && newVideoOrientation == LandscapeLeft) {
						newRegion = oldRegion.WithX (oldSize.Width - oldRegion.X - oldRegion.Width);
					} else if (oldVideoOrientation == LandscapeRight && newVideoOrientation == Portrait) {
						newRegion.X = toSize.Width - oldRegion.Y - oldRegion.Height;
						newRegion.Y = oldRegion.X;
						newRegion.Width = oldRegion.Height;
						newRegion.Height = oldRegion.Width;
					} else if (oldVideoOrientation == LandscapeLeft && newVideoOrientation == LandscapeRight) {
						newRegion = oldRegion.WithX (oldSize.Width - oldRegion.X - oldRegion.Width);
					} else if (oldVideoOrientation == LandscapeLeft && newVideoOrientation == Portrait) {
						newRegion.X = oldRegion.Y;
						newRegion.Y = oldSize.Width - oldRegion.X - oldRegion.Width;
						newRegion.Width = oldRegion.Height;
						newRegion.Height = oldRegion.Width;
					} else if (oldVideoOrientation == Portrait && newVideoOrientation == LandscapeRight) {
						newRegion.X = oldRegion.Y;
						newRegion.Y = toSize.Height - oldRegion.X - oldRegion.Width;
						newRegion.Width = oldRegion.Height;
						newRegion.Height = oldRegion.Width;
					} else if (oldVideoOrientation == Portrait && newVideoOrientation == LandscapeLeft) {
						newRegion.X = oldSize.Height - oldRegion.Y - oldRegion.Height;
						newRegion.Y = oldRegion.X;
						newRegion.Width = oldRegion.Height;
						newRegion.Height = oldRegion.Width;
					}

					PreviewView.SetRegionOfInterestWithProposedRegionOfInterest (newRegion);
				}, context => {
					sessionQueue.DispatchAsync (() => {
						metadataOutput.RectOfInterest = PreviewView.VideoPreviewLayer.MapToLayerCoordinates (PreviewView.RegionOfInterest);
					});
					// Remove the old metadata object overlays.
					RemoveMetadataObjectOverlayLayers ();
				});
			}
		}
		public override void ViewWillTransitionToSize (CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
		{
			base.ViewWillTransitionToSize (toSize, coordinator);

			var videoPreviewLayerConnection = PreviewView.VideoPreviewLayer.Connection;
			if (videoPreviewLayerConnection != null) {
				var deviceOrientation = UIDevice.CurrentDevice.Orientation;

				AVCaptureVideoOrientation newVideoOrientation;
				if (!TryConvertToVideoOrientation (deviceOrientation, out newVideoOrientation))
					return;
				if (!deviceOrientation.IsPortrait () && !deviceOrientation.IsLandscape ())
					return;

				videoPreviewLayerConnection.VideoOrientation = newVideoOrientation;
			}
		}
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.ViewWillTransitionToSize(toSize, coordinator);
     _pdfView.Subviews[0].SetNeedsDisplay();
     _pdfView.Subviews[0].SetNeedsLayout();
 }
Example #24
0
 public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
 {
     base.ViewWillTransitionToSize(toSize, coordinator);
     SetupNavBar(new CGSize(NavigationController?.NavigationBar?.Bounds.Size.Width ?? 0.0f, NavigationController?.NavigationBar?.Bounds.Height ?? 0.0f));
 }
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            var videoPreviewLayerConnection = PreviewView.VideoPreviewLayer.Connection;

            if (videoPreviewLayerConnection != null)
            {
                var deviceOrientation = UIDevice.CurrentDevice.Orientation;
                if (!deviceOrientation.IsPortrait() && !deviceOrientation.IsLandscape())
                {
                    return;
                }

                var newVideoOrientation = VideoOrientationFor(deviceOrientation);
                var oldSize             = View.Frame.Size;
                var oldVideoOrientation = videoPreviewLayerConnection.VideoOrientation;
                videoPreviewLayerConnection.VideoOrientation = newVideoOrientation;

                // When we transition to the new size, we need to adjust the region
                // of interest's origin and size so that it stays anchored relative
                // to the camera.
                coordinator.AnimateAlongsideTransition(context => {
                    var oldRegion = PreviewView.RegionOfInterest;
                    var newRegion = new CGRect();

                    if (oldVideoOrientation == LandscapeRight && newVideoOrientation == LandscapeLeft)
                    {
                        newRegion = oldRegion.WithX(oldSize.Width - oldRegion.X - oldRegion.Width);
                    }
                    else if (oldVideoOrientation == LandscapeRight && newVideoOrientation == Portrait)
                    {
                        newRegion.X      = toSize.Width - oldRegion.Y - oldRegion.Height;
                        newRegion.Y      = oldRegion.X;
                        newRegion.Width  = oldRegion.Height;
                        newRegion.Height = oldRegion.Width;
                    }
                    else if (oldVideoOrientation == LandscapeLeft && newVideoOrientation == LandscapeRight)
                    {
                        newRegion = oldRegion.WithX(oldSize.Width - oldRegion.X - oldRegion.Width);
                    }
                    else if (oldVideoOrientation == LandscapeLeft && newVideoOrientation == Portrait)
                    {
                        newRegion.X      = oldRegion.Y;
                        newRegion.Y      = oldSize.Width - oldRegion.X - oldRegion.Width;
                        newRegion.Width  = oldRegion.Height;
                        newRegion.Height = oldRegion.Width;
                    }
                    else if (oldVideoOrientation == Portrait && newVideoOrientation == LandscapeRight)
                    {
                        newRegion.X      = oldRegion.Y;
                        newRegion.Y      = toSize.Height - oldRegion.X - oldRegion.Width;
                        newRegion.Width  = oldRegion.Height;
                        newRegion.Height = oldRegion.Width;
                    }
                    else if (oldVideoOrientation == Portrait && newVideoOrientation == LandscapeLeft)
                    {
                        newRegion.X      = oldSize.Height - oldRegion.Y - oldRegion.Height;
                        newRegion.Y      = oldRegion.X;
                        newRegion.Width  = oldRegion.Height;
                        newRegion.Height = oldRegion.Width;
                    }

                    PreviewView.SetRegionOfInterestWithProposedRegionOfInterest(newRegion);
                }, context => {
                    sessionQueue.DispatchAsync(() => {
                        metadataOutput.RectOfInterest = PreviewView.VideoPreviewLayer.MapToLayerCoordinates(PreviewView.RegionOfInterest);
                    });
                    // Remove the old metadata object overlays.
                    RemoveMetadataObjectOverlayLayers();
                });
            }
        }
 public override void WillTransitionToTraitCollection(UITraitCollection traitCollection, IUIViewControllerTransitionCoordinator coordinator)
 {
     if (traitCollection != null)
     {
         base.WillTransitionToTraitCollection(traitCollection, coordinator);
         if (View.TraitCollection.HorizontalSizeClass != traitCollection.HorizontalSizeClass ||
             View.TraitCollection.VerticalSizeClass != traitCollection.VerticalSizeClass)
         {
             if (mapView.AutoRotateEnabled)
             {
                 mapView.SetAutoRotateEnabled(false, false);
             }
         }
     }
 }
Example #27
0
        /// <summary>
        /// Will show the navigation bar upon rotation or changes in the trait sizes.
        /// </summary>
        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            base.ViewWillTransitionToSize(toSize, coordinator);

            ShowNavbar();
        }