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
--- 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)
*/