Reland "[GMNext] Make default_icon_color_inverse dynamic"
This reverts commit600999fb0c
. Original change's description: > Revert "[GMNext] Make default_icon_color_inverse dynamic" > > This reverts commit7843539578
. > > Reason for revert: Suspected culprit of crash: crbug.com/1265192 > > Original change's description: > > [GMNext] Make default_icon_color_inverse dynamic > > > > Bug: 1270919 > > Change-Id: Ieb77b435304adbbe18d19ba9a218bfdf0778870f > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3367311 > > Reviewed-by: Sky Malice <skym@chromium.org> > > Reviewed-by: Andy Paicu <andypaicu@chromium.org> > > Reviewed-by: Theresa Sullivan <twellington@chromium.org> > > Commit-Queue: Sinan Sahin <sinansahin@google.com> > > Cr-Commit-Position: refs/heads/main@{#957225} > > Bug: 1270919, 1286996 > Change-Id: Ib0ea33f2debcac4b302c69f55e8cb8b65f0a9e93 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3387409 > Reviewed-by: Sky Malice <skym@chromium.org> > Commit-Queue: Sinan Sahin <sinansahin@google.com> > Reviewed-by: Tommy Nyquist <nyquist@chromium.org> > Commit-Queue: Tommy Nyquist <nyquist@chromium.org> > Owners-Override: Tommy Nyquist <nyquist@chromium.org> > Cr-Commit-Position: refs/heads/main@{#958906} Bug: 1270919, 1286996 Change-Id: I84f25700888c94ca47188bd9cb230ef5f306d00f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3401930 Reviewed-by: Ted Choc <tedchoc@chromium.org> Reviewed-by: Sky Malice <skym@chromium.org> Commit-Queue: Sinan Sahin <sinansahin@google.com> Cr-Commit-Position: refs/heads/main@{#961205}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
68c779e77e
commit
363f66c869
chrome
android
features
tab_ui
java
src
org
chromium
chrome
browser
tasks
java
res
drawable
src
org
chromium
chrome
browser
bookmarks
history
offlinepages
indicator
javatests
src
org
chromium
chrome
browser
modaldialog
junit
src
org
chromium
chrome
browser
offlinepages
browser
download
internal
android
java
res
ui
components
browser_ui
styles
android
java
res
src
org
chromium
components
browser_ui
styles
widget
android
java
res
src
org
chromium
components
browser_ui
widget
selectable_list
permissions
android
res
ui/android/java/res
@ -1471,9 +1471,9 @@ class TabListMediator {
|
||||
// Incognito in both light/dark theme is the same as non-incognito mode in dark theme.
|
||||
// Non-incognito mode and incognito in both light/dark themes in dark theme all look
|
||||
// dark.
|
||||
ColorStateList checkedDrawableColorList = AppCompatResources.getColorStateList(mContext,
|
||||
pseudoTab.isIncognito() ? R.color.default_icon_color_dark
|
||||
: R.color.default_icon_color_inverse);
|
||||
ColorStateList checkedDrawableColorList = ColorStateList.valueOf(pseudoTab.isIncognito()
|
||||
? mContext.getColor(R.color.default_icon_color_dark)
|
||||
: SemanticColorUtils.getDefaultIconColorInverse(mContext));
|
||||
ColorStateList actionButtonBackgroundColorList =
|
||||
AppCompatResources.getColorStateList(mContext,
|
||||
pseudoTab.isIncognito() ? R.color.default_icon_color_light
|
||||
|
@ -11,9 +11,9 @@ import android.widget.Button;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.PluralsRes;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
|
||||
import org.chromium.chrome.tab_ui.R;
|
||||
import org.chromium.components.browser_ui.styles.SemanticColorUtils;
|
||||
import org.chromium.components.browser_ui.widget.NumberRollView;
|
||||
import org.chromium.components.browser_ui.widget.TintedDrawable;
|
||||
import org.chromium.components.browser_ui.widget.selectable_list.SelectableListToolbar;
|
||||
@ -48,9 +48,9 @@ class TabSelectionEditorToolbar extends SelectableListToolbar<Integer> {
|
||||
private void showNavigationButton() {
|
||||
TintedDrawable navigationIconDrawable = TintedDrawable.constructTintedDrawable(
|
||||
getContext(), org.chromium.chrome.R.drawable.ic_arrow_back_white_24dp);
|
||||
ColorStateList lightIconColorList = AppCompatResources.getColorStateList(
|
||||
getContext(), org.chromium.chrome.R.color.default_icon_color_inverse);
|
||||
navigationIconDrawable.setTint(lightIconColorList);
|
||||
final @ColorInt int lightIconColor =
|
||||
SemanticColorUtils.getDefaultIconColorInverse(getContext());
|
||||
navigationIconDrawable.setTint(lightIconColor);
|
||||
|
||||
setNavigationIcon(navigationIconDrawable);
|
||||
setNavigationContentDescription(TabUiFeatureUtilities.isLaunchPolishEnabled()
|
||||
|
@ -192,11 +192,6 @@ public class TabUiThemeProvider {
|
||||
*/
|
||||
public static ColorStateList getToggleActionButtonCheckedDrawableTintList(
|
||||
Context context, boolean isIncognito) {
|
||||
if (!themeRefactorEnabled()) {
|
||||
return AppCompatResources.getColorStateList(context,
|
||||
isIncognito ? R.color.default_icon_color_dark
|
||||
: R.color.default_icon_color_inverse);
|
||||
}
|
||||
if (isIncognito) {
|
||||
return AppCompatResources.getColorStateList(
|
||||
context, R.color.incognito_tab_bg_selected_color);
|
||||
|
@ -106,7 +106,7 @@
|
||||
android:rotation="0">
|
||||
|
||||
<path
|
||||
android:fillColor="?attr/default_icon_color_inverse"
|
||||
android:fillColor="@color/default_icon_color_inverse_baseline"
|
||||
android:pathData="M297.722,54.149L297.722,51.997L297.981,51.997L297.981,53.479L299.925,51.391L297.981,49.303L297.981,50.785L297.722,50.785L297.722,48.632L300.291,51.391L297.722,54.149ZM297.98,45.667L295.412,42.909L297.98,40.15L297.98,42.303L297.721,42.303L297.721,40.821L295.777,42.909L297.721,44.997L297.721,43.515L297.98,43.515L297.98,45.667ZM301.395,49.392L301.173,49.251C301.521,48.617 301.705,47.89 301.705,47.15C301.705,44.868 299.976,43.011 297.852,43.011L297.852,42.733C300.119,42.733 301.964,44.715 301.964,47.149C301.963,47.939 301.767,48.715 301.395,49.392ZM297.851,51.566C295.584,51.566 293.739,49.585 293.739,47.149C293.739,46.359 293.936,45.583 294.307,44.907L294.529,45.048C294.181,45.682 293.997,46.408 293.997,47.148C293.997,49.431 295.726,51.287 297.851,51.287L297.851,51.566Z"/>
|
||||
</group>
|
||||
<!-- Blue dot -->
|
||||
|
@ -8,7 +8,7 @@ import android.content.Context;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
|
||||
import org.chromium.base.Callback;
|
||||
import org.chromium.base.CallbackController;
|
||||
@ -177,10 +177,9 @@ public class BookmarkSaveFlowMediator extends BookmarkModelObserver {
|
||||
|
||||
void setPriceTrackingIconForEnabledState(boolean enabled) {
|
||||
mPropertyModel.set(BookmarkSaveFlowProperties.NOTIFICATION_SWITCH_START_ICON,
|
||||
ResourcesCompat.getDrawable(mContext.getResources(),
|
||||
AppCompatResources.getDrawable(mContext,
|
||||
enabled ? R.drawable.price_tracking_enabled_filled
|
||||
: R.drawable.price_tracking_disabled,
|
||||
/*theme=*/null));
|
||||
: R.drawable.price_tracking_disabled));
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
|
@ -5,6 +5,7 @@
|
||||
package org.chromium.chrome.browser.history;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
@ -22,6 +23,7 @@ import org.chromium.chrome.browser.preferences.Pref;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.ui.favicon.FaviconHelper.DefaultFaviconHelper;
|
||||
import org.chromium.chrome.browser.ui.favicon.FaviconUtils;
|
||||
import org.chromium.components.browser_ui.styles.SemanticColorUtils;
|
||||
import org.chromium.components.browser_ui.widget.RoundedIconGenerator;
|
||||
import org.chromium.components.browser_ui.widget.selectable_list.SelectableItemView;
|
||||
import org.chromium.components.browser_ui.widget.selectable_list.SelectableListUtils;
|
||||
@ -55,7 +57,7 @@ public class HistoryItemView extends SelectableItemView<HistoryItem> {
|
||||
context.getResources().getDimensionPixelSize(R.dimen.default_list_row_padding);
|
||||
|
||||
mStartIconSelectedColorList =
|
||||
AppCompatResources.getColorStateList(context, R.color.default_icon_color_inverse);
|
||||
ColorStateList.valueOf(SemanticColorUtils.getDefaultIconColorInverse(context));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,6 +21,7 @@ import org.chromium.base.supplier.ObservableSupplier;
|
||||
import org.chromium.base.supplier.Supplier;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.status_indicator.StatusIndicatorCoordinator;
|
||||
import org.chromium.components.browser_ui.styles.SemanticColorUtils;
|
||||
import org.chromium.content_public.common.ContentSwitches;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@ -160,8 +161,7 @@ public class OfflineIndicatorControllerV2 {
|
||||
final int textColor = ApiCompatibilityUtils.getColor(
|
||||
mContext.getResources(), R.color.default_text_color_inverse);
|
||||
final Drawable statusIcon = mContext.getDrawable(R.drawable.ic_globe_24dp);
|
||||
final int iconTint = ApiCompatibilityUtils.getColor(
|
||||
mContext.getResources(), R.color.default_icon_color_inverse);
|
||||
final int iconTint = SemanticColorUtils.getDefaultIconColorInverse(mContext);
|
||||
mStatusIndicator.updateContent(
|
||||
mContext.getString(R.string.offline_indicator_v2_back_online_text), statusIcon,
|
||||
backgroundColor, textColor, iconTint, mHideRunnable);
|
||||
|
6
chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogViewRenderTest.java
6
chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogViewRenderTest.java
@ -19,6 +19,7 @@ import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.test.filters.MediumTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
@ -34,6 +35,7 @@ import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate;
|
||||
import org.chromium.components.browser_ui.modaldialog.ModalDialogTestUtils;
|
||||
import org.chromium.components.browser_ui.modaldialog.ModalDialogView;
|
||||
import org.chromium.components.browser_ui.modaldialog.test.R;
|
||||
import org.chromium.components.browser_ui.styles.SemanticColorUtils;
|
||||
import org.chromium.content_public.browser.test.util.TestThreadUtils;
|
||||
import org.chromium.ui.UiUtils;
|
||||
import org.chromium.ui.modaldialog.ModalDialogProperties;
|
||||
@ -170,8 +172,8 @@ public class ModalDialogViewRenderTest extends DummyUiActivityTestCase {
|
||||
@MediumTest
|
||||
@Feature({"ModalDialog", "RenderTest"})
|
||||
public void testRender_FilledPrimaryButtonWithIcon() throws IOException {
|
||||
final Drawable icon = UiUtils.getTintedDrawable(getActivity(),
|
||||
org.chromium.chrome.R.drawable.ic_add, R.color.default_icon_color_inverse);
|
||||
final Drawable icon = AppCompatResources.getDrawable(getActivity(), R.drawable.ic_add);
|
||||
icon.mutate().setTint(SemanticColorUtils.getDefaultIconColorInverse(getActivity()));
|
||||
|
||||
setUpViews(R.style.Theme_Chromium_ModalDialog_FilledPrimaryButton);
|
||||
createModel(
|
||||
|
@ -16,8 +16,8 @@ import static org.chromium.chrome.browser.offlinepages.indicator.OfflineIndicato
|
||||
import static org.chromium.chrome.browser.offlinepages.indicator.OfflineIndicatorControllerV2.STATUS_INDICATOR_WAIT_BEFORE_HIDE_DURATION_MS;
|
||||
import static org.chromium.chrome.browser.offlinepages.indicator.OfflineIndicatorControllerV2.setMockElapsedTimeSupplier;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Handler;
|
||||
|
||||
import org.junit.After;
|
||||
@ -27,6 +27,7 @@ import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.Robolectric;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import org.chromium.base.TimeUtils;
|
||||
@ -45,10 +46,6 @@ import org.chromium.chrome.browser.status_indicator.StatusIndicatorCoordinator;
|
||||
@RunWith(BaseRobolectricTestRunner.class)
|
||||
@Config(manifest = Config.NONE)
|
||||
public class OfflineIndicatorControllerV2UnitTest {
|
||||
@Mock
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private Resources mResources;
|
||||
@Mock
|
||||
private StatusIndicatorCoordinator mStatusIndicator;
|
||||
@Mock
|
||||
@ -64,22 +61,23 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
@Mock
|
||||
private OfflineIndicatorMetricsDelegate mMetricsDelegate;
|
||||
|
||||
private Context mContext;
|
||||
private ObservableSupplierImpl<Boolean> mIsUrlBarFocusedSupplier =
|
||||
new ObservableSupplierImpl<>();
|
||||
private OfflineIndicatorControllerV2 mController;
|
||||
private long mElapsedTimeMs;
|
||||
private String mOfflineString;
|
||||
private String mOnlineString;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = Robolectric.buildActivity(Activity.class).get();
|
||||
mContext.setTheme(org.chromium.chrome.tab_ui.R.style.Theme_BrowserUI_DayNight);
|
||||
|
||||
mOfflineString = mContext.getString(R.string.offline_indicator_v2_offline_text);
|
||||
mOnlineString = mContext.getString(R.string.offline_indicator_v2_back_online_text);
|
||||
|
||||
when(mContext.getResources()).thenReturn(mResources);
|
||||
when(mContext.getTheme()).thenReturn(null);
|
||||
when(mContext.getString(R.string.offline_indicator_v2_offline_text)).thenReturn("Offline");
|
||||
when(mContext.getString(R.string.offline_indicator_v2_back_online_text))
|
||||
.thenReturn("Online");
|
||||
when(mContext.getDrawable(anyInt())).thenReturn(null);
|
||||
when(mResources.getColor(anyInt(), any())).thenReturn(0);
|
||||
when(mCanAnimateNativeBrowserControls.get()).thenReturn(true);
|
||||
TimeUtilsJni.TEST_HOOKS.setInstanceForTesting(mTimeUtils);
|
||||
when(mTimeUtils.getTimeTicksNowUs()).thenReturn(0L);
|
||||
@ -109,7 +107,7 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
public void testShowsStatusIndicatorWhenOffline() {
|
||||
// Show.
|
||||
changeConnectionState(true);
|
||||
verify(mStatusIndicator).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator).show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +125,7 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
// after that. First, verify the #updateContent() call.
|
||||
final ArgumentCaptor<Runnable> endAnimationCaptor = ArgumentCaptor.forClass(Runnable.class);
|
||||
verify(mStatusIndicator)
|
||||
.updateContent(eq("Online"), any(), anyInt(), anyInt(), anyInt(),
|
||||
.updateContent(eq(mOnlineString), any(), anyInt(), anyInt(), anyInt(),
|
||||
endAnimationCaptor.capture());
|
||||
// Simulate browser controls animation ending.
|
||||
endAnimationCaptor.getValue().run();
|
||||
@ -164,8 +162,8 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
captor.getValue().run();
|
||||
// #updateContent() should be called since the cool-down is complete.
|
||||
verify(mStatusIndicator)
|
||||
.updateContent(
|
||||
eq("Online"), any(), anyInt(), anyInt(), anyInt(), any(Runnable.class));
|
||||
.updateContent(eq(mOnlineString), any(), anyInt(), anyInt(), anyInt(),
|
||||
any(Runnable.class));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,7 +173,8 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
public void testCoolDown_Show() {
|
||||
// First, show.
|
||||
changeConnectionState(true);
|
||||
verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, times(1))
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
// Advance time so we can hide.
|
||||
advanceTimeByMs(STATUS_INDICATOR_COOLDOWN_BEFORE_NEXT_ACTION_MS);
|
||||
// Now, hide.
|
||||
@ -186,7 +185,8 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
changeConnectionState(true);
|
||||
// Cool-down should prevent it from showing and post a runnable for after the time is up.
|
||||
// times(1) because it's been already called once above, no new calls.
|
||||
verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, times(1))
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
final ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class);
|
||||
verify(mHandler).postDelayed(
|
||||
captor.capture(), eq(STATUS_INDICATOR_COOLDOWN_BEFORE_NEXT_ACTION_MS - 1000L));
|
||||
@ -195,7 +195,8 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
advanceTimeByMs(4000);
|
||||
captor.getValue().run();
|
||||
// #show() should be called since the cool-down is complete.
|
||||
verify(mStatusIndicator, times(2)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, times(2))
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -213,7 +214,8 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
changeConnectionState(true);
|
||||
// Cool-down should prevent it from showing and post a runnable for after the time is up.
|
||||
// times(1) because it's been already called once above, no new calls.
|
||||
verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, times(1))
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
final ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class);
|
||||
verify(mHandler).postDelayed(
|
||||
captor.capture(), eq(STATUS_INDICATOR_COOLDOWN_BEFORE_NEXT_ACTION_MS - 1000L));
|
||||
@ -228,7 +230,8 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
advanceTimeByMs(2000);
|
||||
captor.getValue().run();
|
||||
// Still times(1), no new call after the last one.
|
||||
verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, times(1))
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -241,11 +244,12 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
// Now show, at least try.
|
||||
changeConnectionState(true);
|
||||
// Shouldn't show because the omnibox is focused.
|
||||
verify(mStatusIndicator, never()).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, never())
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
|
||||
// Should show once unfocused.
|
||||
mIsUrlBarFocusedSupplier.set(false);
|
||||
verify(mStatusIndicator).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator).show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -259,13 +263,15 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
// Now show, at least try.
|
||||
changeConnectionState(true);
|
||||
// Shouldn't show because the omnibox is focused.
|
||||
verify(mStatusIndicator, never()).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, never())
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
|
||||
// Now, simulate going back online.
|
||||
changeConnectionState(false);
|
||||
// Unfocusing shouldn't cause a show because we're not offline.
|
||||
mIsUrlBarFocusedSupplier.set(false);
|
||||
verify(mStatusIndicator, never()).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, never())
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -282,7 +288,8 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
advanceTimeByMs(1000);
|
||||
changeConnectionState(true);
|
||||
// times(1) because it's been already called once above, no new calls.
|
||||
verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, times(1))
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
final ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class);
|
||||
verify(mHandler).postDelayed(
|
||||
captor.capture(), eq(STATUS_INDICATOR_COOLDOWN_BEFORE_NEXT_ACTION_MS - 1000L));
|
||||
@ -293,10 +300,12 @@ public class OfflineIndicatorControllerV2UnitTest {
|
||||
advanceTimeByMs(4000);
|
||||
captor.getValue().run();
|
||||
// Still times(1), no new calls. The indicator shouldn't show since the omnibox is focused.
|
||||
verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, times(1))
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
// Should show once unfocused.
|
||||
mIsUrlBarFocusedSupplier.set(false);
|
||||
verify(mStatusIndicator, times(2)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt());
|
||||
verify(mStatusIndicator, times(2))
|
||||
.show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@
|
||||
android:scaleType="center"
|
||||
android:background="@drawable/list_item_icon_modern_bg"
|
||||
android:visibility="gone"
|
||||
app:tint="?attr/default_icon_color_inverse"
|
||||
app:tint="@macro/default_icon_color_inverse"
|
||||
app:layout_gravity="center"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
|
@ -9,9 +9,8 @@
|
||||
android:viewportWidth="36" android:width="24dp">
|
||||
<path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd"
|
||||
android:pathData="M18,1L18,1C27.9411,1 36,9.0589 36,19L36,19C36,28.9411 27.9411,37 18,37L18,37C8.0589,37 0,28.9411 0,19L0,19C-0,9.0589 8.0589,1 18,1Z" />
|
||||
<path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero"
|
||||
<path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero"
|
||||
android:pathData="M24,9L12,9C10.9,9 10,9.9 10,11L10,27C10,28.1 10.9,29 12,29L24,29C25.1,29 26,28.1 26,27L26,11C26,9.9 25.1,9 24,9Z" />
|
||||
<path android:fillColor="@macro/default_control_color_active" android:fillType="nonZero"
|
||||
android:pathData="M24,27l-12,0l0,-16l2,0l0,8l2.5,-1.5l2.5,1.5l0,-8l5,0z" />
|
||||
</vector>
|
||||
|
||||
|
@ -9,6 +9,6 @@
|
||||
android:viewportWidth="36" android:width="24dp">
|
||||
<path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd"
|
||||
android:pathData="M18,0L18,0C27.9411,-0 36,8.0589 36,18L36,18C36,27.9411 27.9411,36 18,36L18,36C8.0589,36 0,27.9411 0,18L0,18C-0,8.0589 8.0589,0 18,0Z" />
|
||||
<path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero"
|
||||
<path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero"
|
||||
android:pathData="M10,14L26,14L26,17L10,17L10,14ZM10,19L26,19L26,22L10,22L10,19Z" />
|
||||
</vector>
|
||||
|
@ -8,10 +8,10 @@
|
||||
android:viewportWidth="36" android:width="24dp">
|
||||
<path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd"
|
||||
android:pathData="M18,0L18,0C27.9411,-0 36,8.0589 36,18L36,18C36,27.9411 27.9411,36 18,36L18,36C8.0589,36 0,27.9411 0,18L0,18C-0,8.0589 8.0589,0 18,0Z" />
|
||||
<path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero"
|
||||
<path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero"
|
||||
android:pathData="M25,10L24,10L24,8L22,8L22,10L14,10L14,8L12,8L12,10L11,10C9.89,10 9.01,10.9 9.01,12L9,26C9,27.1 9.89,28 11,28L25,28C26.1,28 27,27.1 27,26L27,12C27,10.9 26.1,10 25,10Z" />
|
||||
<path android:fillColor="@macro/default_control_color_active" android:fillType="nonZero"
|
||||
android:pathData="M25,26l-14,0l0,-10l14,0z" />
|
||||
<path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero"
|
||||
<path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero"
|
||||
android:pathData="M20.5,19L20.5,19C19.12,19 18,20.12 18,21.5L18,21.5C18,22.88 19.12,24 20.5,24L20.5,24C21.88,24 23,22.88 23,21.5L23,21.5C23,20.12 21.88,19 20.5,19Z" />
|
||||
</vector>
|
||||
|
@ -9,6 +9,6 @@
|
||||
android:viewportWidth="36" android:width="24dp">
|
||||
<path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd"
|
||||
android:pathData="M18,0L18,0C27.9411,-0 36,8.0589 36,18L36,18C36,27.9411 27.9411,36 18,36L18,36C8.0589,36 0,27.9411 0,18L0,18C-0,8.0589 8.0589,0 18,0Z" />
|
||||
<path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero"
|
||||
<path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero"
|
||||
android:pathData="M18,12L18,15L22,11L18,7L18,10C13.58,10 10,13.58 10,18C10,19.57 10.46,21.03 11.24,22.26L12.7,20.8C12.25,19.97 12,19.01 12,18C12,14.69 14.69,12 18,12ZM24.76,13.74L23.3,15.2C23.74,16.04 24,16.99 24,18C24,21.31 21.31,24 18,24L18,21L14,25L18,29L18,26C22.42,26 26,22.42 26,18C26,16.43 25.54,14.97 24.76,13.74Z" />
|
||||
</vector>
|
||||
|
@ -9,6 +9,6 @@
|
||||
android:viewportWidth="36" android:width="24dp">
|
||||
<path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd"
|
||||
android:pathData="M18,0L18,0C27.9411,-0 36,8.0589 36,18L36,18C36,27.9411 27.9411,36 18,36L18,36C8.0589,36 0,27.9411 0,18L0,18C-0,8.0589 8.0589,0 18,0Z" />
|
||||
<path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero"
|
||||
<path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero"
|
||||
android:pathData="M22,23.01L22,16L20,16L20,23.01L17,23.01L21,27L25,23.01L22,23.01ZM15,9L11,12.99L14,12.99L14,20L16,20L16,12.99L19,12.99L15,9Z" />
|
||||
</vector>
|
||||
|
@ -9,6 +9,6 @@
|
||||
android:viewportWidth="36" android:width="24dp">
|
||||
<path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd"
|
||||
android:pathData="M18,0L18,0C27.9411,-0 36,8.0589 36,18L36,18C36,27.9411 27.9411,36 18,36L18,36C8.0589,36 0,27.9411 0,18L0,18C-0,8.0589 8.0589,0 18,0Z" />
|
||||
<path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero"
|
||||
<path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero"
|
||||
android:pathData="M12.76,11.29L10.96,9.5L9.55,10.91L11.34,12.7L12.76,11.29ZM10,16.95L7,16.95L7,18.95L10,18.95L10,16.95ZM19,7L17,7L17,9.95L19,9.95L19,7ZM26.45,10.91L25.04,9.5L23.25,11.29L24.66,12.7L26.45,10.91ZM23.24,24.61L25.03,26.41L26.44,25L24.64,23.21L23.24,24.61ZM26,16.95L26,18.95L29,18.95L29,16.95L26,16.95ZM18,11.95C14.69,11.95 12,14.64 12,17.95C12,21.26 14.69,23.95 18,23.95C21.31,23.95 24,21.26 24,17.95C24,14.64 21.31,11.95 18,11.95ZM17,28.9L19,28.9L19,25.95L17,25.95L17,28.9ZM9.55,24.99L10.96,26.4L12.75,24.6L11.34,23.19L9.55,24.99Z" />
|
||||
</vector>
|
||||
|
@ -15,11 +15,11 @@
|
||||
/>
|
||||
<path
|
||||
android:pathData="M18.87,21.07L16.33,18.56L16.36,18.53C18.1,16.59 19.34,14.36 20.07,12L23,12L23,10L16,10L16,8L14,8L14,10L7,10L7,11.99L18.17,11.99C17.5,13.92 16.44,15.75 15,17.35C14.07,16.32 13.3,15.19 12.69,14L10.69,14C11.42,15.63 12.42,17.17 13.67,18.56L8.58,23.58L10,25L15,20L18.11,23.11L18.87,21.07Z"
|
||||
android:fillColor="?attr/default_icon_color_inverse"
|
||||
android:fillColor="@macro/default_icon_color_inverse"
|
||||
/>
|
||||
<path
|
||||
android:pathData="M24.5,16l-2,0l-4.5,12l2,0l1.12,-3l4.75,0l1.13,3l2,0z"
|
||||
android:fillColor="?attr/default_icon_color_inverse"
|
||||
android:fillColor="@macro/default_icon_color_inverse"
|
||||
/>
|
||||
<path
|
||||
android:pathData="M21.88,23l1.62,-4.33l1.62,4.33z"
|
||||
|
@ -9,7 +9,7 @@
|
||||
android:fillColor="@color/black_alpha_20"
|
||||
android:pathData="M12,14m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0"/>
|
||||
<path
|
||||
android:fillColor="@color/default_icon_color_inverse"
|
||||
android:fillColor="@macro/default_icon_color_inverse"
|
||||
android:pathData="M4 6H20v12H4z" />
|
||||
<path
|
||||
android:fillColor="@macro/default_icon_color_accent1"
|
||||
|
@ -36,7 +36,5 @@
|
||||
<item name="colorSwitchThumbNormalNonDynamic">@color/baseline_neutral_100</item>
|
||||
<item name="colorSwitchThumbDisabledNonDynamic">@color/baseline_neutral_900_with_neutral_100_alpha_38</item>
|
||||
<item name="colorSwitchTrackNormalNonDynamic">@color/baseline_neutral_variant_400</item>
|
||||
|
||||
<item name="default_icon_color_inverse">@color/default_icon_color_dark</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
@ -11,6 +11,8 @@
|
||||
<macro name="default_control_color_normal">?attr/colorOnSurfaceVariant</macro>
|
||||
<macro name="default_icon_color">?attr/colorOnSurface</macro>
|
||||
<macro name="default_icon_color_accent1">?attr/colorPrimary</macro>
|
||||
<macro name="default_icon_color_inverse">?attr/colorOnSurfaceInverse</macro>
|
||||
<macro name="default_icon_color_on_accent1">?attr/colorOnPrimary</macro>
|
||||
<macro name="default_icon_color_secondary">?attr/colorOnSurfaceVariant</macro>
|
||||
<macro name="default_text_color">?attr/colorOnSurface</macro>
|
||||
<macro name="default_text_color_accent1">?attr/colorPrimary</macro>
|
||||
@ -26,6 +28,8 @@
|
||||
<macro name="default_control_color_normal">@color/default_control_color_normal_baseline</macro>
|
||||
<macro name="default_icon_color">@color/default_icon_color_baseline</macro>
|
||||
<macro name="default_icon_color_accent1">@color/default_icon_color_accent1_baseline</macro>
|
||||
<macro name="default_icon_color_inverse">@color/default_icon_color_inverse_baseline</macro>
|
||||
<macro name="default_icon_color_on_accent1">@color/default_icon_color_on_accent1_baseline</macro>
|
||||
<macro name="default_icon_color_secondary">@color/default_icon_color_secondary_baseline</macro>
|
||||
<macro name="default_text_color">@color/default_text_color_baseline</macro>
|
||||
<macro name="default_text_color_accent1">@color/default_text_color_blue_baseline</macro>
|
||||
|
@ -58,8 +58,6 @@
|
||||
<!-- Supports dynamic colors now. -->
|
||||
<item name="default_bg_color_dynamic">?attr/colorSurface</item>
|
||||
<item name="divider_line_bg_color_dynamic">?attr/colorSurfaceVariant</item>
|
||||
|
||||
<item name="default_icon_color_inverse">@color/default_icon_color_light</item>
|
||||
</style>
|
||||
<style name="Base.V31.Theme.BrowserUI" parent="Base.V21.Theme.BrowserUI" />
|
||||
<style name="Base.Theme.BrowserUI" parent="Base.V31.Theme.BrowserUI" />
|
||||
@ -118,8 +116,6 @@
|
||||
<!-- Supports dynamic colors now. -->
|
||||
<item name="default_bg_color_dynamic">?attr/colorSurface</item>
|
||||
<item name="divider_line_bg_color_dynamic">?attr/colorSurfaceVariant</item>
|
||||
|
||||
<item name="default_icon_color_inverse">@color/default_icon_color_light</item>
|
||||
</style>
|
||||
<style name="Theme.BrowserUI.DialogWhenLarge" parent="Base.Theme.BrowserUI.DialogWhenLarge"/>
|
||||
|
||||
|
@ -61,6 +61,12 @@ public class SemanticColorUtils {
|
||||
return resolve(R.attr.colorOnSurface, R.color.default_icon_color_baseline, context);
|
||||
}
|
||||
|
||||
/** Returns the semantic color value that corresponds to default_icon_color_inverse. */
|
||||
public static @ColorInt int getDefaultIconColorInverse(Context context) {
|
||||
return resolve(
|
||||
R.attr.colorOnSurfaceInverse, R.color.default_icon_color_inverse_baseline, context);
|
||||
}
|
||||
|
||||
/** Returns the semantic color value that corresponds to default_icon_color_accent1. */
|
||||
public static @ColorInt int getDefaultIconColorAccent1(Context context) {
|
||||
return resolve(R.attr.colorPrimary, R.color.default_icon_color_accent1_baseline, context);
|
||||
|
@ -12,11 +12,11 @@
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@color/default_icon_color_inverse"
|
||||
android:fillColor="@macro/default_icon_color_on_accent1"
|
||||
android:pathData="M20,12 a8,8 0 1,1 0,-0.0001" />
|
||||
<path
|
||||
android:fillColor="@macro/default_icon_color_accent1"
|
||||
android:pathData="M12,2 C6.5,2,2,6.5,2,12 C2,17.5,6.5,22,12,22 C17.5,22,22,17.5,22,12
|
||||
C22,6.5,17.5,2,12,2 Z M17,18 L7,18 L7,16 L17,16 L17,18 Z M10.3,14 L7,10.7
|
||||
L8.4,9.3 L10.3,11.2 L15.6,5.9 L17,7.3 L10.3,14 Z" />
|
||||
</vector>
|
||||
</vector>
|
||||
|
@ -26,7 +26,7 @@
|
||||
android:layout_marginEnd="8dp"
|
||||
tools:ignore="ContentDescription"
|
||||
android:scaleType="centerInside"
|
||||
app:tint="@color/default_icon_color_inverse" />
|
||||
app:tint="@macro/default_icon_color_inverse" />
|
||||
|
||||
<!-- The FrameLayout is to center the smaller LoadingView in the same space as the icon, as well
|
||||
as for providing a contentDescription for the LoadingView. -->
|
||||
@ -41,7 +41,7 @@
|
||||
android:layout_width="16sp"
|
||||
android:layout_height="16sp"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminateTint="@color/default_icon_color_inverse" />
|
||||
android:indeterminateTint="@macro/default_icon_color_inverse" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
|
@ -17,11 +17,11 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.widget.AppCompatImageButton;
|
||||
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
|
||||
|
||||
import org.chromium.base.ApiCompatibilityUtils;
|
||||
import org.chromium.components.browser_ui.styles.SemanticColorUtils;
|
||||
import org.chromium.components.browser_ui.widget.R;
|
||||
import org.chromium.components.browser_ui.widget.TintedDrawable;
|
||||
|
||||
@ -103,8 +103,8 @@ public abstract class SelectableItemView<E> extends SelectableItemViewBase<E> {
|
||||
*/
|
||||
public SelectableItemView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mStartIconSelectedColorList = AppCompatResources.getColorStateList(
|
||||
getContext(), R.color.default_icon_color_inverse);
|
||||
mStartIconSelectedColorList =
|
||||
ColorStateList.valueOf(SemanticColorUtils.getDefaultIconColorInverse(context));
|
||||
mDefaultLevel = getResources().getInteger(R.integer.list_item_level_default);
|
||||
mSelectedLevel = getResources().getInteger(R.integer.list_item_level_selected);
|
||||
mCheckDrawable = AnimatedVectorDrawableCompat.create(
|
||||
@ -231,10 +231,15 @@ public abstract class SelectableItemView<E> extends SelectableItemViewBase<E> {
|
||||
public static void applyModernIconStyle(
|
||||
ImageView imageView, Drawable defaultIcon, boolean isSelected) {
|
||||
imageView.setBackgroundResource(R.drawable.list_item_icon_modern_bg);
|
||||
imageView.setImageDrawable(
|
||||
isSelected ? TintedDrawable.constructTintedDrawable(imageView.getContext(),
|
||||
R.drawable.ic_check_googblue_24dp, R.color.default_icon_color_inverse)
|
||||
: defaultIcon);
|
||||
Drawable drawable;
|
||||
if (isSelected) {
|
||||
drawable = TintedDrawable.constructTintedDrawable(
|
||||
imageView.getContext(), R.drawable.ic_check_googblue_24dp);
|
||||
drawable.setTint(SemanticColorUtils.getDefaultIconColorInverse(imageView.getContext()));
|
||||
} else {
|
||||
drawable = defaultIcon;
|
||||
}
|
||||
imageView.setImageDrawable(drawable);
|
||||
imageView.getBackground().setLevel(isSelected
|
||||
? imageView.getResources().getInteger(R.integer.list_item_level_selected)
|
||||
: imageView.getResources().getInteger(R.integer.list_item_level_default));
|
||||
|
@ -4,7 +4,7 @@
|
||||
found in the LICENSE file.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/default_icon_color_inverse" android:state_selected="true"/>
|
||||
<item android:color="@macro/default_icon_color_inverse" android:state_selected="true"/>
|
||||
<item android:alpha="@dimen/default_disabled_alpha"
|
||||
android:state_enabled="false" android:color="@macro/default_icon_color" />
|
||||
<item android:color="@macro/default_icon_color"/>
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
<!-- Common icon colors for drawables. -->
|
||||
<color name="default_icon_color_baseline">@color/default_icon_color_light</color>
|
||||
<color name="default_icon_color_inverse">@color/default_icon_color_inverse_dark</color>
|
||||
<color name="default_icon_color_inverse_baseline">@color/default_icon_color_inverse_dark</color>
|
||||
<color name="default_icon_color_accent1_baseline">@color/default_icon_color_blue_light</color>
|
||||
<color name="default_icon_color_on_accent1_baseline">@color/default_icon_color_on_accent1_dark</color>
|
||||
<color name="default_icon_color_secondary_baseline">@color/default_icon_color_secondary_light</color>
|
||||
<color name="hairline_stroke_color_baseline">@color/hairline_stroke_color_light</color>
|
||||
<color name="default_icon_color_disabled_baseline">@color/default_icon_color_disabled_light</color>
|
||||
|
@ -5,6 +5,5 @@
|
||||
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="ColorOverlay.Ui" parent="ColorOverlay.Ui.DayNight">
|
||||
<item name="default_icon_color_inverse">@color/default_icon_color_dark</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
@ -27,8 +27,6 @@
|
||||
<attr name="default_bg_color_dynamic" format="color"/>
|
||||
<attr name="divider_line_bg_color_dynamic" format="color"/>
|
||||
|
||||
<attr name="default_icon_color_inverse" format="color" />
|
||||
|
||||
<declare-styleable name="ButtonCompat">
|
||||
<!-- The color of the button background. -->
|
||||
<attr name="buttonColor" format="color"/>
|
||||
|
@ -26,8 +26,9 @@
|
||||
|
||||
<!-- Common icon colors for drawables. -->
|
||||
<color name="default_icon_color_baseline">@color/default_icon_color_dark</color>
|
||||
<color name="default_icon_color_inverse" tools:ignore="UnusedResources">@color/default_icon_color_inverse_light</color>
|
||||
<color name="default_icon_color_inverse_baseline" tools:ignore="UnusedResources">@color/default_icon_color_inverse_light</color>
|
||||
<color name="default_icon_color_accent1_baseline" tools:ignore="UnusedResources">@color/default_icon_color_blue_dark</color>
|
||||
<color name="default_icon_color_on_accent1_baseline">@color/default_icon_color_on_accent1_light</color>
|
||||
<color name="default_icon_color_secondary_baseline" tools:ignore="UnusedResources">@color/default_icon_color_secondary_dark</color>
|
||||
|
||||
<color name="hairline_stroke_color_baseline">@color/hairline_stroke_color_dark</color>
|
||||
|
@ -22,6 +22,9 @@
|
||||
<!-- Same as ?attr/colorOnSurfaceInverse -->
|
||||
<color name="default_icon_color_inverse_light">@color/baseline_neutral_50</color>
|
||||
<color name="default_icon_color_inverse_dark">@color/baseline_neutral_800</color>
|
||||
<!-- Same as ?attr/colorOnPrimary. -->
|
||||
<color name="default_icon_color_on_accent1_light">@color/baseline_neutral_0</color>
|
||||
<color name="default_icon_color_on_accent1_dark">@color/baseline_primary_800</color>
|
||||
|
||||
<!-- Common text colors -->
|
||||
<!-- Same as ?attr/colorOnSurface. -->
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="ColorOverlay.Ui" parent="ColorOverlay.Ui.DayNight">
|
||||
<item name="default_icon_color_inverse">@color/default_icon_color_light</item>
|
||||
</style>
|
||||
<style name="ColorOverlay.Ui.DayNight" parent="">
|
||||
<!-- TODO(https://crbug.com/1216642): Move color attributes here. -->
|
||||
|
Reference in New Issue
Block a user