Exemplo n.º 1
0
        void Update()
        {
            var isSpanned = screenHelper.IsDualMode;

            var hb  = screenHelper.GetHingeBounds();
            var hbd = screenHelper.GetHingeBoundsDip();

            var hingeText = $"Hinge:    x:{hb.Left}, y:{hb.Top}, w:{hb.Width()}, h:{hb.Height()}";

            hingeText += $"\r\nHinge DP: x:{hbd.Left}, y:{hbd.Top}, w:{hbd.Width()}, h:{hbd.Height()}";

            FindViewById <TextView>(Resource.Id.textViewDuo).Text   = $"Duo: {isDuo}";
            FindViewById <TextView>(Resource.Id.textViewSpan).Text  = $"Spanned: {isSpanned}";
            FindViewById <TextView>(Resource.Id.textViewHinge).Text = hingeText;
        }
            public Rectangle GetHinge()
            {
                if (!IsDuo)
                {
                    return(Rectangle.Zero);
                }

                var hinge = _helper.GetHingeBoundsDip();

                if (hinge == null)
                {
                    return(Rectangle.Zero);
                }

                var hingeDp = new Rectangle((hinge.Left), (hinge.Top), (hinge.Width()), (hinge.Height()));

                return(hingeDp);
            }
Exemplo n.º 3
0
            void Update()
            {
                _isSpanned = IsDuo && (_helper?.IsDualMode ?? false);

                // Hinge
                if (!IsDuo)
                {
                    _hingeDp = Rectangle.Zero;
                }
                else
                {
                    var hinge = _helper.GetHingeBoundsDip();

                    if (hinge == null || !IsSpanned)
                    {
                        _hingeDp = Rectangle.Zero;
                    }
                    else
                    {
                        _hingeDp = new Rectangle((hinge.Left), (hinge.Top), (hinge.Width()), (hinge.Height()));
                    }
                }

                // Is Landscape
                if (!IsDuo)
                {
                    if (_mainActivity == null)
                    {
                        _isLandscape = false;
                    }
                    else
                    {
                        var orientation = _mainActivity.Resources.Configuration.Orientation;
                        _isLandscape = (orientation == global::Android.Content.Res.Orientation.Landscape);
                    }
                }
                else
                {
                    var rotation = ScreenHelper.GetRotation(_helper.Activity);
                    _isLandscape = (rotation == SurfaceOrientation.Rotation270 || rotation == SurfaceOrientation.Rotation90);
                }
            }