Ejemplo n.º 1
0
        CGFloat heightForOrientation(UIInterfaceOrientation orientation, bool withTopBanner)
        {
            var isPad = (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad);

            //TODO: hardcoded stuff;
            var actualScreenWidth        = (UIScreen.MainScreen.NativeBounds.Size.Width / UIScreen.MainScreen.NativeScale);
            var canonicalPortraitHeight  = (isPad ? (CGFloat)(264) : (CGFloat)(orientation.IsPortrait() && actualScreenWidth >= 400 ? 226 : 216));
            var canonicalLandscapeHeight = (isPad ? (CGFloat)(352) : (CGFloat)(162));
            var topBannerHeight          = (withTopBanner ? Metrics.metric("topBanner") : 0);

            return((CGFloat)(orientation.IsPortrait() ? canonicalPortraitHeight + topBannerHeight : canonicalLandscapeHeight + topBannerHeight));
        }
Ejemplo n.º 2
0
 private void SwitchOrientation(UIInterfaceOrientation orientation, bool animated, double duration = 0.5)
 {
     if (orientation.IsLandscape() && false == _wasLandscape)
     {
         _animator.Rotate(orientation, animated, duration);
         _wasLandscape = true;
     }
     else if (orientation.IsPortrait() && _wasLandscape)
     {
         _animator.Rotate(orientation, animated, duration);
         _wasLandscape = false;
     }
 }
Ejemplo n.º 3
0
        private void UpdateLayout(UIInterfaceOrientation toInterfaceOrientation)
        {
            if (_constraints != null)
            {
                this.View.RemoveConstraints(_constraints);
            }

            if (toInterfaceOrientation.IsPortrait())
            {
                var formats = new[]
                {
                    "H:|-[titleLabel]-|",
                    "H:|-[inputTextFiled]-|",
                    "H:[indicatorView]-|",
                    "H:|-[sourceLabel]-|",
                    "H:|-[resultTableView]-|",
                    "H:|-[synonymsTableView]-|",
                    "H:[useGoogleLabel]-[useGoogleSwitch]-|",
                    "V:|-(25)-[titleLabel]-[inputTextFiled(40)]-[sourceLabel]-[resultTableView]-[synonymsTableView(==resultTableView)]-(15)-[useGoogleSwitch]-(25)-|"
                };


                _constraints = LayoutConstraints.AddConstraints(View, formats, _constraintDictionary).Union(new[]
                {
                    LayoutConstraints.AddEqualityConstraint(View, _useGoogleSwitch, _useGoogleLabel, NSLayoutAttribute.CenterY),
                    LayoutConstraints.AddEqualityConstraint(View, _indicatorView, _inputTextFiled, NSLayoutAttribute.CenterY)
                }).ToArray();
            }
            else
            {
                var formats = new[]
                {
                    "H:|-[titleLabel]-(25)-[sourceLabel(==titleLabel)]-|",
                    "H:|-[inputTextFiled]-(25)-[synonymsTableView(==sourceLabel)]-|",
                    "H:[indicatorView]-(27)-[synonymsTableView(==sourceLabel)]-|",
                    "H:[useGoogleLabel]-[useGoogleSwitch]-(25)-[synonymsTableView]-|",
                    "H:|-[resultTableView(==titleLabel)]",
                    "V:|-(25)-[titleLabel]-[inputTextFiled(40)]-[resultTableView]-(15)-[useGoogleSwitch]-(25)-|",
                    "V:|-(25)-[sourceLabel]-[synonymsTableView]-(25)-|"
                };

                _constraints = LayoutConstraints.AddConstraints(View, formats, _constraintDictionary).Union(new[]
                {
                    LayoutConstraints.AddEqualityConstraint(View, _useGoogleSwitch, _useGoogleLabel, NSLayoutAttribute.CenterY),
                    LayoutConstraints.AddEqualityConstraint(View, _indicatorView, _inputTextFiled, NSLayoutAttribute.CenterY)
                }).ToArray();
            }
        }
Ejemplo n.º 4
0
            private void RotateSignInMode(UIInterfaceOrientation orientation)
            {
                // If we're in portrait orientation, all
                // controls are visible on the UI and no
                // nudging is necessary.
                if (orientation.IsPortrait())
                {
                    _isNudged = false;
                }

                // We'll move the logo but not animate it,
                // as we're taking care of the animation
                // ourselves.
                TranslateLogo(orientation, false);
                TranslateSignInForm(orientation);
            }
Ejemplo n.º 5
0
        /// <summary>
        /// We override this to show/hide some controls during rotation
        /// </summary>c
        public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
        {
            bool wasPortrait     = InterfaceOrientation.IsPortrait();
            bool willBePortrait  = toInterfaceOrientation.IsPortrait();
            bool wasLandscape    = InterfaceOrientation.IsLandscape();
            bool willBeLandscape = toInterfaceOrientation.IsLandscape();

            if (wasPortrait && willBeLandscape)
            {
                SetContactVisible(true, duration);
            }
            else if (wasLandscape && willBePortrait)
            {
                SetContactVisible(false, duration);
            }

            base.WillRotate(toInterfaceOrientation, duration);
        }
Ejemplo n.º 6
0
            private void RotateSplashMode(UIInterfaceOrientation orientation)
            {
                var isPortrait = orientation.IsPortrait();

                var image = isPortrait
                    ? Theme.SplashPortrait()
                    : Theme.SplashLandscape();

                var splash = _controller.splash;

                // Some magic numbers to hold the background
                // in place and provide a smooth transition
                // from the launch image. TODO: test @retina,
                // also seems to cause glitches on iOS7.
                splash.Frame = new RectangleF(splash.Frame.Left, 0, splash.Frame.Width * (1024f / 1004), 1024);
                splash.Image = image;


                // Align the logo (hidden behind the splash)
                // to the logo that is part of the splash,
                // thus creating a smooth transition when
                // the splash disappears.
                TranslateAndExpandLogo();
            }
		/// <summary>
		/// We override this to show/hide some controls during rotation
		/// </summary>c
		public override void WillRotate (UIInterfaceOrientation toInterfaceOrientation, double duration)
		{
			bool wasPortrait = InterfaceOrientation.IsPortrait ();
			bool willBePortrait = toInterfaceOrientation.IsPortrait ();
			bool wasLandscape = InterfaceOrientation.IsLandscape ();
			bool willBeLandscape = toInterfaceOrientation.IsLandscape ();
			
			if (wasPortrait && willBeLandscape) {
				SetContactVisible (true, duration);
			} else if (wasLandscape && willBePortrait) {
				SetContactVisible (false, duration);
			}
			
			base.WillRotate (toInterfaceOrientation, duration);
		}