Bug 1157865 - Tablet: Anchor Site Identity popup under the back button. r=ally
authorChenxia Liu <liuche@mozilla.com>
Thu, 23 Apr 2015 18:55:39 -0700
changeset 241142 f0dd7524cbf3835289ada8a48b51f86d1a24ff54
parent 241141 c6e4ebeb0e69d61998ab50e1d14fc4cd885cca17
child 241143 806de9b02d86be6b7712a4959a76a88801e6f610
push id59036
push usercbook@mozilla.com
push dateMon, 27 Apr 2015 10:37:48 +0000
treeherdermozilla-inbound@ad388474898c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersally
bugs1157865
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1157865 - Tablet: Anchor Site Identity popup under the back button. r=ally
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
@@ -844,17 +844,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
@@ -48,16 +48,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
@@ -40,17 +40,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.
 *
@@ -168,17 +167,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;
@@ -532,18 +531,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.