[Android] Adjusted code for new color management
Chromium change: https://chromium-review.googlesource.com/c/chromium/src/+/3351221 Reland "[GMNext] Update ThemeColorProvider to use OmniboxTheme" This is a reland of 16fdb849a961bef58fb236a12ecb9ad7727c1a6d Original change's description: > [GMNext] Update ThemeColorProvider to use OmniboxTheme > > This CL updates the icon tint in some classes to follow OmniboxTheme > instead of the simple light/dark tint. It also moves OmniboxTheme out > of chrome/browser/omnibox to be able to use it in classes outside > omnibox/. > > Bug: 1233725, 1114183
This commit is contained in:
@@ -1003,7 +1003,7 @@ public abstract class BraveActivity<C extends ChromeActivityComponent>
|
||||
if (tabIndex != TabModel.INVALID_TAB_INDEX) {
|
||||
tab = tabModel.getTabAt(tabIndex);
|
||||
// Set active tab
|
||||
tabModel.setIndex(tabIndex, TabSelectionType.FROM_USER);
|
||||
tabModel.setIndex(tabIndex, TabSelectionType.FROM_USER, false);
|
||||
return tab;
|
||||
} else {
|
||||
return null;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class BraveHomeButton extends HomeButton implements TintObserver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTintChanged(ColorStateList tint, boolean useLight) {
|
||||
public void onTintChanged(ColorStateList tint, int brandedColorScheme) {
|
||||
ApiCompatibilityUtils.setImageTintList(this, tint);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class BookmarksButton extends ChromeImageButton implements ThemeColorObse
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTintChanged(ColorStateList tint, boolean useLight) {
|
||||
public void onTintChanged(ColorStateList tint, int brandedColorScheme) {
|
||||
mCurrentTint = tint;
|
||||
ApiCompatibilityUtils.setImageTintList(this, tint);
|
||||
}
|
||||
|
||||
+4
-6
@@ -95,7 +95,7 @@ class BottomToolbarNewTabButton extends ChromeImageButton
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTintChanged(ColorStateList tint, boolean useLight) {
|
||||
public void onTintChanged(ColorStateList tint, int brandedColorScheme) {
|
||||
ApiCompatibilityUtils.setImageTintList(this, tint);
|
||||
updateBackground();
|
||||
}
|
||||
@@ -104,11 +104,9 @@ class BottomToolbarNewTabButton extends ChromeImageButton
|
||||
if (mThemeColorProvider == null || mIncognitoStateProvider == null || mBackground == null) {
|
||||
return;
|
||||
}
|
||||
mBackground.setColorFilter(
|
||||
ThemeUtils.getTextBoxColorForToolbarBackgroundInNonNativePage(mContext,
|
||||
mThemeColorProvider.getThemeColor(),
|
||||
mThemeColorProvider.useLight()
|
||||
&& mIncognitoStateProvider.isIncognitoSelected()),
|
||||
mBackground.setColorFilter(ThemeUtils.getTextBoxColorForToolbarBackgroundInNonNativePage(
|
||||
mContext, mThemeColorProvider.getThemeColor(),
|
||||
mIncognitoStateProvider.isIncognitoSelected()),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -212,7 +212,7 @@ public class BrowsingModeBottomToolbarCoordinator {
|
||||
mSearchAccelerator.setThemeColorProvider(themeColorProvider);
|
||||
mSearchAccelerator.setIncognitoStateProvider(incognitoStateProvider);
|
||||
mSearchAccelerator.onTintChanged(
|
||||
mThemeColorProvider.getTint(), mThemeColorProvider.useLight());
|
||||
mThemeColorProvider.getTint(), mThemeColorProvider.getBrandedColorScheme());
|
||||
|
||||
if (BottomToolbarVariationManager.isTabSwitcherOnBottom()) {
|
||||
mTabSwitcherButtonCoordinator.setTabSwitcherListener(tabSwitcherListener);
|
||||
@@ -222,7 +222,7 @@ public class BrowsingModeBottomToolbarCoordinator {
|
||||
|
||||
mBookmarkButton.setThemeColorProvider(themeColorProvider);
|
||||
mBookmarkButton.onTintChanged(
|
||||
mThemeColorProvider.getTint(), mThemeColorProvider.useLight());
|
||||
mThemeColorProvider.getTint(), mThemeColorProvider.getBrandedColorScheme());
|
||||
|
||||
mThemeColorProvider.addTintObserver(mMenuButton);
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class SearchAccelerator extends ChromeImageButton
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTintChanged(ColorStateList tint, boolean useLight) {
|
||||
public void onTintChanged(ColorStateList tint, int brandedColorScheme) {
|
||||
ApiCompatibilityUtils.setImageTintList(this, tint);
|
||||
updateBackground();
|
||||
}
|
||||
@@ -99,8 +99,7 @@ class SearchAccelerator extends ChromeImageButton
|
||||
|
||||
mBackground.setColorFilter(ThemeUtils.getTextBoxColorForToolbarBackgroundInNonNativePage(
|
||||
mContext, mThemeColorProvider.getThemeColor(),
|
||||
mIncognitoStateProvider.isIncognitoSelected()
|
||||
&& mThemeColorProvider.useLight()),
|
||||
mIncognitoStateProvider.isIncognitoSelected()),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class ShareButton extends ChromeImageButton implements TintObserver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTintChanged(ColorStateList tint, boolean useLight) {
|
||||
public void onTintChanged(ColorStateList tint, int brandedColorScheme) {
|
||||
ApiCompatibilityUtils.setImageTintList(this, tint);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user