From b7a3f56743b730dcb72b3415109b4b4efde45df9 Mon Sep 17 00:00:00 2001 From: xz-dev Date: Thu, 27 Apr 2023 08:45:25 +0800 Subject: [PATCH] hide commit dialog when drag player --- .../github/libretube/ui/sheets/ExpandedBottomSheet.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/sheets/ExpandedBottomSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/ExpandedBottomSheet.kt index 40259ed73..462ef4f7c 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/ExpandedBottomSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/ExpandedBottomSheet.kt @@ -7,6 +7,7 @@ import android.widget.FrameLayout import androidx.fragment.app.FragmentManager import com.google.android.material.R import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetBehavior.PEEK_HEIGHT_AUTO import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment @@ -30,13 +31,15 @@ open class ExpandedBottomSheet : BottomSheetDialogFragment() { dialog?.dismiss() } - fun expand(half: Boolean = false) { + fun expand(collapse: Boolean = false) { bottomSheet?.let { fl -> val bottomSheetInfoBehavior = BottomSheetBehavior.from(fl) - bottomSheetInfoBehavior.state = if (half) { - BottomSheetBehavior.STATE_HALF_EXPANDED + if (collapse) { + bottomSheetInfoBehavior.state = BottomSheetBehavior.STATE_COLLAPSED + bottomSheetInfoBehavior.setPeekHeight(0, true) } else { - BottomSheetBehavior.STATE_EXPANDED + bottomSheetInfoBehavior.state = BottomSheetBehavior.STATE_EXPANDED + bottomSheetInfoBehavior.setPeekHeight(PEEK_HEIGHT_AUTO, true) } } }