Bug 1325375 - Followup: extend popupmenu size workaround to all 4/5 devices r?sebastian
It seems that there is a wide variety of affected devices, so we should just play it safe
and run the workaround on any device that might be affected. (We already run this code
for _all_ devices for the main app menu, so it doesn't have any adverse affects. On the other
hand it would be nice to remove it eventually, i.e. once we no longer support Android 4 or 5 -
although that's still a long way away.))
MozReview-Commit-ID: 2nOYScRXQLd
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/menu/PopupContextMenu.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/menu/PopupContextMenu.java
@@ -50,19 +50,21 @@ import org.mozilla.gecko.home.activityst
navigationView = (NavigationView) card.findViewById(R.id.menu);
navigationView.setNavigationItemSelectedListener(this);
popupWindow = new PopupWindow(context);
popupWindow.setContentView(card);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
popupWindow.setFocusable(true);
- // On Asus devices running Android 4, PopupWindow is assigned height/width = 0 - we therefore
- // need to manually override that behaviour, but only on those devices:
- if (AppConstants.Versions.preLollipop && "asus".equals(android.os.Build.MANUFACTURER)) {
+ // On a variety of devices running Android 4 and 5, PopupWindow is assigned height/width = 0 - we therefore
+ // need to manually override that behaviour. There don't appear to be any reported issues
+ // with devices running 6 (Marshmallow) or newer, so we should restrict the workaround
+ // as much as possible:
+ if (AppConstants.Versions.preMarshmallow) {
popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
}
super.postInit();
}
@Override