2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/10027: Make toolbar context menu popup dismissible on SDK<23

This commit is contained in:
mcarare 2020-04-21 13:17:56 +03:00 committed by Emily Kager
parent b5f847467f
commit 4c2cfe29b5

View File

@ -4,6 +4,8 @@
package org.mozilla.fenix.components.toolbar package org.mozilla.fenix.components.toolbar
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.Gravity import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -51,7 +53,7 @@ interface BrowserToolbarViewInteractor {
fun onBrowserMenuDismissed(lowPrioHighlightItems: List<ToolbarMenu.Item>) fun onBrowserMenuDismissed(lowPrioHighlightItems: List<ToolbarMenu.Item>)
fun onScrolled(offset: Int) fun onScrolled(offset: Int)
} }
@SuppressWarnings("LargeClass")
class BrowserToolbarView( class BrowserToolbarView(
private val container: ViewGroup, private val container: ViewGroup,
private val shouldUseBottomToolbar: Boolean, private val shouldUseBottomToolbar: Boolean,
@ -98,6 +100,10 @@ class BrowserToolbarView(
popupWindow.elevation = popupWindow.elevation =
view.context.resources.getDimension(R.dimen.mozac_browser_menu_elevation) view.context.resources.getDimension(R.dimen.mozac_browser_menu_elevation)
// This is a workaround for SDK<23 to allow popup dismissal on outside or back button press
// See: https://github.com/mozilla-mobile/fenix/issues/10027
popupWindow.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
customView.paste.isVisible = !clipboard.text.isNullOrEmpty() && !isCustomTabSession customView.paste.isVisible = !clipboard.text.isNullOrEmpty() && !isCustomTabSession
customView.paste_and_go.isVisible = customView.paste_and_go.isVisible =
!clipboard.text.isNullOrEmpty() && !isCustomTabSession !clipboard.text.isNullOrEmpty() && !isCustomTabSession