Fix elevation for snackbar and fab
parent
e9bcc9bb1e
commit
8b843ac9e5
|
@ -221,9 +221,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
tabTrayDialog.dismiss()
|
||||
}
|
||||
|
||||
override fun onTabClosed(tab: Tab) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
override fun onTabClosed(tab: Tab) { /* noop */ }
|
||||
|
||||
override fun onNewTabTapped(private: Boolean) {
|
||||
(activity as HomeActivity).browsingModeManager.mode = BrowsingMode.fromBoolean(private)
|
||||
|
|
|
@ -373,7 +373,7 @@ class HomeFragment : Fragment() {
|
|||
}
|
||||
|
||||
override fun onTabClosed(tab: mozilla.components.concept.tabstray.Tab) {
|
||||
TODO("Not yet implemented")
|
||||
/* noop */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,6 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
|
|||
}
|
||||
|
||||
override fun onTabClosed(tab: Tab) {
|
||||
// interactor?.onTabClosed(tab)
|
||||
val sessionManager = view?.context?.components?.core?.sessionManager
|
||||
val snapshot = sessionManager
|
||||
?.findSessionById(tab.id)?.let {
|
||||
|
@ -84,16 +83,18 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
|
|||
getString(R.string.snackbar_tab_closed)
|
||||
}
|
||||
|
||||
viewLifecycleOwner.lifecycleScope.allowUndo(
|
||||
requireView(),
|
||||
snackbarMessage,
|
||||
getString(R.string.snackbar_deleted_undo),
|
||||
{
|
||||
sessionManager.add(snapshot.session, isSelected, engineSessionState = state)
|
||||
},
|
||||
operation = { },
|
||||
anchorView = view?.handle
|
||||
)
|
||||
view?.tabLayout?.let {
|
||||
viewLifecycleOwner.lifecycleScope.allowUndo(
|
||||
it,
|
||||
snackbarMessage,
|
||||
getString(R.string.snackbar_deleted_undo),
|
||||
{
|
||||
sessionManager.add(snapshot.session, isSelected, engineSessionState = state)
|
||||
},
|
||||
operation = { },
|
||||
elevation = ELEVATION
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTabSelected(tab: Tab) {
|
||||
|
@ -107,4 +108,8 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
|
|||
override fun onTabTrayDismissed() {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val ELEVATION = 80f
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class TabTrayView(
|
|||
|
||||
behavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
|
||||
override fun onSlide(bottomSheet: View, slideOffset: Float) {
|
||||
if (slideOffset > SLIDE_OFFSET) {
|
||||
if (slideOffset >= SLIDE_OFFSET) {
|
||||
fabView.new_tab_button.show()
|
||||
} else {
|
||||
fabView.new_tab_button.hide()
|
||||
|
@ -120,7 +120,7 @@ class TabTrayView(
|
|||
companion object {
|
||||
private const val DEFAULT_TAB_ID = 0
|
||||
private const val PRIVATE_TAB_ID = 1
|
||||
private const val SLIDE_OFFSET = 0.4
|
||||
private const val ELEVATION = 41f
|
||||
private const val SLIDE_OFFSET = 0
|
||||
private const val ELEVATION = 90f
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ fun CoroutineScope.allowUndo(
|
|||
undoActionTitle: String,
|
||||
onCancel: suspend () -> Unit = {},
|
||||
operation: suspend () -> Unit,
|
||||
anchorView: View? = null
|
||||
anchorView: View? = null,
|
||||
elevation: Float? = null
|
||||
) {
|
||||
// By using an AtomicBoolean, we achieve memory effects of reading and
|
||||
// writing a volatile variable.
|
||||
|
@ -58,6 +59,10 @@ fun CoroutineScope.allowUndo(
|
|||
}
|
||||
}
|
||||
|
||||
elevation?.also {
|
||||
snackbar.view.elevation = it
|
||||
}
|
||||
|
||||
snackbar.show()
|
||||
|
||||
// Wait a bit, and if user didn't request cancellation, proceed with
|
||||
|
|
Loading…
Reference in New Issue