Bug 1028885 - Reposition open tabs tray menu on device rotation. r=wesj, a=sledru
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Wed, 06 Aug 2014 11:24:27 -0700
changeset 217408 013fd839967c666b6a19ada40625bb6afce40fda
parent 217407 c5f014796d364a7fbaa5f1faf5be6d3e5ad49060
child 217409 0a77721ad4adc1efcb2bf9904c3d83f7a9806625
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj, sledru
bugs1028885
milestone33.0a2
Bug 1028885 - Reposition open tabs tray menu on device rotation. r=wesj, a=sledru
mobile/android/base/widget/GeckoPopupMenu.java
--- a/mobile/android/base/widget/GeckoPopupMenu.java
+++ b/mobile/android/base/widget/GeckoPopupMenu.java
@@ -108,16 +108,22 @@ public class GeckoPopupMenu implements G
 
     /**
      * Set a different anchor after the menu is inflated.
      *
      * @param anchor The new anchor for the popup.
      */
     public void setAnchor(View anchor) {
         mAnchor = anchor;
+
+        // Reposition the popup if the anchor changes while it's showing.
+        if (mMenuPopup.isShowing()) {
+            mMenuPopup.dismiss();
+            mMenuPopup.showAsDropDown(mAnchor);
+        }
     }
 
     public void setOnDismissListener(OnDismissListener listener) {
         mDismissListener = listener;
     }
 
     public void setOnMenuItemClickListener(OnMenuItemClickListener listener) {
         mClickListener = listener;