Bug 872528 - Password doorhanger is not shown in GB. r=margaret, a=bajaj
authorSriram Ramasubramanian <sriram@mozilla.com>
Thu, 05 Sep 2013 22:28:19 -0700
changeset 154012 0a238c5e20a26352aa69845c8ffbb99c3b6478d9
parent 154011 f53ed314d01f3bac6b01325577eac0df4b8bea9b
child 154013 0d71f4d6b63c20fd09ccf0d3536fce214d66fb9b
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, bajaj
bugs872528
milestone25.0a2
Bug 872528 - Password doorhanger is not shown in GB. r=margaret, a=bajaj
mobile/android/base/widget/ArrowPopup.java
--- a/mobile/android/base/widget/ArrowPopup.java
+++ b/mobile/android/base/widget/ArrowPopup.java
@@ -5,16 +5,17 @@
 
 package org.mozilla.gecko.widget;
 
 import org.mozilla.gecko.GeckoApp;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.util.HardwareUtils;
 
 import android.graphics.drawable.BitmapDrawable;
+import android.os.Build;
 import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.PopupWindow;
 import android.widget.RelativeLayout;
@@ -72,17 +73,26 @@ public class ArrowPopup extends PopupWin
     public void show() {
         int[] anchorLocation = new int[2];
         if (mAnchor != null)
             mAnchor.getLocationInWindow(anchorLocation);
 
         // If there's no anchor or the anchor is out of the window bounds,
         // just show the popup at the top of the gecko app view.
         if (mAnchor == null || anchorLocation[1] < 0) {
-            showAtLocation(mActivity.getView(), Gravity.TOP, 0, 0);
+            final View view = mActivity.getView();
+
+            // Bug in android code causes the window layout parameters to be ignored
+            // when using showAtLocation() in Gingerbread phones.
+            if (Build.VERSION.SDK_INT < 11) {
+                setWidth(view.getWidth());
+                setHeight(view.getHeight());
+            }
+
+            showAtLocation(view, Gravity.TOP, 0, 0);
             return;
         }
 
         // Remove padding from the width of the anchor when calculating the arrow offset.
         int anchorWidth = mAnchor.getWidth() - mAnchor.getPaddingLeft() - mAnchor.getPaddingRight();
         // This is the difference between the edge of the anchor view and the edge of the arrow view.
         // We're making an assumption here that the anchor view is wider than the arrow view.
         int arrowOffset = (anchorWidth - mArrowWidth)/2 + mAnchor.getPaddingLeft();