For #13042 - Remove bottomSheetCallback in multiselect mode

releases/v80.0.0
ekager 4 years ago committed by Emily Kager
parent ac870634ff
commit 6a27c209b5

@ -70,6 +70,7 @@ class TabTrayView(
private val tabTrayItemMenu: TabTrayItemMenu private val tabTrayItemMenu: TabTrayItemMenu
private var menu: BrowserMenu? = null private var menu: BrowserMenu? = null
private val bottomSheetCallback: BottomSheetBehavior.BottomSheetCallback
private var tabsTouchHelper: TabsTouchHelper private var tabsTouchHelper: TabsTouchHelper
private val collectionsButtonAdapter = SaveToCollectionsButtonAdapter(interactor) private val collectionsButtonAdapter = SaveToCollectionsButtonAdapter(interactor)
@ -83,7 +84,7 @@ class TabTrayView(
toggleFabText(isPrivate) toggleFabText(isPrivate)
behavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { bottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(bottomSheet: View, slideOffset: Float) { override fun onSlide(bottomSheet: View, slideOffset: Float) {
if (!hasAccessibilityEnabled) { if (!hasAccessibilityEnabled) {
if (slideOffset >= SLIDE_OFFSET) { if (slideOffset >= SLIDE_OFFSET) {
@ -100,7 +101,9 @@ class TabTrayView(
interactor.onTabTrayDismissed() interactor.onTabTrayDismissed()
} }
} }
}) }
behavior.addBottomSheetCallback(bottomSheetCallback)
val selectedTabIndex = if (!isPrivate) { val selectedTabIndex = if (!isPrivate) {
DEFAULT_TAB_ID DEFAULT_TAB_ID
@ -273,6 +276,7 @@ class TabTrayView(
view.tabsTray.apply { view.tabsTray.apply {
tabsTouchHelper.attachToRecyclerView(this) tabsTouchHelper.attachToRecyclerView(this)
} }
behavior.addBottomSheetCallback(bottomSheetCallback)
toggleUIMultiselect(multiselect = false) toggleUIMultiselect(multiselect = false)
@ -281,6 +285,7 @@ class TabTrayView(
is TabTrayDialogFragmentState.Mode.MultiSelect -> { is TabTrayDialogFragmentState.Mode.MultiSelect -> {
// Disable swipe to delete while in multiselect // Disable swipe to delete while in multiselect
tabsTouchHelper.attachToRecyclerView(null) tabsTouchHelper.attachToRecyclerView(null)
behavior.removeBottomSheetCallback(bottomSheetCallback)
toggleUIMultiselect(multiselect = true) toggleUIMultiselect(multiselect = true)

Loading…
Cancel
Save