Пример #1
0
        public void ShowCollapsedPanel(uint length = DEFAULT_SLIDE_ANIMATION_SPEED)
        {
            WhenSlidingPanelStateChanging?.Invoke(null, new StateChangingEventArgs()
            {
                OldState = _currentSlidePanelState, NewState = SlidingPanelState.Collapsed
            });

            ShowNavigationBar(true);

            if (_hideTitleView)
            {
                _titleRelativeLayout.HeightRequest = _currentTitleHeight;
            }

            // set CollapsedPanelHeight
            Rectangle drawerCollapsedPosition  = _slidingPanelAbsoluteLayout.Bounds;
            double    drawerCollapsedPositionY = drawerCollapsedPosition.Y;

            drawerCollapsedPositionY  = _slidingPanelAbsoluteLayout.Height;
            drawerCollapsedPositionY -= _currentTitleHeight;

            // iOS only: No need the below code after XF 2.4.0.xxx
            if (_hideNavBarFeature == true && _showingNavBar == true && Device.RuntimePlatform != Device.iOS)
            {
                drawerCollapsedPositionY -= NavigationBarHeight;
                _showingNavBar            = false;

                if (PanelRatio >= MAX_PANEL_RATIO)
                {
                    drawerCollapsedPositionY -= StatusBarHeight;
                }
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                length = (length == DEFAULT_SLIDE_ANIMATION_SPEED) ? (uint)_slideAnimationSpeed : length;
                _slidingPanelAbsoluteLayout.TranslateTo(0, drawerCollapsedPositionY, length, Easing.CubicOut);
            });
            _currentSlidePanelState = SlidingPanelState.Collapsed;

            if (_pictureImage != null)
            {
                Rectangle pictureBounds = _pictureAbsoluteLayout.Bounds;
                pictureBounds.Y  = drawerCollapsedPositionY + _pictureAbsoluteLayout.Height;
                pictureBounds.Y += _currentTitleHeight;
                Device.BeginInvokeOnMainThread(() =>
                {
                    length = (length == DEFAULT_SLIDE_ANIMATION_SPEED) ? (uint)_slideAnimationSpeed : length;
                    _pictureAbsoluteLayout.TranslateTo(pictureBounds.X, pictureBounds.Y, length, Easing.CubicOut);
                });
            }

            WhenSlidingPanelStateChanged?.Invoke(null, new StateChangedEventArgs()
            {
                State = _currentSlidePanelState
            });
        }
Пример #2
0
        public void ShowExpandedPanel(uint length = DEFAULT_SLIDE_ANIMATION_SPEED)
        {
            if (_isExpandable == true)
            {
                WhenSlidingPanelStateChanging?.Invoke(null, new StateChangingEventArgs()
                {
                    OldState = _currentSlidePanelState, NewState = SlidingPanelState.Expanded
                });

                ApplyPanelRatio(_panelRatio);

                ShowNavigationBar(false);

                // iOS only: No need the below code after XF 2.4.0.xxx
                if (Device.RuntimePlatform != Device.iOS)
                {
                    _showingNavBar = true;
                }

                if (_hideTitleView)
                {
                    _titleRelativeLayout.HeightRequest = _primaryFloatingActionButtonHeight / 2;
                }

                Rectangle drawerExpandedPosition = _slidingPanelAbsoluteLayout.Bounds;
                drawerExpandedPosition.Y = 0;

                // handling hide primary fab button
                _slidingPanelAbsoluteLayout.Padding = new Thickness(0, 0, 0, _primaryFloatingActionButtonHeight / 2 * -1);
                drawerExpandedPosition.Y           -= (_primaryFloatingActionButtonHeight / 2);

                Device.BeginInvokeOnMainThread(() =>
                {
                    length = (length == DEFAULT_SLIDE_ANIMATION_SPEED) ? (uint)_slideAnimationSpeed : length;
                    _slidingPanelAbsoluteLayout.TranslateTo(drawerExpandedPosition.X, drawerExpandedPosition.Y, length, Easing.CubicOut);
                });
                _currentSlidePanelState = SlidingPanelState.Expanded;

                if (_pictureImage != null)
                {
                    Rectangle pictureExpandedPosition = _pictureAbsoluteLayout.Bounds;
                    pictureExpandedPosition.Y = 0;
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        length = (length == DEFAULT_SLIDE_ANIMATION_SPEED) ? (uint)_slideAnimationSpeed : length;
                        _pictureAbsoluteLayout.TranslateTo(pictureExpandedPosition.X, pictureExpandedPosition.Y, length, Easing.CubicOut);
                    });
                }

                WhenSlidingPanelStateChanged?.Invoke(null, new Interface.StateChangedEventArgs()
                {
                    State = _currentSlidePanelState
                });
            }
        }
