summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorSetup Wizard Team <android-setup-team-eng@google.com>2021-05-04 08:22:45 +0800
committerCn Chen <cnchen@google.com>2021-05-04 04:17:46 +0000
commite530e8b9c6d953bf281696a83dca37b03d212e8e (patch)
treee56ced367ca8fcbbc980a76241bb706201b680cf /main
parentff3cc9f2135c480fd66908bbe51c91ac8deb4645 (diff)
downloadsetupdesign-e530e8b9c6d953bf281696a83dca37b03d212e8e.tar.gz
Import updated Android Setupdesign Library 371812065
Copied from google3/third_party/java_src/android_libs/setupdesign Test: mm Bug: 182870319 Bug: 185557130 Included changes: - 371812065 Add replace rule to remove comment - 371731255 Rollback the new layout of layout-v31 due to footer bar m... - 371667272 Add API for ChimeraActivity - 371663930 [GlifLoadingLayout] make the content area keep fixed size... - 371648106 [GlifLoadingLayout] Add padding partner resources for con... - 371647490 [Transition][fallback] adds animation resources files for... - 371626793 [GlifLoadingLayout] Adds comment for functions and fixes ... - 371102383 [ColorExtraction] Adds fix colors for color extraction. - 371080909 [GlifLoadingLayout] Adds padding value for waiting screen... - 371036943 Create theme for support full dynamic color - 370881231 [GlifLoadingLayout] adjust the layout to follow spec to m... - 370868945 It's hard to know the fail reason of trySetDynamicColor PiperOrigin-RevId: 371812065 Change-Id: Ib9108999c9e53b4b8a9b21653bfe16788a6e3e22
Diffstat (limited to 'main')
-rw-r--r--main/res/anim-v31/sud_interpolator.xml19
-rw-r--r--main/res/anim-v31/sud_slide_back_in.xml22
-rw-r--r--main/res/anim-v31/sud_slide_back_out.xml22
-rw-r--r--main/res/anim-v31/sud_slide_next_in.xml22
-rw-r--r--main/res/anim-v31/sud_slide_next_out.xml22
-rw-r--r--main/res/values-land-v31/dimens.xml27
-rw-r--r--main/res/values-land/dimens.xml7
-rw-r--r--main/res/values-night-v31/colors.xml10
-rw-r--r--main/res/values-night/colors.xml26
-rw-r--r--main/res/values-v31/colors.xml47
-rw-r--r--main/res/values-v31/config.xml22
-rw-r--r--main/res/values-v31/styles.xml36
-rw-r--r--main/res/values/attrs.xml8
-rw-r--r--main/res/values/colors.xml98
-rw-r--r--main/res/values/dimens.xml9
-rw-r--r--main/res/values/styles.xml28
-rw-r--r--main/src/com/google/android/setupdesign/GlifLayout.java62
-rw-r--r--main/src/com/google/android/setupdesign/GlifListLayout.java1
-rw-r--r--main/src/com/google/android/setupdesign/GlifRecyclerLayout.java1
-rw-r--r--main/src/com/google/android/setupdesign/util/DynamicColorPalette.java3
-rw-r--r--main/src/com/google/android/setupdesign/util/PartnerStyleHelper.java35
-rw-r--r--main/src/com/google/android/setupdesign/util/ThemeHelper.java90
22 files changed, 554 insertions, 63 deletions
diff --git a/main/res/anim-v31/sud_interpolator.xml b/main/res/anim-v31/sud_interpolator.xml
new file mode 100644
index 0000000..bec77f0
--- /dev/null
+++ b/main/res/anim-v31/sud_interpolator.xml
@@ -0,0 +1,19 @@
+<?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.
+-->
+
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+ android:pathData="M 0,0 C 0.05, 0, 0.133333, 0.06, 0.166666, 0.4 C 0.208333, 0.82, 0.25, 1, 1, 1" />
diff --git a/main/res/anim-v31/sud_slide_back_in.xml b/main/res/anim-v31/sud_slide_back_in.xml
new file mode 100644
index 0000000..77d4cd5
--- /dev/null
+++ b/main/res/anim-v31/sud_slide_back_in.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+
+<translate xmlns:android="http://schemas.android.com/apk/res/android"
+ android:duration="@integer/sudTransitionDuration"
+ android:fromXDelta="-100%"
+ android:toXDelta="0%"
+ android:interpolator="@anim/sud_interpolator" />
diff --git a/main/res/anim-v31/sud_slide_back_out.xml b/main/res/anim-v31/sud_slide_back_out.xml
new file mode 100644
index 0000000..8ae16d4
--- /dev/null
+++ b/main/res/anim-v31/sud_slide_back_out.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+
+<translate xmlns:android="http://schemas.android.com/apk/res/android"
+ android:duration="@integer/sudTransitionDuration"
+ android:fromXDelta="0%"
+ android:toXDelta="100%"
+ android:interpolator="@anim/sud_interpolator" />
diff --git a/main/res/anim-v31/sud_slide_next_in.xml b/main/res/anim-v31/sud_slide_next_in.xml
new file mode 100644
index 0000000..006d9b4
--- /dev/null
+++ b/main/res/anim-v31/sud_slide_next_in.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+
+<translate xmlns:android="http://schemas.android.com/apk/res/android"
+ android:duration="@integer/sudTransitionDuration"
+ android:fromXDelta="100%"
+ android:toXDelta="0%"
+ android:interpolator="@anim/sud_interpolator" />
diff --git a/main/res/anim-v31/sud_slide_next_out.xml b/main/res/anim-v31/sud_slide_next_out.xml
new file mode 100644
index 0000000..341bbad
--- /dev/null
+++ b/main/res/anim-v31/sud_slide_next_out.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+
+<translate xmlns:android="http://schemas.android.com/apk/res/android"
+ android:duration="@integer/sudTransitionDuration"
+ android:fromXDelta="0%"
+ android:toXDelta="-100%"
+ android:interpolator="@anim/sud_interpolator" />
diff --git a/main/res/values-land-v31/dimens.xml b/main/res/values-land-v31/dimens.xml
new file mode 100644
index 0000000..8b8d10d
--- /dev/null
+++ b/main/res/values-land-v31/dimens.xml
@@ -0,0 +1,27 @@
+<?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>
+
+ <!-- General -->
+ <dimen name="sud_glif_footer_padding_start">16dp</dimen>
+ <!-- Calculated by (sud_glif_margin_end - 4dp internal padding of button) -->
+ <dimen name="sud_glif_footer_padding_end">28dp</dimen>
+ <dimen name="sud_glif_margin_start">32dp</dimen>
+ <dimen name="sud_glif_margin_end">32dp</dimen>
+
+</resources>
diff --git a/main/res/values-land/dimens.xml b/main/res/values-land/dimens.xml
index 1867d3b..49ed20d 100644
--- a/main/res/values-land/dimens.xml
+++ b/main/res/values-land/dimens.xml
@@ -38,4 +38,11 @@
<!-- Illustration -->
<item name="sud_illustration_aspect_ratio" format="float" type="dimen">0</item>
+ <!-- TODO: Add testcase for testing padding value in landscape mode -->
+ <!-- Loading content styles -->
+ <dimen name="sud_content_loading_frame_padding_top">0dp</dimen>
+ <dimen name="sud_content_loading_frame_padding_start">0dp</dimen>
+ <dimen name="sud_content_loading_frame_padding_end">0dp</dimen>
+ <dimen name="sud_content_loading_frame_padding_bottom">24dp</dimen>
+
</resources>
diff --git a/main/res/values-night-v31/colors.xml b/main/res/values-night-v31/colors.xml
index faab1f8..fda7fa0 100644
--- a/main/res/values-night-v31/colors.xml
+++ b/main/res/values-night-v31/colors.xml
@@ -18,4 +18,14 @@
<resources>
<!-- Accent color -->
<color name="sud_dynamic_color_accent_glif_v3">@color/sud_dynamic_color_accent_glif_v3_dark</color>
+
+ <color name="sud_system_primary_text">@color/sud_system_neutral1_50</color>
+ <color name="sud_system_secondary_text">@color/sud_system_neutral2_200</color>
+ <color name="sud_system_tertiary_text_inactive">@color/sud_system_neutral2_400</color>
+ <color name="sud_system_background_surface">@color/sud_system_neutral1_900</color>
+ <color name="sud_system_accent_icon_text_button">@color/sud_system_accent1_200</color>
+ <color name="sud_system_button_surface">@color/sud_system_accent1_100</color>
+ <color name="sud_system_button_text">@color/sud_system_neutral1_900</color>
+ <color name="sud_system_dividing_line">@color/sud_system_neutral2_300</color>
+
</resources> \ No newline at end of file
diff --git a/main/res/values-night/colors.xml b/main/res/values-night/colors.xml
index 38f9bc2..9fc8f32 100644
--- a/main/res/values-night/colors.xml
+++ b/main/res/values-night/colors.xml
@@ -17,12 +17,24 @@
<resources>
- <color name="system_primary_text">#FFFFFF</color>
- <color name="system_secondary_text">#9AA0A6</color>
- <color name="system_disable_option">#5F6368</color>
- <color name="system_error_warning">#EE675C</color>
- <color name="system_success_done">#5BB974</color>
- <color name="system_fallback_accent">#669DF6</color>
- <color name="system_accent_primary">@color/system_accent2_200</color>
+ <color name="sud_system_primary_text">@color/primary_text_color_device_default_dark</color>
+
+ <color name="sud_system_secondary_text">@color/secondary_text_color_device_default_dark</color>
+
+ <color name="sud_system_tertiary_text_inactive">@color/tertiary_text_inactive_color_device_default_dark</color>
+
+ <color name="sud_system_error_warning">@color/error_color_device_default_dark</color>
+
+ <color name="sud_system_success_done">@color/success_color_device_default_dark</color>
+
+ <color name="sud_system_fallback_accent">@color/fallback_color_device_default_dark</color>
+
+ <color name="sud_system_background_surface">@color/background_surface_color_device_default_dark</color>
+
+ <color name="sud_system_accent_icon_text_button">@color/accent_icon_text_color_device_default_dark</color>
+
+ <color name="sud_system_dividing_line">@color/dividing_line_color_device_default_dark</color>
+
+ <color name="sud_system_accent_primary">@color/system_accent2_200</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 3b7f344..7b2ed75 100644
--- a/main/res/values-v31/colors.xml
+++ b/main/res/values-v31/colors.xml
@@ -17,7 +17,9 @@
<resources>
<!-- Default color for BC -->
+
<color name="sud_color_accent_glif_v3_dark">#ff669df6</color>
+
<color name="sud_color_accent_glif_v3_light">#ff1a73e8</color>
<!-- Accent color -->
@@ -28,24 +30,57 @@
<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>
+
<color name="sud_system_accent2_100">@android:color/system_accent2_100</color>
+
<color name="sud_system_accent2_200">@android:color/system_accent2_200</color>
+
<color name="sud_system_accent2_300">@android:color/system_accent2_300</color>
+
<color name="sud_system_accent2_400">@android:color/system_accent2_400</color>
+
<color name="sud_system_accent2_500">@android:color/system_accent2_500</color>
+
<color name="sud_system_accent2_600">@android:color/system_accent2_600</color>
+
<color name="sud_system_accent2_700">@android:color/system_accent2_700</color>
+
<color name="sud_system_accent2_800">@android:color/system_accent2_800</color>
+
<color name="sud_system_accent2_900">@android:color/system_accent2_900</color>
+
<color name="sud_system_accent2_1000">@android:color/system_accent2_1000</color>
- <color name="sud_system_primary_text">@color/system_primary_text</color>
- <color name="sud_system_secondary_text">@color/system_secondary_text</color>
- <color name="sud_system_disable_option">@color/system_disable_option</color>
- <color name="sud_system_error_warning">@color/system_error_warning</color>
- <color name="sud_system_success_done">@color/system_success_done</color>
- <color name="sud_system_fallback_accent">@color/system_fallback_accent</color>
+
+ <color name="sud_system_neutral1_900">@android:color/system_neutral1_900</color>
+
+ <color name="sud_system_neutral1_50">@android:color/system_neutral1_50</color>
+
+ <color name="sud_system_neutral2_700">@android:color/system_neutral2_700</color>
+
+ <color name="sud_system_neutral2_200">@android:color/system_neutral2_200</color>
+
+ <color name="sud_system_neutral2_500">@android:color/system_neutral2_500</color>
+
+ <color name="sud_system_neutral2_400">@android:color/system_neutral2_400</color>
+
+ <color name="sud_system_neutral2_300">@android:color/system_accent2_300</color>
+
+ <color name="sud_system_accent1_100">@android:color/system_accent1_100</color>
+
+
+ <color name="sud_system_primary_text">@color/sud_system_neutral1_900</color>
+ <color name="sud_system_secondary_text">@color/sud_system_neutral2_700</color>
+ <color name="sud_system_tertiary_text_inactive">@color/sud_system_neutral2_500</color>
+ <color name="sud_system_background_surface">@color/sud_system_neutral1_50</color>
+ <color name="sud_system_accent_icon_text_button">@color/sud_system_accent1_600</color>
+ <color name="sud_system_button_surface">@color/sud_system_accent1_100</color>
+ <color name="sud_system_button_text">@color/sud_system_neutral1_900</color>
+ <color name="sud_system_dividing_line">@color/sud_system_neutral2_300</color>
</resources> \ No newline at end of file
diff --git a/main/res/values-v31/config.xml b/main/res/values-v31/config.xml
new file mode 100644
index 0000000..7367e33
--- /dev/null
+++ b/main/res/values-v31/config.xml
@@ -0,0 +1,22 @@
+<?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>
+ <!-- The duration (in milliseconds) of activity transitions -->
+ <integer name="sudTransitionDuration">450</integer>
+
+</resources> \ No newline at end of file
diff --git a/main/res/values-v31/styles.xml b/main/res/values-v31/styles.xml
index a9fbade..deaea16 100644
--- a/main/res/values-v31/styles.xml
+++ b/main/res/values-v31/styles.xml
@@ -29,10 +29,46 @@
</style>
<style name="SudFullDynamicColorThemeGlifV3" parent="SudDynamicColorThemeGlifV3">
+ <item name="android:windowBackground">@android:color/system_neutral1_900</item>
+ <item name="android:colorForeground">@android:color/system_neutral1_50</item>
+ <item name="android:colorForegroundInverse">@android:color/system_neutral1_900</item>
+ <item name="android:colorBackground">@android:color/system_neutral1_900</item>
+ <item name="android:colorBackgroundCacheHint">@android:color/system_neutral1_900</item>
+ <item name="colorBackgroundFloating">@android:color/system_neutral1_900</item>
+
+ <item name="android:textColorPrimary">@color/sud_system_primary_text</item>
+ <item name="android:textColorSecondary">@color/sud_system_secondary_text</item>
+ <item name="android:textColorTertiary">@color/sud_system_tertiary_text_inactive</item>
+ <item name="android:textColorPrimaryDisableOnly">@color/sud_system_tertiary_text_inactive</item>
+ <item name="android:textColorPrimaryInverseDisableOnly">@color/sud_system_tertiary_text_inactive</item>
+
+ <item name="colorControlNormal">?android:attr/textColorSecondary</item>
+ <item name="colorControlHighlight">@color/ripple_material_dark</item>
+ <item name="colorButtonNormal">@color/button_material_dark</item>
+ <item name="colorSwitchThumbNormal">@color/switch_thumb_material_dark</item>
+
<item name="sucFullDynamicColor">true</item>
</style>
<style name="SudFullDynamicColorThemeGlifV3.Light" parent="SudDynamicColorThemeGlifV3.Light">
+ <item name="android:windowBackground">@android:color/system_neutral1_50</item>
+ <item name="android:colorForeground">@android:color/system_neutral1_900</item>
+ <item name="android:colorForegroundInverse">@android:color/system_neutral1_50</item>
+ <item name="android:colorBackground">@android:color/system_neutral1_50</item>
+ <item name="android:colorBackgroundCacheHint">@@android:color/system_neutral1_50</item>
+ <item name="colorBackgroundFloating">@android:color/system_neutral1_50</item>
+ <item name="android:navigationBarColor">@android:color/system_neutral1_50</item>
+
+ <item name="android:textColorPrimary">@color/sud_system_primary_text</item>
+ <item name="android:textColorSecondary">@color/sud_system_secondary_text</item>
+ <item name="android:textColorTertiary">@color/sud_system_tertiary_text_inactive</item>
+ <item name="android:textColorPrimaryDisableOnly">@color/sud_system_tertiary_text_inactive</item>
+
+ <item name="colorControlNormal">?android:attr/textColorSecondary</item>
+ <item name="colorControlHighlight">@color/ripple_material_light</item>
+ <item name="colorButtonNormal">@color/button_material_light</item>
+ <item name="colorSwitchThumbNormal">@color/switch_thumb_material_light</item>
+
<item name="sucFullDynamicColor">true</item>
</style>
</resources> \ No newline at end of file
diff --git a/main/res/values/attrs.xml b/main/res/values/attrs.xml
index bd2902c..c946912 100644
--- a/main/res/values/attrs.xml
+++ b/main/res/values/attrs.xml
@@ -251,4 +251,12 @@
<attr name="sudUseBottomProgressBar" format="boolean" />
</declare-styleable>
+ <declare-styleable name="SudGlifLoadingFramePadding">
+ <attr name="sudLoadingContentFramePaddingTop" format="dimension|reference" />
+ <attr name="sudLoadingContentFramePaddingStart" format="dimension|reference" />
+ <attr name="sudLoadingContentFramePaddingEnd" format="dimension|reference" />
+ <attr name="sudLoadingContentFramePaddingBottom" format="dimension|reference" />
+ </declare-styleable>
+
+ <attr name="sudLoadingHeaderHeight" format="dimension|reference" />
</resources>
diff --git a/main/res/values/colors.xml b/main/res/values/colors.xml
index 736cd91..b8a1497 100644
--- a/main/res/values/colors.xml
+++ b/main/res/values/colors.xml
@@ -18,6 +18,7 @@
<resources>
<!-- General colors -->
+
<color name="sud_color_accent_dark">#ff448aff</color>
<color name="sud_color_accent_light">#ff3367d6</color>
<color name="sud_color_background_dark">#ff303030</color>
@@ -34,6 +35,7 @@
<color name="sud_flat_button_highlight">#1f000000</color>
<!-- Navigation bar colors -->
+
<color name="sud_navbar_bg_dark">#ff21272b</color>
<color name="sud_navbar_bg_light">#ffe4e7e9</color>
@@ -57,36 +59,110 @@
<color name="sud_glif_window_bg_light_color">#ffffffff</color>
<!-- Color for error text -->
+
<color name="sud_color_error_text_dark">#fff28b82</color>
+
<color name="sud_color_error_text_light">#ffd93025</color>
-
- <!-- Default color-->
+
<color name="sud_dynamic_color_accent_glif_v3_dark">@color/sud_color_accent_glif_v3_dark</color>
<color name="sud_dynamic_color_accent_glif_v3_light">@color/sud_color_accent_glif_v3_light</color>
+
+ <color name="system_accent1_200">#71D8C7</color>
+ <!-- Shade of the accent system color at 40% lightness.
+ This value can be overlaid at runtime by OverlayManager RROs. -->
+ <color name="system_accent1_600">#006C5F</color>
+
+
<color name="system_accent2_0">#ffffff</color>
+
<color name="system_accent2_50">#CDFAF1</color>
+
<color name="system_accent2_100">#BFEBE3</color>
+
<color name="system_accent2_200">#A4CFC7</color>
+
<color name="system_accent2_300">#89B4AC</color>
+
<color name="system_accent2_400">#6F9991</color>
+
<color name="system_accent2_500">#537C75</color>
+
<color name="system_accent2_600">#3D665F</color>
+
<color name="system_accent2_700">#254E47</color>
+
<color name="system_accent2_800">#0C3731</color>
+
<color name="system_accent2_900">#00211C</color>
+
<color name="system_accent2_1000">#000000</color>
+
<color name="error_color_device_default_dark">#ec928e</color>
- <color name="error_color_device_default_light">#b3261e</color>
-
- <color name="system_primary_text">#202124</color>
- <color name="system_secondary_text">#5F6368</color>
- <color name="system_disable_option">#DADCE0</color>
- <color name="system_error_warning">#D93025</color>
- <color name="system_success_done">#1E8E3E</color>
- <color name="system_fallback_accent">#1A73E8</color>
- <color name="system_accent_primary">@color/system_accent2_600</color>
+
+ <color name="error_color_device_default_light">#E22518</color>
+
+ <color name="success_color_device_default_dark">#5BB974</color>
+
+ <color name="success_color_device_default_light">#1E8E3E</color>
+
+ <color name="fallback_color_device_default_dark">#669DF6</color>
+
+ <color name="fallback_color_device_default_light">#1A73E8</color>
+
+ <color name="primary_text_color_device_default_dark">#EDF2EB</color>
+
+ <color name="primary_text_color_device_default_light">#181C14</color>
+
+ <color name="secondary_text_color_device_default_dark">#C4C9BC</color>
+
+ <color name="secondary_text_color_device_default_light">#43483F</color>
+
+ <color name="tertiary_text_inactive_color_device_default_dark">#8D9287</color>
+
+ <color name="tertiary_text_inactive_color_device_default_light">#72776C</color>
+
+ <color name="background_surface_color_device_default_dark">#1B1D19</color>
+
+ <color name="background_surface_color_device_default_light">#F1F1EB</color>
+
+ <color name="accent_icon_text_color_device_default_dark">#9FD67C</color>
+
+ <color name="accent_icon_text_color_device_default_light">#3A691E</color>
+
+ <color name="button_surface_color_device_default">#BAF396</color>
+
+ <color name="button_text_color_device_default">#1B1D19</color>
+
+ <color name="dividing_line_color_device_default_dark">#43483F</color>
+
+ <color name="dividing_line_color_device_default_light">#A7ACA0</color>
+
+
+ <color name="sud_system_primary_text">@color/primary_text_color_device_default_light</color>
+
+ <color name="sud_system_secondary_text">@color/secondary_text_color_device_default_light</color>
+
+ <color name="sud_system_tertiary_text_inactive">@color/tertiary_text_inactive_color_device_default_light</color>
+
+ <color name="sud_system_error_warning">@color/error_color_device_default_light</color>
+
+ <color name="sud_system_success_done">@color/success_color_device_default_light</color>
+
+ <color name="sud_system_fallback_accent">@color/fallback_color_device_default_light</color>
+
+ <color name="sud_system_background_surface">@color/background_surface_color_device_default_light</color>
+
+ <color name="sud_system_accent_icon_text_button">@color/accent_icon_text_color_device_default_light</color>
+
+ <color name="sud_system_button_surface">@color/button_surface_color_device_default</color>
+
+ <color name="sud_system_button_text">@color/button_text_color_device_default</color>
+
+ <color name="sud_system_dividing_line">@color/dividing_line_color_device_default_light</color>
+
+ <color name="sud_system_accent_primary">@color/system_accent2_600</color>
</resources>
diff --git a/main/res/values/dimens.xml b/main/res/values/dimens.xml
index 4bbd079..5bdf41f 100644
--- a/main/res/values/dimens.xml
+++ b/main/res/values/dimens.xml
@@ -42,6 +42,7 @@
<dimen name="sud_glif_v3_button_corner_radius">4dp</dimen>
<dimen name="sud_glif_land_header_area_weight">1</dimen>
<dimen name="sud_glif_land_content_area_weight">1</dimen>
+ <dimen name="sud_glif_land_middle_horizontal_spacing">48dp</dimen>
<!-- Content styles -->
<dimen name="sud_check_box_line_spacing_extra">4sp</dimen>
@@ -75,6 +76,14 @@
<dimen name="sud_content_illustration_min_width">172dp</dimen>
<dimen name="sud_content_illustration_padding_vertical">24dp</dimen>
+ <!-- Loading content styles -->
+ <dimen name="sud_content_loading_frame_padding_top">0dp</dimen>
+ <dimen name="sud_content_loading_frame_padding_start">40dp</dimen>
+ <dimen name="sud_content_loading_frame_padding_end">40dp</dimen>
+ <dimen name="sud_content_loading_frame_padding_bottom">144dp</dimen>
+
+ <dimen name="sud_loading_header_height">274dp</dimen>
+
<!-- Glif Content info text -->
<dimen name="sud_content_info_text_size">16sp</dimen>
<dimen name="sud_content_info_line_spacing_extra">3sp</dimen>
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml
index 2702359..42a2574 100644
--- a/main/res/values/styles.xml
+++ b/main/res/values/styles.xml
@@ -45,6 +45,10 @@
<item name="sudCardBackground">@drawable/sud_card_bg_dark</item>
<item name="sudContentFramePaddingTop">@dimen/sud_content_frame_padding_top</item>
<item name="sudContentFramePaddingBottom">@dimen/sud_content_frame_padding_bottom</item>
+ <item name="sudLoadingContentFramePaddingTop">@dimen/sud_content_loading_frame_padding_top</item>
+ <item name="sudLoadingContentFramePaddingStart">@dimen/sud_content_loading_frame_padding_start</item>
+ <item name="sudLoadingContentFramePaddingEnd">@dimen/sud_content_loading_frame_padding_end</item>
+ <item name="sudLoadingContentFramePaddingBottom">@dimen/sud_content_loading_frame_padding_bottom</item>
<item name="sudDividerInsetEnd">0dp</item>
<item name="sudDividerInsetStart">@dimen/sud_items_icon_divider_inset</item>
<item name="sudDividerInsetStartNoIcon">@dimen/sud_items_text_divider_inset</item>
@@ -59,6 +63,7 @@
<item name="sudContentIllustrationMaxHeight">@dimen/sud_content_illustration_max_height</item>
<item name="sudContentIllustrationPaddingTop">@dimen/sud_content_illustration_padding_vertical</item>
<item name="sudContentIllustrationPaddingBottom">@dimen/sud_content_illustration_padding_vertical</item>
+ <item name="sudLoadingHeaderHeight">@dimen/sud_loading_header_height</item>
</style>
<style name="SudThemeMaterial.Light" parent="Theme.AppCompat.Light.NoActionBar">
@@ -87,6 +92,10 @@
<item name="sudCardBackground">@drawable/sud_card_bg_light</item>
<item name="sudContentFramePaddingTop">@dimen/sud_content_frame_padding_top</item>
<item name="sudContentFramePaddingBottom">@dimen/sud_content_frame_padding_bottom</item>
+ <item name="sudLoadingContentFramePaddingTop">@dimen/sud_content_loading_frame_padding_top</item>
+ <item name="sudLoadingContentFramePaddingStart">@dimen/sud_content_loading_frame_padding_start</item>
+ <item name="sudLoadingContentFramePaddingEnd">@dimen/sud_content_loading_frame_padding_end</item>
+ <item name="sudLoadingContentFramePaddingBottom">@dimen/sud_content_loading_frame_padding_bottom</item>
<item name="sudDividerInsetEnd">0dp</item>
<item name="sudDividerInsetStart">@dimen/sud_items_icon_divider_inset</item>
<item name="sudDividerInsetStartNoIcon">@dimen/sud_items_text_divider_inset</item>
@@ -101,6 +110,7 @@
<item name="sudContentIllustrationMaxHeight">@dimen/sud_content_illustration_max_height</item>
<item name="sudContentIllustrationPaddingTop">@dimen/sud_content_illustration_padding_vertical</item>
<item name="sudContentIllustrationPaddingBottom">@dimen/sud_content_illustration_padding_vertical</item>
+ <item name="sudLoadingHeaderHeight">@dimen/sud_loading_header_height</item>
</style>
<style name="SudBaseThemeGlif" parent="Theme.AppCompat.NoActionBar">
@@ -132,6 +142,10 @@
<item name="sudColorPrimary">?attr/colorPrimary</item>
<item name="sudContentFramePaddingTop">@dimen/sud_content_frame_padding_top</item>
<item name="sudContentFramePaddingBottom">@dimen/sud_content_frame_padding_bottom</item>
+ <item name="sudLoadingContentFramePaddingTop">@dimen/sud_content_loading_frame_padding_top</item>
+ <item name="sudLoadingContentFramePaddingStart">@dimen/sud_content_loading_frame_padding_start</item>
+ <item name="sudLoadingContentFramePaddingEnd">@dimen/sud_content_loading_frame_padding_end</item>
+ <item name="sudLoadingContentFramePaddingBottom">@dimen/sud_content_loading_frame_padding_bottom</item>
<item name="sudFillContentLayoutStyle">@style/SudFillContentLayout</item>
<item name="sudDividerInsetEnd">0dp</item>
<item name="sudDividerInsetStart">@dimen/sud_items_glif_icon_divider_inset</item>
@@ -172,6 +186,7 @@
<item name="sudContentIllustrationMaxHeight">@dimen/sud_content_illustration_max_height</item>
<item name="sudContentIllustrationPaddingTop">@dimen/sud_content_illustration_padding_vertical</item>
<item name="sudContentIllustrationPaddingBottom">@dimen/sud_content_illustration_padding_vertical</item>
+ <item name="sudLoadingHeaderHeight">@dimen/sud_loading_header_height</item>
</style>
<style name="SudThemeGlif" parent="SudBaseThemeGlif"/>
@@ -204,6 +219,10 @@
<item name="sudColorPrimary">?attr/colorPrimary</item>
<item name="sudContentFramePaddingTop">@dimen/sud_content_frame_padding_top</item>
<item name="sudContentFramePaddingBottom">@dimen/sud_content_frame_padding_bottom</item>
+ <item name="sudLoadingContentFramePaddingTop">@dimen/sud_content_loading_frame_padding_top</item>
+ <item name="sudLoadingContentFramePaddingStart">@dimen/sud_content_loading_frame_padding_start</item>
+ <item name="sudLoadingContentFramePaddingEnd">@dimen/sud_content_loading_frame_padding_end</item>
+ <item name="sudLoadingContentFramePaddingBottom">@dimen/sud_content_loading_frame_padding_bottom</item>
<item name="sudFillContentLayoutStyle">@style/SudFillContentLayout</item>
<item name="sudDividerInsetEnd">0dp</item>
<item name="sudDividerInsetStart">@dimen/sud_items_glif_icon_divider_inset</item>
@@ -244,6 +263,7 @@
<item name="sudContentIllustrationMaxHeight">@dimen/sud_content_illustration_max_height</item>
<item name="sudContentIllustrationPaddingTop">@dimen/sud_content_illustration_padding_vertical</item>
<item name="sudContentIllustrationPaddingBottom">@dimen/sud_content_illustration_padding_vertical</item>
+ <item name="sudLoadingHeaderHeight">@dimen/sud_loading_header_height</item>
</style>
<style name="SudThemeGlif.Light" parent="SudBaseThemeGlif.Light"/>
@@ -338,6 +358,14 @@
<item name="android:paddingBottom">?attr/sudContentFramePaddingBottom</item>
</style>
+ <style name="SudLoadingContentFrame" tools:ignore="UnusedResources">
+ <item name="android:clipToPadding">false</item>
+ <item name="android:paddingTop">?attr/sudLoadingContentFramePaddingTop</item>
+ <item name="android:paddingLeft">?attr/sudLoadingContentFramePaddingStart</item>
+ <item name="android:paddingRight">?attr/sudLoadingContentFramePaddingEnd</item>
+ <item name="android:paddingBottom">?attr/sudLoadingContentFramePaddingBottom</item>
+ </style>
+
<!-- Content info -->
<style name="SudInfoContainer">
diff --git a/main/src/com/google/android/setupdesign/GlifLayout.java b/main/src/com/google/android/setupdesign/GlifLayout.java
index dc84c71..c9e159e 100644
--- a/main/src/com/google/android/setupdesign/GlifLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifLayout.java
@@ -154,6 +154,7 @@ public class GlifLayout extends PartnerCustomizationLayout {
applyPartnerCustomizationContentPaddingTopStyle(view);
}
}
+ updateLandscapeMiddleHorizontalSpacing();
ColorStateList backgroundColor =
a.getColorStateList(R.styleable.SudGlifLayout_sudBackgroundBaseColor);
@@ -192,6 +193,66 @@ public class GlifLayout extends PartnerCustomizationLayout {
}
}
+ protected void updateLandscapeMiddleHorizontalSpacing() {
+ int horizontalSpacing =
+ getResources().getDimensionPixelSize(R.dimen.sud_glif_land_middle_horizontal_spacing);
+
+ View headerView = this.findManagedViewById(R.id.sud_landscape_header_area);
+ if (headerView != null) {
+ if (PartnerConfigHelper.get(getContext())
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_END)) {
+ int layoutMarginEnd =
+ (int)
+ PartnerConfigHelper.get(getContext())
+ .getDimension(getContext(), PartnerConfig.CONFIG_LAYOUT_MARGIN_END);
+
+ int paddingEnd = (horizontalSpacing / 2) - layoutMarginEnd;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ headerView.setPadding(
+ headerView.getPaddingStart(),
+ headerView.getPaddingTop(),
+ paddingEnd,
+ headerView.getPaddingBottom());
+ } else {
+ headerView.setPadding(
+ headerView.getPaddingLeft(),
+ headerView.getPaddingTop(),
+ paddingEnd,
+ headerView.getPaddingBottom());
+ }
+ }
+ }
+
+ View contentView = this.findManagedViewById(R.id.sud_landscape_content_area);
+ if (contentView != null) {
+ if (PartnerConfigHelper.get(getContext())
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) {
+ int layoutMarginStart =
+ (int)
+ PartnerConfigHelper.get(getContext())
+ .getDimension(getContext(), PartnerConfig.CONFIG_LAYOUT_MARGIN_START);
+
+ int paddingStart = 0;
+ if (headerView != null) {
+ paddingStart = (horizontalSpacing / 2) - layoutMarginStart;
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ contentView.setPadding(
+ paddingStart,
+ contentView.getPaddingTop(),
+ contentView.getPaddingEnd(),
+ contentView.getPaddingBottom());
+ } else {
+ contentView.setPadding(
+ paddingStart,
+ contentView.getPaddingTop(),
+ contentView.getPaddingRight(),
+ contentView.getPaddingBottom());
+ }
+ }
+ }
+ }
+
@Override
protected View onInflateTemplate(LayoutInflater inflater, @LayoutRes int template) {
if (template == 0) {
@@ -303,6 +364,7 @@ public class GlifLayout extends PartnerCustomizationLayout {
} else {
view.setVisibility(View.GONE);
}
+ updateLandscapeMiddleHorizontalSpacing();
}
/**
diff --git a/main/src/com/google/android/setupdesign/GlifListLayout.java b/main/src/com/google/android/setupdesign/GlifListLayout.java
index 740b2af..60f0343 100644
--- a/main/src/com/google/android/setupdesign/GlifListLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifListLayout.java
@@ -78,6 +78,7 @@ public class GlifListLayout extends GlifLayout {
if (view != null) {
applyPartnerCustomizationContentPaddingTopStyle(view);
}
+ updateLandscapeMiddleHorizontalSpacing();
}
@Override
diff --git a/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java b/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java
index 973f388..5e75436 100644
--- a/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java
@@ -79,6 +79,7 @@ public class GlifRecyclerLayout extends GlifLayout {
if (view != null) {
applyPartnerCustomizationContentPaddingTopStyle(view);
}
+ updateLandscapeMiddleHorizontalSpacing();
}
@Override
diff --git a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
index d1f038b..d681d9f 100644
--- a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
+++ b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
@@ -58,6 +58,7 @@ public final class DynamicColorPalette {
case ColorType.ACCENT:
colorRes = R.color.sud_dynamic_color_accent_glif_v3;
break;
+ // TODO: Add testcase for getColor attributes.
case ColorType.PRIMARY_TEXT:
colorRes = R.color.sud_system_primary_text;
break;
@@ -65,7 +66,7 @@ public final class DynamicColorPalette {
colorRes = R.color.sud_system_secondary_text;
break;
case ColorType.DISABLED_OPTION:
- colorRes = R.color.sud_system_disable_option;
+ colorRes = R.color.sud_system_tertiary_text_inactive;
break;
case ColorType.ERROR_WARNING:
colorRes = R.color.sud_system_error_warning;
diff --git a/main/src/com/google/android/setupdesign/util/PartnerStyleHelper.java b/main/src/com/google/android/setupdesign/util/PartnerStyleHelper.java
index 2cde29e..d6eade8 100644
--- a/main/src/com/google/android/setupdesign/util/PartnerStyleHelper.java
+++ b/main/src/com/google/android/setupdesign/util/PartnerStyleHelper.java
@@ -20,7 +20,6 @@ import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
-import androidx.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import com.google.android.setupcompat.PartnerCustomizationLayout;
@@ -35,6 +34,7 @@ import java.util.Locale;
/** The helper reads styles from the partner configurations. */
public final class PartnerStyleHelper {
+ private static final String TAG = "PartnerStyleHelper";
/**
* Returns the partner configuration of layout gravity, usually apply to widgets in header area.
*/
@@ -120,39 +120,6 @@ public final class PartnerStyleHelper {
return isSetupFlow || usePartnerResource;
}
- /** Returns {@code true} if the dynamic color is set. */
- static boolean trySetDynamicColor(@NonNull Context context, boolean isDayNightEnabled) {
- if (!PartnerConfigHelper.shouldApplyDynamicColor(context)) {
- return false;
- }
-
- Activity activity = null;
- try {
- activity = PartnerCustomizationLayout.lookupActivityFromContext(context);
- } catch (IllegalArgumentException ex) {
- return false;
- }
-
- // try best to get partner resource settings from attrs
- boolean isSetupFlow = WizardManagerHelper.isAnySetupWizard(activity.getIntent());
-
- if (isSetupFlow) {
- // apply theme for inside setup flow
- activity.setTheme(
- isDayNightEnabled
- ? R.style.SudDynamicColorThemeGlifV3_DayNight
- : R.style.SudDynamicColorThemeGlifV3_Light);
- } else {
- // apply theme for outside setup flow
- activity.setTheme(
- isDayNightEnabled
- ? R.style.SudFullDynamicColorThemeGlifV3_DayNight
- : R.style.SudFullDynamicColorThemeGlifV3_Light);
- }
-
- return true;
- }
-
/**
* Returns if the current layout/activity applies heavy partner customized configurations or not.
*
diff --git a/main/src/com/google/android/setupdesign/util/ThemeHelper.java b/main/src/com/google/android/setupdesign/util/ThemeHelper.java
index 6852aa4..32c8e5e 100644
--- a/main/src/com/google/android/setupdesign/util/ThemeHelper.java
+++ b/main/src/com/google/android/setupdesign/util/ThemeHelper.java
@@ -20,12 +20,19 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
+import android.util.Log;
+import androidx.annotation.StyleRes;
+import com.google.android.setupcompat.PartnerCustomizationLayout;
import com.google.android.setupcompat.partnerconfig.PartnerConfigHelper;
import com.google.android.setupcompat.util.WizardManagerHelper;
+import com.google.android.setupdesign.R;
+import java.util.Objects;
/** The helper class holds the constant names of themes and util functions */
public final class ThemeHelper {
+ private static final String TAG = "ThemeHelper";
+
/**
* Passed in a setup wizard intent as {@link WizardManagerHelper#EXTRA_THEME}. This is the dark
* variant of the theme used in setup wizard for Nougat MR1.
@@ -158,15 +165,90 @@ public final class ThemeHelper {
return PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context);
}
- /** Returns {@code true} if the partner provider of SetupWizard is ready to dynamic color. */
+ /**
+ * Returns {@code true} if the partner provider of SetupWizard is ready to support dynamic color.
+ */
+ public static boolean isSetupWizardDynamicColorEnabled(@NonNull Context context) {
+ return PartnerConfigHelper.isSetupWizardDynamicColorEnabled(context);
+ }
+
+ /** Returns {@code true} if this {@code context} should apply dynamic color. */
public static boolean shouldApplyDynamicColor(@NonNull Context context) {
- return PartnerConfigHelper.shouldApplyDynamicColor(context);
+ return shouldApplyExtendedPartnerConfig(context) && isSetupWizardDynamicColorEnabled(context);
+ }
+
+ /**
+ * Returns a theme resource id if the {@link com.google.android.setupdesign.GlifLayout} should
+ * apply dynamic color.
+ *
+ * <p>Otherwise returns {@code 0}.
+ */
+ @StyleRes
+ public static int getDynamicColorTheme(@NonNull Context context) {
+ @StyleRes int resId = 0;
+
+ Activity activity;
+ try {
+ activity = PartnerCustomizationLayout.lookupActivityFromContext(context);
+ } catch (IllegalArgumentException ex) {
+ Log.e(TAG, Objects.requireNonNull(ex.getMessage()));
+ return resId;
+ }
+
+ boolean isSetupFlow = WizardManagerHelper.isAnySetupWizard(activity.getIntent());
+ boolean isDayNightEnabled = isSetupWizardDayNightEnabled(context);
+
+ if (isSetupFlow) {
+ // return theme for inside setup flow
+ resId =
+ isDayNightEnabled
+ ? R.style.SudDynamicColorThemeGlifV3_DayNight
+ : R.style.SudDynamicColorThemeGlifV3_Light;
+ } else {
+ // return theme for outside setup flow
+ resId =
+ isDayNightEnabled
+ ? R.style.SudFullDynamicColorThemeGlifV3_DayNight
+ : R.style.SudFullDynamicColorThemeGlifV3_Light;
+ Log.i(
+ TAG,
+ "Return "
+ + (isDayNightEnabled
+ ? "SudFullDynamicColorThemeGlifV3_DayNight"
+ : "SudFullDynamicColorThemeGlifV3_Light"));
+ }
+
+ return resId;
}
/** Returns {@code true} if the dynamic color is set. */
public static boolean trySetDynamicColor(@NonNull Context context) {
- return shouldApplyExtendedPartnerConfig(context)
- && PartnerStyleHelper.trySetDynamicColor(context, isSetupWizardDayNightEnabled(context));
+ if (!shouldApplyExtendedPartnerConfig(context)) {
+ Log.w(TAG, "SetupWizard does not supports the extended partner configs.");
+ return false;
+ }
+
+ if (!isSetupWizardDynamicColorEnabled(context)) {
+ Log.w(TAG, "SetupWizard does not support the dynamic color or supporting status unknown.");
+ return false;
+ }
+
+ Activity activity;
+ try {
+ activity = PartnerCustomizationLayout.lookupActivityFromContext(context);
+ } catch (IllegalArgumentException ex) {
+ Log.e(TAG, Objects.requireNonNull(ex.getMessage()));
+ return false;
+ }
+
+ if (getDynamicColorTheme(context) != 0) {
+ activity.setTheme(getDynamicColorTheme(context));
+ } else {
+ Log.w(TAG, "Error occurred on getting dynamic color theme.");
+ return false;
+ }
+
+ return true;
}
private ThemeHelper() {}