Bug 1377294 - Let Site-Identity becomes theme-able draft
authorJulian_Chu <walkingice0204@gmail.com>
Thu, 22 Jun 2017 13:54:30 +0800
changeset 604141 01ef31f4b755b89750caa6be8f320310bb7275af
parent 604140 1c7396f1fdf08e4525a0b60b8558941265e4186c
child 604142 964fcb24b5dc91f553256f6f3190a4641c6317b2
push id66972
push userbmo:walkingice0204@gmail.com
push dateWed, 05 Jul 2017 10:54:35 +0000
bugs1377294
milestone56.0a1
Bug 1377294 - Let Site-Identity becomes theme-able In Australis flavor, it use same color then user should not aware of any changes. In Photon-flaor, its style use UrlBar.Button to avoid involving tint color list. In current design, we should not tint color for some drawable such as Lock. MozReview-Commit-ID: PSuCbNPKR7
mobile/android/app/src/australis/res/layout/toolbar_display_layout.xml
mobile/android/app/src/photon/res/layout/toolbar_display_layout.xml
mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
--- a/mobile/android/app/src/australis/res/layout/toolbar_display_layout.xml
+++ b/mobile/android/app/src/australis/res/layout/toolbar_display_layout.xml
@@ -5,17 +5,17 @@
 
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:gecko="http://schemas.android.com/apk/res-auto">
 
     <!-- The site security icon is misaligned with the page title so
          we add a bottom margin to align their bottoms.
          Site security icon must have exact position and size as search icon in
          edit layout -->
-    <ImageButton android:id="@+id/site_security"
+    <org.mozilla.gecko.widget.themed.ThemedImageButton android:id="@+id/site_security"
                  style="@style/UrlBar.ImageButton"
                  android:layout_width="@dimen/browser_toolbar_site_security_width"
                  android:layout_height="@dimen/browser_toolbar_site_security_height"
                  android:scaleType="fitCenter"
                  android:layout_marginRight="@dimen/browser_toolbar_site_security_margin_end"
                  android:layout_marginEnd="@dimen/browser_toolbar_site_security_margin_end"
                  android:layout_marginBottom="@dimen/browser_toolbar_site_security_margin_bottom"
                  android:paddingLeft="@dimen/browser_toolbar_site_security_padding_horizontal"
--- a/mobile/android/app/src/photon/res/layout/toolbar_display_layout.xml
+++ b/mobile/android/app/src/photon/res/layout/toolbar_display_layout.xml
@@ -6,25 +6,26 @@
 
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:gecko="http://schemas.android.com/apk/res-auto">
 
     <!-- The site security icon is misaligned with the page title so
          we add a bottom margin to align their bottoms.
          Site security icon must have exact position and size as search icon in
          edit layout -->
-    <ImageButton
+    <org.mozilla.gecko.widget.themed.ThemedImageButton
         android:id="@+id/site_security"
-        style="@style/UrlBar.ImageButton"
+        style="@style/UrlBar.Button"
         android:layout_width="@dimen/browser_toolbar_site_security_width"
         android:layout_height="@dimen/browser_toolbar_site_security_height"
         android:layout_gravity="center_vertical"
         android:layout_marginBottom="@dimen/browser_toolbar_site_security_margin_bottom"
         android:layout_marginEnd="@dimen/browser_toolbar_site_security_margin_end"
         android:layout_marginRight="@dimen/browser_toolbar_site_security_margin_end"
+        android:background="@android:color/transparent"
         android:contentDescription="@string/site_security"
         android:paddingBottom="@dimen/browser_toolbar_site_security_padding_vertical"
         android:paddingEnd="@dimen/browser_toolbar_site_security_padding_horizontal"
         android:paddingLeft="@dimen/browser_toolbar_site_security_padding_horizontal"
         android:paddingRight="@dimen/browser_toolbar_site_security_padding_horizontal"
         android:paddingStart="@dimen/browser_toolbar_site_security_padding_horizontal"
         android:paddingTop="@dimen/browser_toolbar_site_security_padding_vertical"
         android:scaleType="fitCenter"
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
@@ -19,16 +19,17 @@ import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.animation.PropertyAnimator;
 import org.mozilla.gecko.animation.ViewHelper;
 import org.mozilla.gecko.toolbar.BrowserToolbarTabletBase.ForwardButtonAnimation;
 import org.mozilla.gecko.Experiments;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.util.StringUtils;
 import org.mozilla.gecko.util.ViewUtil;
+import org.mozilla.gecko.widget.themed.ThemedImageButton;
 import org.mozilla.gecko.widget.themed.ThemedLinearLayout;
 import org.mozilla.gecko.widget.themed.ThemedTextView;
 
 import android.content.Context;
 import android.support.annotation.NonNull;
 import android.support.v4.view.ViewCompat;
 import android.text.Spannable;
 import android.text.SpannableString;
@@ -98,17 +99,17 @@ public class ToolbarDisplayLayout extend
 
     private boolean mIsAttached;
 
     private final ThemedTextView mTitle;
     private final int mTitlePadding;
     private ToolbarPrefs mPrefs;
     private OnTitleChangeListener mTitleChangeListener;
 
-    private final ImageButton mSiteSecurity;
+    private final ThemedImageButton mSiteSecurity;
 
     private final ImageButton mStop;
     private OnStopListener mStopListener;
 
     private final PageActionLayout mPageActionLayout;
 
     private final SiteIdentityPopup mSiteIdentityPopup;
     private int mSecurityImageLevel;
@@ -146,27 +147,34 @@ public class ToolbarDisplayLayout extend
 
         mUrlColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_urltext));
         mPrivateUrlColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_urltext_private));
         mBlockedColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_blockedtext));
         mDomainColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_domaintext));
         mPrivateDomainColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_domaintext_private));
         mCertificateOwnerColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.affirmative_green));
 
-        mSiteSecurity = (ImageButton) findViewById(R.id.site_security);
+        mSiteSecurity = (ThemedImageButton) findViewById(R.id.site_security);
 
         mSiteIdentityPopup = new SiteIdentityPopup(mActivity);
         mSiteIdentityPopup.setAnchor(this);
         mSiteIdentityPopup.setOnVisibilityChangeListener(mActivity);
 
         mStop = (ImageButton) findViewById(R.id.stop);
         mPageActionLayout = (PageActionLayout) findViewById(R.id.page_action_layout);
     }
 
     @Override
+    public void setPrivateMode(boolean isPrivate) {
+        super.setPrivateMode(isPrivate);
+        mSiteSecurity.setPrivateMode(isPrivate);
+    }
+
+
+    @Override
     public void onAttachedToWindow() {
         super.onAttachedToWindow();
 
         mIsAttached = true;
 
         final Tab selectedTab = Tabs.getInstance().getSelectedTab();
         if (selectedTab != null) {
             // A tab was selected before we became ready; update to that tab now.