Skip to content

Commit

Permalink
For mozilla-mobile#10027: Make toolbar context menu popup dismissible…
Browse files Browse the repository at this point in the history
… on SDK<23
  • Loading branch information
mcarare committed Apr 21, 2020
1 parent f3847d0 commit 1025507
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -51,7 +53,7 @@ interface BrowserToolbarViewInteractor {
fun onBrowserMenuDismissed(lowPrioHighlightItems: List<ToolbarMenu.Item>)
fun onScrolled(offset: Int)
}

@SuppressWarnings("LargeClass")
class BrowserToolbarView(
private val container: ViewGroup,
private val shouldUseBottomToolbar: Boolean,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1025507

Please sign in to comment.