public void PanGestureRecognizer_PanUpdated(System.Object sender, Xamarin.Forms.PanUpdatedEventArgs e)
        {
            // Handle the pan
            switch (e.StatusType)
            {
            case GestureStatus.Running:
                // Translate and ensure we don't y + e.TotalY pan beyond the wrapped user interface element bounds.
                var translateY = Math.Max(Math.Min(0, y + e.TotalY), -Math.Abs((Height * .25) - Height));
                BottomSheet.TranslateTo(BottomSheet.X, translateY, 20);
                break;

            case GestureStatus.Completed:
                // Store the translation applied during the pan
                y = BottomSheet.TranslationY;

                // At the end of the event - snap to the closest location
                var finalTranslation = Math.Max(Math.Min(0, -1000), -Math.Abs(GetClosestLockState(e.TotalY + y)));

                // Depending on Swipe Up or Down - change the snapping animation
                if (IsSwipeUp(e))
                {
                    BottomSheet.TranslateTo(BottomSheet.X, finalTranslation, 250, Easing.SpringIn);
                }
                else
                {
                    BottomSheet.TranslateTo(BottomSheet.X, finalTranslation, 250, Easing.SpringOut);
                }

                // Dismiss the keyboard after a transition
                y = BottomSheet.TranslationY;

                break;
            }
        }
Beispiel #2
0
        private BottomSheet SheetShareItem()
        {
            BottomSheet sheet = GetShareActions("Hello " + this.name)
                                .Title("Share To " + this.name)
                                .Build();

            return(sheet);
        }
Beispiel #3
0
        private BottomSheet SheetShareItemShowAll()
        {
            BottomSheet sheet = GetShareActions("Hello " + this.name)
                                .Title("Share To " + this.name)
                                //Set initial number of actions which will be shown in current sheet.
                                //* If more actions need to be shown, a "more" action will be displayed in the last position.
                                .Limit(Resource.Integer.no_limit)
                                .Build();

            return(sheet);
        }
Beispiel #4
0
        private async void GamePage_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(GameViewModel.Progress))
            {
                AdjustTemp(((GameViewModel)BindingContext).Progress);
            }
            else if (e.PropertyName == nameof(GameViewModel.VictoryMode))
            {
                bool state = ((GameViewModel)BindingContext).VictoryMode;
                Shell.Current.FlyoutBehavior = state ? FlyoutBehavior.Disabled : FlyoutBehavior.Flyout;
                if (state)
                {
                    OldImage.Opacity = 1;
                    HamburgerButton.FadeTo(0, 800u, Easing.CubicOut);
                    await BottomSheet.TranslateTo(0, Height, 800u, Easing.CubicOut);

                    Darkener.FadeTo(0.4);
                    VictoryView.FadeTo(1);
                }
                else
                {
                    Darkener.FadeTo(0);
                    await VictoryView.FadeTo(0);

                    await OldImage.FadeTo(0, easing : Easing.CubicIn);

                    await Task.Delay(250);

                    HamburgerButton.FadeTo(0.85);
                    await BottomSheet.TranslateTo(0, positions[1], 350u, Easing.CubicOut);
                }
            }
            else if (e.PropertyName == nameof(GameViewModel.IsDone))
            {
                if (((GameViewModel)BindingContext).IsDone)
                {
                    TempFinisher.FadeTo(1);
                }
                else
                {
                    TempFinisher.FadeTo(0);
                }
            }
        }
Beispiel #5
0
        private void SnapToNearest(double vel)
        {
            int indexRight = 1;

            while (indexRight < positions.Length && BottomSheet.TranslationY > positions[indexRight])
            {
                ++indexRight;
            }
            int indexLeft = indexRight - 1;

            double newTrans;

            if (Math.Abs(vel) < 3)
            {
                newTrans = (positions[indexRight] - BottomSheet.TranslationY <= BottomSheet.TranslationY - positions[indexLeft]) ?
                           positions[indexRight] : positions[indexLeft];
            }
            else
            {
                newTrans = vel < 0 ? positions[indexLeft] : positions[indexRight];
            }

            BottomSheet.TranslateTo(0, newTrans, 350u, Easing.CubicOut);
        }
