diff --git a/mobile/android/base/java/org/mozilla/gecko/menu/MenuPopup.java b/mobile/android/base/java/org/mozilla/gecko/menu/MenuPopup.java index 9b9017c5f4b3..b7bdcc4dbe43 100644 --- a/mobile/android/base/java/org/mozilla/gecko/menu/MenuPopup.java +++ b/mobile/android/base/java/org/mozilla/gecko/menu/MenuPopup.java @@ -5,11 +5,13 @@ package org.mozilla.gecko.menu; +import org.mozilla.gecko.AppConstants; import org.mozilla.gecko.R; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; +import android.support.v7.widget.CardView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -20,7 +22,7 @@ import android.widget.PopupWindow; * A popup to show the inflated MenuPanel. */ public class MenuPopup extends PopupWindow { - private final FrameLayout mPanel; + private final CardView mPanel; private final int mPopupWidth; @@ -37,9 +39,21 @@ public class MenuPopup extends PopupWindow { ViewGroup.LayoutParams.WRAP_CONTENT); LayoutInflater inflater = LayoutInflater.from(context); - mPanel = (FrameLayout) inflater.inflate(R.layout.menu_popup, null); + mPanel = (CardView) inflater.inflate(R.layout.menu_popup, null); setContentView(mPanel); + // Disable corners on < lollipop: + // CardView only supports clipping content on API >= 21 (for performance reasons). Without + // content clipping the "action bar" will look ugly because it has its own background: + // by default there's a 2px white edge along the top and sides (i.e. an inset corresponding + // to the corner radius), if we disable the inset then the corners overlap. + // It's possible to implement custom clipping, however given that the support library + // chose not to support this for performance reasons, we too have chosen to just disable + // corners on < 21, see Bug 1271428. + if (AppConstants.Versions.preLollipop) { + mPanel.setRadius(0); + } + setAnimationStyle(R.style.PopupAnimation); } diff --git a/mobile/android/base/resources/drawable-hdpi/menu_popup_bg.9.png b/mobile/android/base/resources/drawable-hdpi/menu_popup_bg.9.png deleted file mode 100644 index 6bfdcc1ed38d..000000000000 Binary files a/mobile/android/base/resources/drawable-hdpi/menu_popup_bg.9.png and /dev/null differ diff --git a/mobile/android/base/resources/drawable-xhdpi/menu_popup_bg.9.png b/mobile/android/base/resources/drawable-xhdpi/menu_popup_bg.9.png deleted file mode 100644 index 858d7f8fae27..000000000000 Binary files a/mobile/android/base/resources/drawable-xhdpi/menu_popup_bg.9.png and /dev/null differ diff --git a/mobile/android/base/resources/layout/menu_popup.xml b/mobile/android/base/resources/layout/menu_popup.xml index a52c138f6e0c..80cca85a4d0a 100644 --- a/mobile/android/base/resources/layout/menu_popup.xml +++ b/mobile/android/base/resources/layout/menu_popup.xml @@ -3,14 +3,16 @@ - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - + app:cardBackgroundColor="@color/toolbar_grey" + app:cardUseCompatPadding="true"> - + \ No newline at end of file