Commit 30726563 authored by Filip Gorski's avatar Filip Gorski Committed by Ender 💬 = 🕐 (ping me for faster reviews)

[SRO][Incognito] Fix theme leaking in edit url divider line

Introduces incognito specific divider_line_incognito drawable that is
not prone to changing the background color with the theme change.

Bug: 1096290
Change-Id: Icde04438a76dcdb2c3d1ff9006dde345d21d3c54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2296623
Commit-Queue: Krishna Govind <govind@chromium.org>
Commit-Queue: Ender 💬 = 🕐 (ping me for faster reviews) <ender@google.com>
Reviewed-by: Ender 💬 = 🕐 (ping me for faster reviews) <ender@google.com>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarLijin Shen <lazzzis@google.com>
Cr-Commit-Position: refs/heads/master@{#791544}
parent 811b6a4e
......@@ -14,10 +14,11 @@ import org.chromium.chrome.browser.omnibox.suggestions.base.BaseSuggestionView;
/**
* Container view for Search-Ready Omnibox suggestions.
* Decorates the suggestion with the bottom bar.
* Decorates the suggestion with a divider.
*/
public class EditUrlSuggestionView extends FrameLayout {
BaseSuggestionView<View> mContent;
private BaseSuggestionView<View> mContent;
private View mDivider;
public EditUrlSuggestionView(Context context) {
super(context, null);
......@@ -27,18 +28,24 @@ public class EditUrlSuggestionView extends FrameLayout {
contentLayoutParams.height = LayoutParams.WRAP_CONTENT;
addView(mContent, contentLayoutParams);
View divider = new View(context, null, 0, R.style.HorizontalDivider);
mDivider = new View(context, null, 0, R.style.HorizontalDivider);
LayoutParams dividerLayoutParams = generateDefaultLayoutParams();
dividerLayoutParams.gravity = Gravity.BOTTOM;
dividerLayoutParams.width = LayoutParams.MATCH_PARENT;
dividerLayoutParams.height = getResources().getDimensionPixelSize(R.dimen.divider_height);
addView(divider, dividerLayoutParams);
addView(mDivider, dividerLayoutParams);
}
/** @return The base suggestion view for this edit URL suggestion. */
BaseSuggestionView<View> getBaseSuggestionView() {
return mContent;
}
/** @return The divider of this edit URL suggestion. */
View getDivider() {
return mDivider;
}
@Override
public void setSelected(boolean selected) {
mContent.setSelected(selected);
......
......@@ -4,8 +4,11 @@
package org.chromium.chrome.browser.omnibox.suggestions.editurl;
import android.graphics.drawable.Drawable;
import android.view.View;
import org.chromium.chrome.browser.omnibox.styles.OmniboxResourceProvider;
import org.chromium.chrome.browser.omnibox.suggestions.SuggestionCommonProperties;
import org.chromium.chrome.browser.omnibox.suggestions.base.BaseSuggestionViewBinder;
import org.chromium.chrome.browser.omnibox.suggestions.basic.SuggestionViewViewBinder;
import org.chromium.ui.modelutil.PropertyKey;
......@@ -24,5 +27,12 @@ public class EditUrlSuggestionViewBinder
@Override
public void bind(PropertyModel model, EditUrlSuggestionView view, PropertyKey propertyKey) {
mBinder.bind(model, view.getBaseSuggestionView(), propertyKey);
if (SuggestionCommonProperties.OMNIBOX_THEME == propertyKey) {
Drawable drawable = OmniboxResourceProvider.resolveAttributeToDrawable(
view.getContext(), model.get(SuggestionCommonProperties.OMNIBOX_THEME),
android.R.attr.listDivider);
view.getDivider().setBackground(drawable);
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment