Bug 1157865 - Tablet: Anchor Site Identity popup under the back button. r=ally, a=lizzard
authorChenxia Liu <liuche@mozilla.com>
Thu, 23 Apr 2015 18:55:39 -0700
changeset 265837 28105d968deeaa37715ee598f3d916f30c64fb04
parent 265836 35d0691bdb7c758d9285534b7df36cd9589121e1
child 265838 dcabc6cb5dcd809bdeb14589cf8322fe11f8edf0
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersally, lizzard
bugs1157865
milestone39.0a2
Bug 1157865 - Tablet: Anchor Site Identity popup under the back button. r=ally, a=lizzard
mobile/android/base/toolbar/BrowserToolbar.java
mobile/android/base/toolbar/BrowserToolbarTabletBase.java
mobile/android/base/toolbar/ToolbarDisplayLayout.java
--- a/mobile/android/base/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/toolbar/BrowserToolbar.java
@@ -845,17 +845,17 @@ public abstract class BrowserToolbar ext
         setVisibility(View.VISIBLE);
     }
 
     public void hide() {
         setVisibility(View.GONE);
     }
 
     public View getDoorHangerAnchor() {
-        return urlDisplayLayout.getDoorHangerAnchor();
+        return urlDisplayLayout;
     }
 
     public void onDestroy() {
         Tabs.unregisterOnTabsChangedListener(this);
     }
 
     public boolean openOptionsMenu() {
         if (!hasSoftMenuButton) {
--- a/mobile/android/base/toolbar/BrowserToolbarTabletBase.java
+++ b/mobile/android/base/toolbar/BrowserToolbarTabletBase.java
@@ -49,16 +49,18 @@ abstract class BrowserToolbarTabletBase 
         setButtonEnabled(backButton, false);
         forwardButton = (ForwardButton) findViewById(R.id.forward);
         setButtonEnabled(forwardButton, false);
         initButtonListeners();
 
         focusOrder.addAll(Arrays.asList(tabsButton, (View) backButton, (View) forwardButton, this));
         focusOrder.addAll(urlDisplayLayout.getFocusOrder());
         focusOrder.addAll(Arrays.asList(actionItemBar, menuButton));
+
+        urlDisplayLayout.updateSiteIdentityAnchor(backButton);
     }
 
     private void initButtonListeners() {
         backButton.setOnClickListener(new Button.OnClickListener() {
             @Override
             public void onClick(View view) {
                 Tabs.getInstance().getSelectedTab().doBack();
             }
--- a/mobile/android/base/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/base/toolbar/ToolbarDisplayLayout.java
@@ -41,17 +41,16 @@ import android.util.AttributeSet;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.animation.AlphaAnimation;
 import android.view.animation.Animation;
 import android.view.animation.TranslateAnimation;
 import android.widget.Button;
 import android.widget.ImageButton;
-import android.widget.LinearLayout;
 
 /**
 * {@code ToolbarDisplayLayout} is the UI for when the toolbar is in
 * display state. It's used to display the state of the currently selected
 * tab. It should always be updated through a single entry point
 * (updateFromTab) and should never track any tab events or gecko messages
 * on its own to keep it as dumb as possible.
 *
@@ -187,17 +186,17 @@ public class ToolbarDisplayLayout extend
                 mFavicon.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
             }
             mFaviconSize = Math.round(Favicons.browserToolbarFaviconSize);
         }
 
         mSiteSecurityVisible = (mSiteSecurity.getVisibility() == View.VISIBLE);
 
         mSiteIdentityPopup = new SiteIdentityPopup(mActivity);
-        mSiteIdentityPopup.setAnchor(getDoorHangerAnchor());
+        mSiteIdentityPopup.setAnchor(this);
 
         mStop = (ImageButton) findViewById(R.id.stop);
         mPageActionLayout = (PageActionLayout) findViewById(R.id.page_action_layout);
     }
 
     @Override
     public void onAttachedToWindow() {
         mIsAttached = true;
@@ -551,18 +550,25 @@ public class ToolbarDisplayLayout extend
     void setOnStopListener(OnStopListener listener) {
         mStopListener = listener;
     }
 
     void setOnTitleChangeListener(OnTitleChangeListener listener) {
         mTitleChangeListener = listener;
     }
 
-    View getDoorHangerAnchor() {
-        return this;
+    /**
+     * Update the Site Identity popup anchor.
+     *
+     * Tablet UI has a tablet-specific doorhanger anchor, so update it after all the views
+     * are inflated.
+     * @param view View to use as the anchor for the Site Identity popup.
+     */
+    void updateSiteIdentityAnchor(View view) {
+        mSiteIdentityPopup.setAnchor(view);
     }
 
     void prepareForwardAnimation(PropertyAnimator anim, ForwardButtonAnimation animation, int width) {
         mForwardAnim = anim;
 
         if (animation == ForwardButtonAnimation.HIDE) {
             // We animate these items individually, rather than this entire view,
             // so that we don't animate certain views, e.g. the stop button.