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
--- 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.