Beispiel #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            root_view = FindViewById <View>(Resource.Id.root_view);
            show_with_single_line_items_button = FindViewById <Button>(Resource.Id.show_with_single_line_items_button);
            show_with_double_line_items_button = FindViewById <Button>(Resource.Id.show_with_double_line_items_button);
            show_bottom_sheet_dialog_button    = FindViewById <Button>(Resource.Id.show_bottom_sheet_dialog_button);

            show_with_single_line_items_button.Click += delegate
            {
                var bottomSheet = BottomSheet.NewInstance(
                    new List <BottomSheetItem> {
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_flag,
                        Resource.Drawable.ic_flag,
                        Resources.GetString(Resource.String.bottom_sheet_item_flag_title)
                        ),
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_reply,
                        Resource.Drawable.ic_reply,
                        Resources.GetString(Resource.String.bottom_sheet_item_reply_title)
                        ),
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_forward,
                        Resource.Drawable.ic_forward,
                        Resources.GetString(Resource.String.bottom_sheet_item_forward_title)
                        ),
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_delete,
                        Resource.Drawable.ic_trash_can,
                        Resources.GetString(Resource.String.bottom_sheet_item_delete_title)
                        )
                });
                bottomSheet.Show(SupportFragmentManager, null);
            };

            show_with_double_line_items_button.Click += delegate {
                var bottomSheet = BottomSheet.NewInstance(
                    new List <BottomSheetItem> {
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_camera,
                        Resource.Drawable.ic_camera,
                        Resources.GetString(Resource.String.bottom_sheet_item_camera_title),
                        Resources.GetString(Resource.String.bottom_sheet_item_camera_subtitle)
                        ),
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_gallery,
                        Resource.Drawable.ic_gallery,
                        Resources.GetString(Resource.String.bottom_sheet_item_gallery_title),
                        Resources.GetString(Resource.String.bottom_sheet_item_gallery_subtitle)
                        ),
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_videos,
                        Resource.Drawable.ic_videos,
                        Resources.GetString(Resource.String.bottom_sheet_item_videos_title),
                        Resources.GetString(Resource.String.bottom_sheet_item_videos_subtitle)
                        ),
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_manage,
                        Resource.Drawable.ic_wrench,
                        Resources.GetString(Resource.String.bottom_sheet_item_manage_title),
                        Resources.GetString(Resource.String.bottom_sheet_item_manage_subtitle)
                        )
                });
                bottomSheet.Show(SupportFragmentManager, null);
            };

            show_bottom_sheet_dialog_button.Click += delegate {
                var bottomSheetDialog = new BottomSheetDialog(
                    this,
                    new List <BottomSheetItem> {
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_clock,
                        Resource.Drawable.ic_clock,
                        Resources.GetString(Resource.String.bottom_sheet_item_clock_title)
                        ),
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_alarm,
                        Resource.Drawable.ic_alarm,
                        Resources.GetString(Resource.String.bottom_sheet_item_alarm_title)
                        ),
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_stop_watch,
                        Resource.Drawable.ic_stop_watch,
                        Resources.GetString(Resource.String.bottom_sheet_item_stop_watch_title)
                        ),
                    new BottomSheetItem(
                        Resource.Id.bottom_sheet_item_time_zone,
                        Resource.Drawable.ic_time_zone,
                        Resources.GetString(Resource.String.bottom_sheet_item_time_zone_title)
                        )
                });
                bottomSheetDialog.OnItemClickListener = this;
                bottomSheetDialog.Show();
            };
        }
Beispiel #7
0
 public override AnimationController createAnimationController()
 {
     D.assert(_animationController == null);
     _animationController = BottomSheet.createAnimationController(navigator.overlay);
     return(_animationController);
 }