Bug 1325375 - Followup: extend popupmenu size workaround to all 4/5 devices r?sebastian draft
authorAndrzej Hunt <ahunt@mozilla.com>
Mon, 06 Feb 2017 15:08:28 -0800 (2017-02-06)
changeset 479576 a0f37f5b8a3304534987920fd76962433c08ec2e
parent 479455 12c02bf624c48903b155428f7c8a419ba7a333a6
child 544731 2bc257691c26df4750393eafa9ea5c7c7b244410
push id44302
push userahunt@mozilla.com
push dateMon, 06 Feb 2017 23:09:23 +0000 (2017-02-06)
reviewerssebastian
bugs1325375
milestone54.0a1
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
mobile/android/base/java/org/mozilla/gecko/home/activitystream/menu/PopupContextMenu.java
--- 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