diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-11-03 23:40:17 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-11-03 23:40:17 +0300 |
commit | 85bc8eaa321d16638a732123104c0d221e80f5c7 (patch) | |
tree | ada227136601e2dbc1192cd7bb4cbe4dfe9b986f /app/src/main/java | |
parent | 00cbdf9aab170ff6524d61a29383079388daaec6 (diff) |
Add backdrop to close picker
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentsFragment.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentsFragment.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentsFragment.java index e21d2a6c0..ec97daa90 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentsFragment.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentsFragment.java @@ -164,6 +164,7 @@ public class CardAttachmentsFragment extends BrandedFragment implements Attachme mBottomSheetBehaviour.setHideable(true); mBottomSheetBehaviour.setState(STATE_HIDDEN); mBottomSheetBehaviour.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { +// private float lastOffset = -1; @Override public void onStateChanged(@NonNull View bottomSheet, int newState) { switch (newState) { @@ -195,9 +196,13 @@ public class CardAttachmentsFragment extends BrandedFragment implements Attachme @Override public void onSlide(@NonNull View bottomSheet, float slideOffset) { - +// if(slideOffset < 0 && slideOffset < lastOffset) { +// Toast.makeText(requireContext(), "Now?", Toast.LENGTH_SHORT).show(); +// } +// lastOffset = slideOffset; } }); + binding.pickerBackdrop.setOnClickListener(v -> mBottomSheetBehaviour.setState(STATE_HIDDEN)); final DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); int spanCount = (int) ((displayMetrics.widthPixels / displayMetrics.density) / getResources().getInteger(R.integer.max_dp_attachment_column)); @@ -450,11 +455,15 @@ public class CardAttachmentsFragment extends BrandedFragment implements Attachme private void hidePicker() { ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.mdtp_transparent_black), getResources().getColor(android.R.color.transparent)); colorAnimation.setDuration(250); - colorAnimation.addUpdateListener(animator -> binding.pickerControls.setBackgroundColor((int) animator.getAnimatedValue())); + colorAnimation.addUpdateListener(animator -> { + binding.pickerBackdrop.setBackgroundColor((int) animator.getAnimatedValue()); + binding.pickerControls.setBackgroundColor((int) animator.getAnimatedValue()); + }); colorAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); + binding.pickerBackdrop.setVisibility(GONE); binding.pickerControlsWrapper.setVisibility(GONE); } }); @@ -467,10 +476,14 @@ public class CardAttachmentsFragment extends BrandedFragment implements Attachme } private void showPicker() { + binding.pickerBackdrop.setVisibility(VISIBLE); binding.pickerControlsWrapper.setVisibility(VISIBLE); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(android.R.color.transparent), getResources().getColor(R.color.mdtp_transparent_black)); - colorAnimation.setDuration(250); // milliseconds - colorAnimation.addUpdateListener(animator -> binding.pickerControls.setBackgroundColor((int) animator.getAnimatedValue())); + colorAnimation.setDuration(250); + colorAnimation.addUpdateListener(animator -> { + binding.pickerBackdrop.setBackgroundColor((int) animator.getAnimatedValue()); + binding.pickerControls.setBackgroundColor((int) animator.getAnimatedValue()); + }); colorAnimation.start(); binding.fab.hide(); for (FloatingActionButton fab : brandedViews) { |