Пример #3
0
        public void ShowCollapsedPanel(uint length = DEFAULT_SLIDE_ANIMATION_SPEED)
        {
            WhenSlidingPanelStateChanging?.Invoke(null, new StateChangingEventArgs()
            {
                OldState = _currentSlidePanelState, NewState = SlidingPanelState.Collapsed
            });

            ShowNavigationBar(true);

            if (_hideTitleView)
            {
                _titleRelativeLayout.HeightRequest = _currentTitleHeight;
            }

            Rectangle drawerCollapsedPosition = _slidingPanelAbsoluteLayout.Bounds;

            drawerCollapsedPosition.Y  = _slidingPanelAbsoluteLayout.Height + (this._primaryFloatingActionButtonHeight / 2);
            drawerCollapsedPosition.Y -= _currentTitleHeight;
            if (_hideNavBarFeature == true && _showingNavBar == true)
            {
                drawerCollapsedPosition.Y -= NavigationBarHeight;
                _showingNavBar             = false;

                if (PanelRatio >= MAX_PANEL_RATIO)
                {
                    drawerCollapsedPosition.Y -= StatusBarHeight;
                }
            }
            Device.BeginInvokeOnMainThread(() =>
            {
                length = (length == DEFAULT_SLIDE_ANIMATION_SPEED) ? (uint)_slideAnimationSpeed : length;
                _slidingPanelAbsoluteLayout.TranslateTo(drawerCollapsedPosition.X, drawerCollapsedPosition.Y, length, Easing.CubicOut);
            });
            _currentSlidePanelState = SlidingPanelState.Collapsed;

            if (_pictureImage != null)
            {
                Rectangle pictureBounds = _pictureAbsoluteLayout.Bounds;
                pictureBounds.Y  = drawerCollapsedPosition.Y + _pictureAbsoluteLayout.Height;
                pictureBounds.Y += _currentTitleHeight;
                Device.BeginInvokeOnMainThread(() =>
                {
                    length = (length == DEFAULT_SLIDE_ANIMATION_SPEED) ? (uint)_slideAnimationSpeed : length;
                    _pictureAbsoluteLayout.TranslateTo(pictureBounds.X, pictureBounds.Y, length, Easing.CubicOut);
                });
            }

            WhenSlidingPanelStateChanged?.Invoke(null, new StateChangedEventArgs()
            {
                State = _currentSlidePanelState
            });
        }
Пример #4
0
        public void ShowExpandedPanel(uint length = DEFAULT_SLIDE_ANIMATION_SPEED)
        {
            if (_isExpandable == true)
            {
                WhenSlidingPanelStateChanging?.Invoke(null, new StateChangingEventArgs()
                {
                    OldState = _currentSlidePanelState, NewState = SlidingPanelState.Expanded
                });

                ApplyPanelRatio(_panelRatio);

                ShowNavigationBar(false);
                _showingNavBar = true;

                if (_hideTitleView)
                {
                    _titleRelativeLayout.HeightRequest = 0;
                }

                Rectangle drawerExpandedPosition = _slidingPanelAbsoluteLayout.Bounds;
                drawerExpandedPosition.Y = 0;

                Device.BeginInvokeOnMainThread(() =>
                {
                    length = (length == DEFAULT_SLIDE_ANIMATION_SPEED) ? (uint)_slideAnimationSpeed : length;
                    _slidingPanelAbsoluteLayout.TranslateTo(drawerExpandedPosition.X, drawerExpandedPosition.Y, length, Easing.CubicOut);
                });
                _currentSlidePanelState = SlidingPanelState.Expanded;

                if (_pictureImage != null)
                {
                    Rectangle pictureExpandedPosition = _pictureAbsoluteLayout.Bounds;
                    pictureExpandedPosition.Y = 0;
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        length = (length == DEFAULT_SLIDE_ANIMATION_SPEED) ? (uint)_slideAnimationSpeed : length;
                        _pictureAbsoluteLayout.TranslateTo(pictureExpandedPosition.X, pictureExpandedPosition.Y, length, Easing.CubicOut);
                    });
                }

                WhenSlidingPanelStateChanged?.Invoke(null, new Interface.StateChangedEventArgs()
                {
                    State = _currentSlidePanelState
                });
            }
        }
Пример #5
0
        public void HidePanel(uint length = DEFAULT_SLIDE_ANIMATION_SPEED)
        {
            WhenSlidingPanelStateChanging?.Invoke(null, new StateChangingEventArgs()
            {
                OldState = _currentSlidePanelState, NewState = SlidingPanelState.Hidden
            });

            // set HidePanelHeight
            Rectangle drawerCollapsedPosition  = _slidingPanelAbsoluteLayout.Bounds;
            double    drawerCollapsedPositionY = drawerCollapsedPosition.Y;

            drawerCollapsedPositionY = _slidingPanelAbsoluteLayout.Height + (this._primaryFloatingActionButtonHeight / 2);

            // iOS only: No need the below code after XF 2.4.0.xxx
            if (_hideNavBarFeature == true && _showingNavBar == true && Device.RuntimePlatform != Device.iOS)
            {
                drawerCollapsedPositionY -= NavigationBarHeight;
                _showingNavBar            = false;
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                length = (length == DEFAULT_SLIDE_ANIMATION_SPEED) ? (uint)_slideAnimationSpeed : length;
                _slidingPanelAbsoluteLayout.TranslateTo(0, drawerCollapsedPositionY, length, Easing.CubicOut);
            });
            _currentSlidePanelState = SlidingPanelState.Hidden;

            Rectangle pictureBounds = _pictureAbsoluteLayout.Bounds;

            pictureBounds.Y = drawerCollapsedPositionY + _pictureAbsoluteLayout.Height;
            Device.BeginInvokeOnMainThread(() =>
            {
                length = (length == DEFAULT_SLIDE_ANIMATION_SPEED) ? (uint)_slideAnimationSpeed : length;
                _pictureAbsoluteLayout.TranslateTo(pictureBounds.X, pictureBounds.Y, length, Easing.CubicOut);
            });

            WhenSlidingPanelStateChanged?.Invoke(null, new StateChangedEventArgs()
            {
                State = _currentSlidePanelState
            });
        }