summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorSetup Wizard Team <android-setup-team-eng@google.com>2021-04-27 11:08:09 +0800
committerAlex Li <alexylli@google.com>2021-04-27 07:07:16 +0000
commit6447b194090bb6e5371a0fbd2a6b505b7e6e2f18 (patch)
tree14a0aa4209adef2fbea8a0649e9d087fc5aac7d7 /main
parentd94c19c2e8eaed91cc341dbcf95055f5877509c0 (diff)
downloadsetupdesign-6447b194090bb6e5371a0fbd2a6b505b7e6e2f18.tar.gz
Import updated Android Setupdesign Library 370595940
Copied from google3/third_party/java_src/android_libs/setupdesign Test: mm Bug: 186401629 Included changes: - 370595940 Add accent color for lottie illustration - 370590022 Change the margin start/end for landscape layout. PiperOrigin-RevId: 370595940 Change-Id: I7fc4eb0bfe0bed60a4431f78811cb369160f10dd
Diffstat (limited to 'main')
-rw-r--r--main/res/values-night-v31/colors.xml21
-rw-r--r--main/res/values-v31/colors.xml8
-rw-r--r--main/src/com/google/android/setupdesign/util/DynamicColorPalette.java45
3 files changed, 58 insertions, 16 deletions
diff --git a/main/res/values-night-v31/colors.xml b/main/res/values-night-v31/colors.xml
new file mode 100644
index 0000000..faab1f8
--- /dev/null
+++ b/main/res/values-night-v31/colors.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <!-- Accent color -->
+ <color name="sud_dynamic_color_accent_glif_v3">@color/sud_dynamic_color_accent_glif_v3_dark</color>
+</resources> \ No newline at end of file
diff --git a/main/res/values-v31/colors.xml b/main/res/values-v31/colors.xml
index 03bc425..3b7f344 100644
--- a/main/res/values-v31/colors.xml
+++ b/main/res/values-v31/colors.xml
@@ -21,8 +21,12 @@
<color name="sud_color_accent_glif_v3_light">#ff1a73e8</color>
<!-- Accent color -->
- <color name="sud_dynamic_color_accent_glif_v3_dark">@color/sud_system_accent2_300</color>
- <color name="sud_dynamic_color_accent_glif_v3_light">@color/sud_system_accent2_500</color>
+ <color name="sud_dynamic_color_accent_glif_v3">@color/sud_dynamic_color_accent_glif_v3_light</color>
+ <color name="sud_dynamic_color_accent_glif_v3_dark">@color/sud_system_accent1_200</color>
+ <color name="sud_dynamic_color_accent_glif_v3_light">@color/sud_system_accent1_600</color>
+
+ <color name="sud_system_accent1_200">@android:color/system_accent1_200</color>
+ <color name="sud_system_accent1_600">@android:color/system_accent1_600</color>
<color name="sud_system_accent2_0">@android:color/system_accent2_0</color>
<color name="sud_system_accent2_50">@android:color/system_accent2_50</color>
diff --git a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
index 6d3a932..d1f038b 100644
--- a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
+++ b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
@@ -18,8 +18,11 @@ package com.google.android.setupdesign.util;
import android.content.Context;
import androidx.annotation.ColorInt;
+import androidx.annotation.IntDef;
import androidx.annotation.VisibleForTesting;
import com.google.android.setupdesign.R;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
/** The class to get dynamic colors. */
public final class DynamicColorPalette {
@@ -29,34 +32,48 @@ public final class DynamicColorPalette {
private DynamicColorPalette() {}
/** Dynamic color category. */
- public enum DynamicColorCategory {
- PRIMARY_TEXT,
- SECONDARY_TEXT,
- DISABLED_OPTION,
- ERROR_WARNING,
- SUCCESS_DONE,
- FALLBACK_ACCENT
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({
+ ColorType.ACCENT,
+ ColorType.PRIMARY_TEXT,
+ ColorType.SECONDARY_TEXT,
+ ColorType.DISABLED_OPTION,
+ ColorType.ERROR_WARNING,
+ ColorType.SUCCESS_DONE,
+ ColorType.FALLBACK_ACCENT,
+ })
+ public @interface ColorType {
+ int ACCENT = 0;
+ int PRIMARY_TEXT = 1;
+ int SECONDARY_TEXT = 2;
+ int DISABLED_OPTION = 3;
+ int ERROR_WARNING = 4;
+ int SUCCESS_DONE = 5;
+ int FALLBACK_ACCENT = 6;
}
@ColorInt
- public static int getColor(Context context, DynamicColorCategory dynamicColorCategory) {
+ public static int getColor(Context context, @ColorType int dynamicColorCategory) {
switch (dynamicColorCategory) {
- case PRIMARY_TEXT:
+ case ColorType.ACCENT:
+ colorRes = R.color.sud_dynamic_color_accent_glif_v3;
+ break;
+ case ColorType.PRIMARY_TEXT:
colorRes = R.color.sud_system_primary_text;
break;
- case SECONDARY_TEXT:
+ case ColorType.SECONDARY_TEXT:
colorRes = R.color.sud_system_secondary_text;
break;
- case DISABLED_OPTION:
+ case ColorType.DISABLED_OPTION:
colorRes = R.color.sud_system_disable_option;
break;
- case ERROR_WARNING:
+ case ColorType.ERROR_WARNING:
colorRes = R.color.sud_system_error_warning;
break;
- case SUCCESS_DONE:
+ case ColorType.SUCCESS_DONE:
colorRes = R.color.sud_system_success_done;
break;
- case FALLBACK_ACCENT:
+ case ColorType.FALLBACK_ACCENT:
colorRes = R.color.sud_system_fallback_accent;
break;
// fall out