From e347c95d0901bfe8d6563513a34ee78ccb86d514 Mon Sep 17 00:00:00 2001 From: mcarare Date: Tue, 21 Apr 2020 13:17:56 +0300 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/10027: Make toolbar context menu popup dismissible on SDK<23 --- .../org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt index fa04fcecee8a..fee3bc30d63d 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt @@ -4,6 +4,8 @@ package org.mozilla.fenix.components.toolbar +import android.graphics.Color +import android.graphics.drawable.ColorDrawable import android.view.Gravity import android.view.LayoutInflater import android.view.View @@ -51,7 +53,7 @@ interface BrowserToolbarViewInteractor { fun onBrowserMenuDismissed(lowPrioHighlightItems: List) fun onScrolled(offset: Int) } - +@SuppressWarnings("LargeClass") class BrowserToolbarView( private val container: ViewGroup, private val shouldUseBottomToolbar: Boolean, @@ -98,6 +100,10 @@ class BrowserToolbarView( popupWindow.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_and_go.isVisible = !clipboard.text.isNullOrEmpty() && !isCustomTabSession -- 2.11.4.GIT