Bug 1414309 - Tell ToolbarEditLayout's title background about private mode changes. r? draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Fri, 22 Dec 2017 19:46:20 +0100
changeset 714399 6ad21600691991d071a4ac8f11cba1560541b441
parent 714398 eb75f42b0ed41040fa26ade976a9df8520cb0d17
child 744579 9a1e249ed36cf7f367d55e80a647ae48453719ea
push id93912
push usermozilla@buttercookie.de
push dateFri, 22 Dec 2017 18:48:25 +0000
bugs1414309
milestone59.0a1
Bug 1414309 - Tell ToolbarEditLayout's title background about private mode changes. r? 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)
      */