Commit f4a062fd authored by Tanmoy Mollik's avatar Tanmoy Mollik Committed by Commit Bot

[Android][Settings] Add new icons in the Main settings page on Android.

This cl adds new icons to show in the main settings page. The icons are
used when MOBILE_IDENTITY_CONSISTENCY flag is on.

Screenshot: https://crbug.com/1092857#c1

Bug: 1092857
Change-Id: Ibb56b4f4586d2ef9dcd29a198fdb9a50049140f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2236406Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarAlice Wang <aliceywang@chromium.org>
Commit-Queue: Tanmoy Mollik <triploblastic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789888}
parent d8f47e16
......@@ -732,8 +732,11 @@ chrome_java_resources = [
"java/res/drawable/ic_site_timer.xml",
"java/res/drawable/ic_swap_vert_round.xml",
"java/res/drawable/ic_sync_badge_off_20dp.xml",
"java/res/drawable/ic_sync_error_40dp.xml",
"java/res/drawable/ic_sync_green_40dp.xml",
"java/res/drawable/ic_sync_error_48dp.xml",
"java/res/drawable/ic_sync_error_legacy_40dp.xml",
"java/res/drawable/ic_sync_green_legacy_40dp.xml",
"java/res/drawable/ic_sync_off_48dp.xml",
"java/res/drawable/ic_sync_on_48dp.xml",
"java/res/drawable/ic_toolbar_share_offset_24dp.xml",
"java/res/drawable/ic_tv_options_input_settings_rotated_grey.xml",
"java/res/drawable/ic_videocam_24dp.xml",
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="48dp"
android:height="48dp"
android:viewportWidth="40"
android:viewportHeight="40"
tools:targetApi="21">
<path
android:strokeWidth="1"
android:pathData="M20,30.5C25.799,30.5 30.5,25.799 30.5,20C30.5,14.201 25.799,9.5 20,9.5C14.201,9.5 9.5,14.201 9.5,20C9.5,25.799 14.201,30.5 20,30.5Z"
android:fillColor="@color/google_red_600"
android:strokeColor="@color/modern_white"/>
<path
android:pathData="M18.7501,16.4687V15.1625C18.2501,15.2938 17.7813,15.5 17.3563,15.7625L18.2688,16.675C18.4251,16.6 18.5813,16.525 18.7501,16.4687ZM14.2876,15.8812L15.7626,17.3562C15.2813,18.1188 15.0001,19.025 15.0001,20C15.0001,21.3813 15.5688,22.625 16.4751,23.525L15.0001,25H18.7501V21.25L17.3501,22.65C16.6751,21.9687 16.2501,21.0375 16.2501,20C16.2501,19.375 16.4063,18.7875 16.6751,18.2687L21.7251,23.3187C21.5688,23.4 21.4126,23.475 21.2438,23.5312V24.8375C21.7438,24.7062 22.2126,24.5 22.6376,24.2375L24.1126,25.7125L24.9063,24.9188L15.0876,15.0875L14.2876,15.8812ZM25.0001,15H21.2501V18.75L22.6501,17.35C23.3251,18.0313 23.7501,18.9625 23.7501,20C23.7501,20.625 23.5938,21.2125 23.3251,21.7313L24.2376,22.6437C24.7188,21.8812 25.0001,20.975 25.0001,20C25.0001,18.6187 24.4313,17.375 23.5251,16.475L25.0001,15Z"
android:fillColor="@color/modern_white"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="48dp"
android:height="48dp"
android:viewportWidth="40"
android:viewportHeight="40"
tools:targetApi="21">
<path
android:strokeWidth="1"
android:pathData="M20,30.5C25.799,30.5 30.5,25.799 30.5,20C30.5,14.201 25.799,9.5 20,9.5C14.201,9.5 9.5,14.201 9.5,20C9.5,25.799 14.201,30.5 20,30.5Z"
android:fillColor="@color/modern_grey_500"
android:strokeColor="@color/modern_white"/>
<path
android:pathData="M18.7501,16.4687V15.1625C18.2501,15.2938 17.7813,15.5 17.3563,15.7625L18.2688,16.675C18.4251,16.6 18.5813,16.525 18.7501,16.4687ZM14.2876,15.8812L15.7626,17.3562C15.2813,18.1188 15.0001,19.025 15.0001,20C15.0001,21.3813 15.5688,22.625 16.4751,23.525L15.0001,25H18.7501V21.25L17.3501,22.65C16.6751,21.9687 16.2501,21.0375 16.2501,20C16.2501,19.375 16.4063,18.7875 16.6751,18.2687L21.7251,23.3187C21.5688,23.4 21.4126,23.475 21.2438,23.5312V24.8375C21.7438,24.7062 22.2126,24.5 22.6376,24.2375L24.1126,25.7125L24.9063,24.9188L15.0876,15.0875L14.2876,15.8812ZM25.0001,15H21.2501V18.75L22.6501,17.35C23.3251,18.0313 23.7501,18.9625 23.7501,20C23.7501,20.625 23.5938,21.2125 23.3251,21.7313L24.2376,22.6437C24.7188,21.8812 25.0001,20.975 25.0001,20C25.0001,18.6187 24.4313,17.375 23.5251,16.475L25.0001,15Z"
android:fillColor="@color/modern_white"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="48dp"
android:height="48dp"
android:viewportWidth="40"
android:viewportHeight="40"
tools:targetApi="21">
<path
android:strokeWidth="1"
android:pathData="M20,30.5C25.799,30.5 30.5,25.799 30.5,20C30.5,14.201 25.799,9.5 20,9.5C14.201,9.5 9.5,14.201 9.5,20C9.5,25.799 14.201,30.5 20,30.5Z"
android:fillColor="@color/google_green_600"
android:strokeColor="@color/modern_white"/>
<path
android:pathData="M17.3482,22.6516C15.8854,21.1888 15.8854,18.8112 17.3482,17.3483C17.7946,16.902 18.3293,16.5882 18.895,16.4203L18.895,15.1298C18.0067,15.3287 17.1582,15.7706 16.4643,16.4644C14.5109,18.4178 14.5109,21.5821 16.4643,23.5355L15.1385,24.8613L18.674,24.8613L18.674,21.3258L17.3482,22.6516ZM23.5354,16.4644L24.8612,15.1386L21.3257,15.1386L21.3257,18.6742L22.6515,17.3483C24.1143,18.8112 24.1143,21.1888 22.6515,22.6516C22.2051,23.098 21.6704,23.4118 21.1047,23.5797L21.1047,24.8702C21.993,24.6713 22.8415,24.2294 23.5354,23.5355C25.4888,21.5821 25.4888,18.4178 23.5354,16.4644Z"
android:fillColor="@color/modern_white"
android:fillType="evenOdd"/>
</vector>
......@@ -106,7 +106,7 @@ public class SyncErrorInfoBar
private SyncErrorInfoBar(@SyncErrorInfoBarType int type, String title, String detailsMessage,
String primaryButtonText) {
super(R.drawable.ic_sync_error_40dp, R.color.default_red, null, title, null,
super(R.drawable.ic_sync_error_legacy_40dp, R.color.default_red, null, title, null,
primaryButtonText, null);
mType = type;
mDetailsMessage = detailsMessage;
......
......@@ -192,7 +192,7 @@ public class SyncAndServicesSettings extends PreferenceFragmentCompat
mSyncCategory = (PreferenceCategory) findPreference(PREF_SYNC_CATEGORY);
mSyncErrorCard = findPreference(PREF_SYNC_ERROR_CARD);
mSyncErrorCard.setIcon(UiUtils.getTintedDrawable(
getActivity(), R.drawable.ic_sync_error_40dp, R.color.default_red));
getActivity(), R.drawable.ic_sync_error_legacy_40dp, R.color.default_red));
mSyncErrorCard.setOnPreferenceClickListener(
SyncSettingsUtils.toOnClickListener(this, this::onSyncErrorCardClicked));
mSyncDisabledByAdministrator = findPreference(PREF_SYNC_DISABLED_BY_ADMINISTRATOR);
......
......@@ -14,6 +14,7 @@ import android.provider.Browser;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
......@@ -29,6 +30,7 @@ import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.LaunchIntentDispatcher;
import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider.CustomTabsUiType;
import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.signin.IdentityServicesProvider;
import org.chromium.chrome.browser.sync.AndroidSyncSettings;
......@@ -220,33 +222,38 @@ public class SyncSettingsUtils {
return null;
}
boolean useNewIcon =
ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY);
ProfileSyncService profileSyncService = ProfileSyncService.get();
if (profileSyncService == null || !AndroidSyncSettings.get().isSyncEnabled()) {
return UiUtils.getTintedDrawable(
context, R.drawable.ic_sync_green_40dp, R.color.default_icon_color);
return useNewIcon
? AppCompatResources.getDrawable(context, R.drawable.ic_sync_off_48dp)
: UiUtils.getTintedDrawable(context, R.drawable.ic_sync_green_legacy_40dp,
R.color.default_icon_color);
}
if (profileSyncService.isSyncDisabledByEnterprisePolicy()) {
return UiUtils.getTintedDrawable(
context, R.drawable.ic_sync_error_40dp, R.color.default_icon_color);
}
if (!profileSyncService.isFirstSetupComplete()) {
return UiUtils.getTintedDrawable(
context, R.drawable.ic_sync_error_40dp, R.color.default_red);
return useNewIcon
? AppCompatResources.getDrawable(context, R.drawable.ic_sync_off_48dp)
: UiUtils.getTintedDrawable(context, R.drawable.ic_sync_error_legacy_40dp,
R.color.default_icon_color);
}
if (profileSyncService.isEngineInitialized()
&& (profileSyncService.hasUnrecoverableError()
|| profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE
|| profileSyncService.isPassphraseRequiredForPreferredDataTypes()
|| profileSyncService.isTrustedVaultKeyRequiredForPreferredDataTypes())) {
return UiUtils.getTintedDrawable(
context, R.drawable.ic_sync_error_40dp, R.color.default_red);
|| profileSyncService.isTrustedVaultKeyRequiredForPreferredDataTypes()
|| !profileSyncService.isFirstSetupComplete())) {
return useNewIcon
? AppCompatResources.getDrawable(context, R.drawable.ic_sync_error_48dp)
: UiUtils.getTintedDrawable(
context, R.drawable.ic_sync_error_legacy_40dp, R.color.default_red);
}
return UiUtils.getTintedDrawable(
context, R.drawable.ic_sync_green_40dp, R.color.default_green);
return useNewIcon ? AppCompatResources.getDrawable(context, R.drawable.ic_sync_on_48dp)
: UiUtils.getTintedDrawable(context, R.drawable.ic_sync_green_legacy_40dp,
R.color.default_green);
}
/**
......
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