Bug 1414309 - Tell ToolbarEditLayout's title background about private mode changes. r=nechen a=gchang
authorJan Henning <jh+bugzilla@buttercookie.de>
Fri, 22 Dec 2017 19:46:20 +0100
changeset 443122 46fabe0cc9dc12719f9f96f0146508093a6a0dfe
parent 443121 ac3cd70b8967b4917b4c51ca9b6d71ad727b6942
child 443123 641211059e52792538163f95dd447766e35a7d93
push id8490
push userdluca@mozilla.com
push dateMon, 08 Jan 2018 10:18:49 +0000
treeherdermozilla-beta@641211059e52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnechen, gchang
bugs1414309
milestone58.0
Bug 1414309 - Tell ToolbarEditLayout's title background about private mode changes. r=nechen a=gchang The background is enabled when using a theme to increase readability of the URL, but disabled in private mode, because we don't show the theme while in private mode. However for the latter feature to work, the respective layout needs to be told about the private mode state of the toolbar in the first place. We did this for the ToolbarDisplayLayout, but had forgotten the ToolbarEditLayout. MozReview-Commit-ID: 3GAesHvwDEX
mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarEditLayout.java
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarEditLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarEditLayout.java
@@ -49,16 +49,17 @@ import java.util.List;
 */
 public class ToolbarEditLayout extends ThemedLinearLayout {
 
     public interface OnSearchStateChangeListener {
         public void onSearchStateChange(boolean isActive);
     }
 
     private final ToolbarEditText mEditText;
+    private final ThemedLinearLayout mThemeBackground;
 
     private final ThemedImageButton mSearchIcon;
     private final ThemedImageButton mVoiceInput;
     private final ThemedImageButton mQrCode;
 
     private OnFocusChangeListener mFocusChangeListener;
 
     private boolean showKeyboardOnFocus = false; // Indicates if we need to show the keyboard after the app resumes
@@ -66,16 +67,17 @@ public class ToolbarEditLayout extends T
     public ToolbarEditLayout(Context context, AttributeSet attrs) {
         super(context, attrs);
 
         setOrientation(HORIZONTAL);
 
         LayoutInflater.from(context).inflate(R.layout.toolbar_edit_layout, this);
 
         mEditText = (ToolbarEditText) findViewById(R.id.url_edit_text);
+        mThemeBackground = (ThemedLinearLayout) findViewById(R.id.url_bar_title_bg);
 
         mSearchIcon = (ThemedImageButton) findViewById(R.id.search_icon);
         mVoiceInput = (ThemedImageButton) findViewById(R.id.mic);
         mQrCode = (ThemedImageButton) findViewById(R.id.qrcode);
     }
 
     @Override
     public void onAttachedToWindow() {
@@ -172,16 +174,17 @@ public class ToolbarEditLayout extends T
         super.setEnabled(enabled);
         mEditText.setEnabled(enabled);
     }
 
     @Override
     public void setPrivateMode(boolean isPrivate) {
         super.setPrivateMode(isPrivate);
         mEditText.setPrivateMode(isPrivate);
+        mThemeBackground.setPrivateMode(isPrivate);
         mSearchIcon.setPrivateMode(isPrivate);
         mVoiceInput.setPrivateMode(isPrivate);
         mQrCode.setPrivateMode(isPrivate);
     }
 
     /**
      * Called when the parent gains focus (on app launch and resume)
      */