summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSetup Wizard Team <android-setup-team-eng@google.com>2022-03-22 11:08:21 +0800
committerCn Chen <cnchen@google.com>2022-03-22 03:43:02 +0000
commit74bcb93675ea2ab9f55531706cf88b2f7f48991d (patch)
treed315880d3874f112b254853ecc1127923ccae17e
parent84983c34f8a9982d416fa495cade79c6282c6722 (diff)
downloadsetupdesign-74bcb93675ea2ab9f55531706cf88b2f7f48991d.tar.gz
Import updated Android Setupdesign Library 436370329
Copied from google3/third_party/java_src/android_libs/setupdesign Test: mm Bug: 224400917 Bug: 218793525 Included changes: - 436370329 Support colorSurface - 435297888 Correct the margin start. - 435242662 Automated g4 rollback of changelist 434627664. - 434989715 Fix the ratio division. - 434932870 Move the new color scheme to v33 to avoid color different... - 434627664 Change SudItemContainer.Description.Glif padding to align... - 434407141 Automated g4 rollback of changelist 390404031. - 433734045 [SetupDesign] update default value for Glifv4 - Footer ba... - 433651694 Automated g4 rollback of changelist 431614278. PiperOrigin-RevId: 436370329 Change-Id: I917b3f173800e22fbb5944aa97e5c27baa8bd474
-rw-r--r--main/res/values-land/dimens.xml6
-rw-r--r--main/res/values-night-v31/colors.xml11
-rw-r--r--main/res/values-night-v33/colors.xml25
-rw-r--r--main/res/values-sw600dp-land/dimens.xml6
-rw-r--r--main/res/values-sw600dp-v31/dimens.xml23
-rw-r--r--main/res/values-sw600dp/dimens.xml14
-rw-r--r--main/res/values-v31/colors.xml15
-rw-r--r--main/res/values-v31/styles.xml9
-rw-r--r--main/res/values-v33/colors.xml24
-rw-r--r--main/res/values-v33/styles.xml25
-rw-r--r--main/res/values/colors.xml4
-rw-r--r--main/res/values/dimens.xml14
-rw-r--r--main/res/values/styles.xml8
-rw-r--r--main/src/com/google/android/setupdesign/util/ContentStyler.java4
-rw-r--r--main/src/com/google/android/setupdesign/util/DynamicColorPalette.java15
-rw-r--r--main/src/com/google/android/setupdesign/util/LayoutStyler.java22
16 files changed, 162 insertions, 63 deletions
diff --git a/main/res/values-land/dimens.xml b/main/res/values-land/dimens.xml
index dfdc5b2..ca31ed0 100644
--- a/main/res/values-land/dimens.xml
+++ b/main/res/values-land/dimens.xml
@@ -48,5 +48,11 @@
<!-- Page Margins Material You -->
<dimen name="sud_glif_margin_start_material_you">32dp</dimen>
<dimen name="sud_glif_margin_end_material_you">32dp</dimen>
+ <!-- Footer Bar Material You -->
+ <dimen name="sud_glif_footer_bar_padding_vertical_material_you">0dp</dimen>
+ <dimen name="sud_glif_footer_bar_padding_start_material_you">16dp</dimen>
+ <!-- Calculated by (sud_glif_margin_end - 4dp internal padding of button) -->
+ <dimen name="sud_glif_footer_bar_padding_end_material_you">28dp</dimen>
+ <dimen name="sud_glif_footer_bar_min_height_material_you">52dp</dimen>
</resources>
diff --git a/main/res/values-night-v31/colors.xml b/main/res/values-night-v31/colors.xml
index 76e2b2b..cd2a6d5 100644
--- a/main/res/values-night-v31/colors.xml
+++ b/main/res/values-night-v31/colors.xml
@@ -20,15 +20,16 @@
<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_0</color>
- <color name="sud_system_secondary_text">@color/sud_system_neutral1_200</color>
- <color name="sud_system_tertiary_text_inactive">@color/sud_system_neutral1_300</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_error_warning">@color/sud_error_warning_default_dark</color>
- <color name="sud_system_background_surface">@color/sud_system_neutral1_1000</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_100</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_neutral1_600</color>
+ <color name="sud_system_dividing_line">@color/sud_system_neutral2_300</color>
<color name="sud_system_hyperlink_text">@color/sud_system_accent1_300</color>
+ <color name="sud_system_surface">@color/sud_system_neutral1_800</color>
</resources> \ No newline at end of file
diff --git a/main/res/values-night-v33/colors.xml b/main/res/values-night-v33/colors.xml
new file mode 100644
index 0000000..79ed31a
--- /dev/null
+++ b/main/res/values-night-v33/colors.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 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>
+
+ <color name="sud_system_primary_text">@color/sud_system_neutral1_0</color>
+ <color name="sud_system_secondary_text">@color/sud_system_neutral1_200</color>
+ <color name="sud_system_tertiary_text_inactive">@color/sud_system_neutral1_300</color>
+ <color name="sud_system_background_surface">@color/sud_system_neutral1_1000</color>
+ <color name="sud_system_dividing_line">@color/sud_system_neutral1_600</color>
+</resources> \ No newline at end of file
diff --git a/main/res/values-sw600dp-land/dimens.xml b/main/res/values-sw600dp-land/dimens.xml
index b9bae55..571574d 100644
--- a/main/res/values-sw600dp-land/dimens.xml
+++ b/main/res/values-sw600dp-land/dimens.xml
@@ -26,5 +26,11 @@
<!-- Page Margins Material You -->
<dimen name="sud_glif_margin_start_material_you">48dp</dimen>
<dimen name="sud_glif_margin_end_material_you">48dp</dimen>
+ <!-- Footer Bar Material You -->
+ <dimen name="sud_glif_footer_bar_padding_vertical_material_you">6dp</dimen>
+ <dimen name="sud_glif_footer_bar_padding_start_material_you">32dp</dimen>
+ <!-- Calculated by (sud_glif_margin_end - 4dp internal padding of button) -->
+ <dimen name="sud_glif_footer_bar_padding_end_material_you">44dp</dimen>
+ <dimen name="sud_glif_footer_bar_min_height_material_you">72dp</dimen>
</resources>
diff --git a/main/res/values-sw600dp-v31/dimens.xml b/main/res/values-sw600dp-v31/dimens.xml
index 556b872..1151033 100644
--- a/main/res/values-sw600dp-v31/dimens.xml
+++ b/main/res/values-sw600dp-v31/dimens.xml
@@ -19,27 +19,22 @@
<!-- General -->
<!-- Calculated by (sud_glif_margin_start - 4dp internal padding of button) -->
- <dimen name="sud_glif_button_margin_end">60dp</dimen>
+ <dimen name="sud_glif_button_margin_end">92dp</dimen>
<!-- Calculated by (sud_glif_margin_start - sud_glif_button_padding) -->
- <dimen name="sud_glif_button_margin_start">48dp</dimen>
+ <dimen name="sud_glif_button_margin_start">80dp</dimen>
<!-- Calculated by (sud_glif_margin_start - sud_glif_button_padding) -->
- <dimen name="sud_glif_footer_padding_start">48dp</dimen>
+ <dimen name="sud_glif_footer_padding_start">80dp</dimen>
<!-- Calculated by (sud_glif_margin_end - 4dp internal padding of button) -->
- <dimen name="sud_glif_footer_padding_end">60dp</dimen>
- <!-- Default margins start/end are 96dp in portrait mode for the large screen. However, If here
- set this value, it cannot be overwrited by a smaller value from partner config. So here
- set to 64dp and rewritten to 96dp through partner config the partner config
- "setup_design_layout_margin_start" & "setup_design_layout_margin_end" for glifv3 default
- margins. -->
- <!-- TODO: b/221404901 to remove this limitation -->
- <dimen name="sud_glif_margin_start">64dp</dimen>
- <dimen name="sud_glif_margin_end">64dp</dimen>
+ <dimen name="sud_glif_footer_padding_end">92dp</dimen>
+
+ <dimen name="sud_glif_margin_start">96dp</dimen>
+ <dimen name="sud_glif_margin_end">96dp</dimen>
<dimen name="sud_glif_footer_min_height">72dp</dimen>
<dimen name="sud_glif_content_padding_top">0dp</dimen>
<dimen name="sud_header_title_size">24sp</dimen>
- <dimen name="sud_items_glif_icon_divider_inset">112dp</dimen>
- <dimen name="sud_items_glif_text_divider_inset">64dp</dimen>
+ <dimen name="sud_items_glif_icon_divider_inset">144dp</dimen>
+ <dimen name="sud_items_glif_text_divider_inset">96dp</dimen>
</resources>
diff --git a/main/res/values-sw600dp/dimens.xml b/main/res/values-sw600dp/dimens.xml
index 388507e..032ec7a 100644
--- a/main/res/values-sw600dp/dimens.xml
+++ b/main/res/values-sw600dp/dimens.xml
@@ -43,14 +43,12 @@
<dimen name="sud_items_glif_text_divider_inset">40dp</dimen>
<!-- Page Margins Material You -->
- <!-- Default margins start/end are 120dp in portrait mode for the large screen. However, If here
- set this value, it cannot be overwrited by a smaller value from partner config. So here
- set to 64dp and rewritten to 120dp through partner config the partner config
- "setup_design_layout_margin_start" & "setup_design_layout_margin_end" for glifv4 default
- margins. -->
- <!-- TODO: b/221404901 to remove this limitation -->
- <dimen name="sud_glif_margin_start_material_you">64dp</dimen>
- <dimen name="sud_glif_margin_end_material_you">64dp</dimen>
+ <dimen name="sud_glif_margin_start_material_you">120dp</dimen>
+ <dimen name="sud_glif_margin_end_material_you">120dp</dimen>
+ <!-- Footer Bar Material You -->
+ <dimen name="sud_glif_footer_bar_padding_start_material_you">104dp</dimen>
+ <!-- Calculated by (sud_glif_margin_end - 4dp internal padding of button) -->
+ <dimen name="sud_glif_footer_bar_padding_end_material_you">116dp</dimen>
<!-- Header Area Material You -->
<dimen name="sud_glif_header_title_size_material_you">44sp</dimen>
<dimen name="sud_glif_icon_margin_top_material_you">24dp</dimen>
diff --git a/main/res/values-v31/colors.xml b/main/res/values-v31/colors.xml
index 07298d1..2ee51e8 100644
--- a/main/res/values-v31/colors.xml
+++ b/main/res/values-v31/colors.xml
@@ -46,6 +46,8 @@
<color name="sud_system_neutral1_0">@android:color/system_neutral1_0</color>
+ <color name="sud_system_neutral1_10">@android:color/system_neutral1_10</color>
+
<color name="sud_system_neutral1_50">@android:color/system_neutral1_50</color>
<color name="sud_system_neutral1_200">@android:color/system_neutral1_200</color>
@@ -84,15 +86,16 @@
<color name="sud_system_primary_text">@color/sud_system_neutral1_900</color>
- <color name="sud_system_secondary_text">@color/sud_system_neutral1_700</color>
- <color name="sud_system_tertiary_text_inactive">@color/sud_system_neutral1_600</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_error_warning">@color/sud_error_warning_default_light</color>
- <color name="sud_system_background_surface">@color/sud_system_neutral1_0</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_600</color>
- <color name="sud_system_button_text">@color/sud_system_neutral1_50</color>
- <color name="sud_system_dividing_line">@color/sud_system_neutral1_500</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>
<color name="sud_system_hyperlink_text">@color/sud_system_accent1_600</color>
+ <color name="sud_system_surface">@color/sud_system_neutral1_50</color>
<color name="sud_dynamic_switch_thumb_off_light">@color/sud_system_neutral2_300</color>
diff --git a/main/res/values-v31/styles.xml b/main/res/values-v31/styles.xml
index 7e59aa5..df86de7 100644
--- a/main/res/values-v31/styles.xml
+++ b/main/res/values-v31/styles.xml
@@ -17,7 +17,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Main theme for dynamic color -->
- <style name="SudDynamicColorTheme">
+ <style name="SudDynamicColorBaseTheme">
<item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_dark</item>
<item name="android:textColorLink">@color/sud_system_hyperlink_text</item>
<item name="alertDialogTheme">@style/SudDynamicColorAlertDialogThemeCompat</item>
@@ -31,7 +31,7 @@
<item name="sudEditBoxColor">@color/sud_dynamic_color_accent_glif_v3_dark</item>
</style>
- <style name="SudDynamicColorTheme.Light">
+ <style name="SudDynamicColorBaseTheme.Light">
<item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_light</item>
<item name="android:textColorLink">@color/sud_system_hyperlink_text</item>
<item name="alertDialogTheme">@style/SudDynamicColorAlertDialogThemeCompat.Light</item>
@@ -45,6 +45,9 @@
<item name="sudEditBoxColor">@color/sud_dynamic_color_accent_glif_v3_light</item>
</style>
+ <style name="SudDynamicColorTheme" parent="SudDynamicColorBaseTheme"/>
+ <style name="SudDynamicColorTheme.Light" parent="SudDynamicColorBaseTheme.Light"/>
+
<style name="SudFullDynamicColorTheme" parent="SudDynamicColorTheme">
<item name="android:windowBackground">@color/sud_system_background_surface</item>
<item name="android:colorForeground">@android:color/system_neutral1_50</item>
@@ -126,7 +129,7 @@
<style name="SudFullDynamicColorThemeGlifV3" parent="SudDynamicColorThemeGlifV3">
<item name="android:windowBackground">@color/sud_system_background_surface</item>
- <item name="android:colorForeground">@android:color/system_neutral1_0</item>
+ <item name="android:colorForeground">@android:color/system_neutral1_50</item>
<item name="android:colorForegroundInverse">@color/sud_system_background_surface</item>
<item name="android:colorBackground">@color/sud_system_background_surface</item>
<item name="android:colorBackgroundCacheHint">@color/sud_system_background_surface</item>
diff --git a/main/res/values-v33/colors.xml b/main/res/values-v33/colors.xml
index 92422db..c46c6fc 100644
--- a/main/res/values-v33/colors.xml
+++ b/main/res/values-v33/colors.xml
@@ -1,4 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 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>
+
+ <color name="sud_system_secondary_text">@color/sud_system_neutral1_700</color>
+ <color name="sud_system_tertiary_text_inactive">@color/sud_system_neutral1_600</color>
+ <color name="sud_system_background_surface">@color/sud_system_neutral1_0</color>
+ <color name="sud_system_button_surface">@color/sud_system_accent1_600</color>
+ <color name="sud_system_dividing_line">@color/sud_system_neutral1_500</color>
+
<color name="sud_glif_v3_nav_bar_divider_color_light">@android:color/transparent</color>
</resources>
diff --git a/main/res/values-v33/styles.xml b/main/res/values-v33/styles.xml
new file mode 100644
index 0000000..5d02f04
--- /dev/null
+++ b/main/res/values-v33/styles.xml
@@ -0,0 +1,25 @@
+<?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>
+ <style name="SudDynamicColorTheme" parent="SudDynamicColorBaseTheme">
+ <item name="colorSurface">@color/sud_system_surface</item>
+ </style>
+
+ <style name="SudDynamicColorTheme.Light" parent="SudDynamicColorBaseTheme.Light">
+ <item name="colorSurface">@color/sud_system_surface</item>
+ </style>
+</resources> \ No newline at end of file
diff --git a/main/res/values/colors.xml b/main/res/values/colors.xml
index 5fbdd9a..70936e4 100644
--- a/main/res/values/colors.xml
+++ b/main/res/values/colors.xml
@@ -73,12 +73,16 @@
<color name="sud_system_accent1_200">#71D8C7</color>
+ <color name="sud_system_accent1_300">#53BCAC</color>
+
<color name="sud_system_accent1_600">#006C5F</color>
<color name="sud_system_neutral1_0">#ffffff</color>
+ <color name="sud_system_neutral1_10">#f0f0f0</color>
+
<color name="sud_system_neutral1_50">#f0f0f0</color>
<color name="sud_system_neutral1_200">#c6c6c6</color>
diff --git a/main/res/values/dimens.xml b/main/res/values/dimens.xml
index db585be..02f9444 100644
--- a/main/res/values/dimens.xml
+++ b/main/res/values/dimens.xml
@@ -172,14 +172,14 @@
<dimen name="sud_items_padding_bottom">15dp</dimen>
<!-- Page Margins Material You -->
- <!-- Default margins start are 40dp in portrait mode for the large screen. However, If here
- set this value, it cannot be overwrited by a smaller value from partner config. So here
- set to 24dp and rewritten to 40dp through partner config the partner config
- "setup_design_layout_margin_start" for glifv4 default margins. -->
- <!-- TODO: b/221404901 to remove this limitation -->
- <dimen name="sud_glif_margin_start_material_you">24dp</dimen>
+ <dimen name="sud_glif_margin_start_material_you">40dp</dimen>
<dimen name="sud_glif_margin_end_material_you">24dp</dimen>
-
+ <!-- Footer Bar Material You -->
+ <dimen name="sud_glif_footer_bar_padding_vertical_material_you">6dp</dimen>
+ <dimen name="sud_glif_footer_bar_padding_start_material_you">8dp</dimen>
+ <!-- Calculated by (sud_glif_margin_end - 4dp internal padding of button) -->
+ <dimen name="sud_glif_footer_bar_padding_end_material_you">20dp</dimen>
+ <dimen name="sud_glif_footer_bar_min_height_material_you">72dp</dimen>
<!-- Header Area Material You -->
<dimen name="sud_header_container_margin_bottom_material_you">24dp</dimen>
<dimen name="sud_glif_header_title_size_material_you">36sp</dimen>
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml
index eaee5ae..078a6ea 100644
--- a/main/res/values/styles.xml
+++ b/main/res/values/styles.xml
@@ -378,6 +378,10 @@
<style name="SudThemeGlifV4" parent="SudThemeGlifV3">
<item name="sudMarginStart">@dimen/sud_glif_margin_start_material_you</item>
+ <item name="sucFooterBarPaddingVertical">@dimen/sud_glif_footer_bar_padding_vertical_material_you</item>
+ <item name="sucFooterBarPaddingStart">@dimen/sud_glif_footer_bar_padding_start_material_you</item>
+ <item name="sucFooterBarPaddingEnd">@dimen/sud_glif_footer_bar_padding_end_material_you</item>
+ <item name="sucFooterBarMinHeight">@dimen/sud_glif_footer_bar_min_height_material_you</item>
<item name="sudMarginEnd">@dimen/sud_glif_margin_end_material_you</item>
<item name="sucHeaderContainerMarginBottom">@dimen/sud_header_container_margin_bottom_material_you</item>
<item name="sucGlifIconMarginTop">@dimen/sud_glif_icon_margin_top_material_you</item>
@@ -401,6 +405,10 @@
<style name="SudThemeGlifV4.Light" parent="SudThemeGlifV3.Light">
<item name="sudMarginStart">@dimen/sud_glif_margin_start_material_you</item>
+ <item name="sucFooterBarPaddingVertical">@dimen/sud_glif_footer_bar_padding_vertical_material_you</item>
+ <item name="sucFooterBarPaddingStart">@dimen/sud_glif_footer_bar_padding_start_material_you</item>
+ <item name="sucFooterBarPaddingEnd">@dimen/sud_glif_footer_bar_padding_end_material_you</item>
+ <item name="sucFooterBarMinHeight">@dimen/sud_glif_footer_bar_min_height_material_you</item>
<item name="sudMarginEnd">@dimen/sud_glif_margin_end_material_you</item>
<item name="sucHeaderContainerMarginBottom">@dimen/sud_header_container_margin_bottom_material_you</item>
<item name="sucGlifIconMarginTop">@dimen/sud_glif_icon_margin_top_material_you</item>
diff --git a/main/src/com/google/android/setupdesign/util/ContentStyler.java b/main/src/com/google/android/setupdesign/util/ContentStyler.java
index ef365e3..5fc1d1c 100644
--- a/main/src/com/google/android/setupdesign/util/ContentStyler.java
+++ b/main/src/com/google/android/setupdesign/util/ContentStyler.java
@@ -137,7 +137,9 @@ public final class ContentStyler {
(int)
PartnerConfigHelper.get(context)
.getDimension(context, PartnerConfig.CONFIG_CONTENT_INFO_ICON_SIZE);
- lp.width = lp.width * (lp.height / oldHeight);
+ // The scale ratio is lp.height/oldHeight, but the lp.height and oldHeight are all integer type.
+ // The division between integer will loss the decimal part, so need to do multiple first.
+ lp.width = lp.width * lp.height / oldHeight;
infoIcon.setScaleType(ScaleType.FIT_CENTER);
}
diff --git a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
index 654f927..ad66cb6 100644
--- a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
+++ b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
@@ -26,8 +26,6 @@ import java.lang.annotation.RetentionPolicy;
/** The class to get dynamic colors. */
public final class DynamicColorPalette {
- private static int colorRes = 0;
-
private DynamicColorPalette() {}
/** Dynamic color category. */
@@ -40,7 +38,8 @@ public final class DynamicColorPalette {
ColorType.ERROR_WARNING,
ColorType.SUCCESS_DONE,
ColorType.FALLBACK_ACCENT,
- ColorType.BACKGROUND_SURFACE,
+ ColorType.BACKGROUND,
+ ColorType.SURFACE,
})
public @interface ColorType {
int ACCENT = 0;
@@ -50,11 +49,14 @@ public final class DynamicColorPalette {
int ERROR_WARNING = 4;
int SUCCESS_DONE = 5;
int FALLBACK_ACCENT = 6;
- int BACKGROUND_SURFACE = 7;
+ int BACKGROUND = 7;
+ int SURFACE = 8;
}
@ColorInt
public static int getColor(Context context, @ColorType int dynamicColorCategory) {
+ int colorRes = 0;
+
switch (dynamicColorCategory) {
case ColorType.ACCENT:
colorRes = R.color.sud_dynamic_color_accent_glif_v3;
@@ -77,9 +79,12 @@ public final class DynamicColorPalette {
case ColorType.FALLBACK_ACCENT:
colorRes = R.color.sud_system_fallback_accent;
break;
- case ColorType.BACKGROUND_SURFACE:
+ case ColorType.BACKGROUND:
colorRes = R.color.sud_system_background_surface;
break;
+ case ColorType.SURFACE:
+ colorRes = R.color.sud_system_surface;
+ break;
// fall out
}
diff --git a/main/src/com/google/android/setupdesign/util/LayoutStyler.java b/main/src/com/google/android/setupdesign/util/LayoutStyler.java
index b910601..a50dfb1 100644
--- a/main/src/com/google/android/setupdesign/util/LayoutStyler.java
+++ b/main/src/com/google/android/setupdesign/util/LayoutStyler.java
@@ -16,8 +16,6 @@
package com.google.android.setupdesign.util;
-import static java.lang.Math.max;
-
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
@@ -120,24 +118,20 @@ public final class LayoutStyler {
if (partnerMarginStartAvailable) {
extraPaddingStart =
- max(
- 0,
- ((int)
- PartnerConfigHelper.get(context)
- .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_START))
- - layoutMarginStart);
+ ((int)
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_START))
+ - layoutMarginStart;
} else {
extraPaddingStart = view.getPaddingStart();
}
if (partnerMarginEndAvailable) {
extraPaddingEnd =
- max(
- 0,
- ((int)
- PartnerConfigHelper.get(context)
- .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_END))
- - layoutMarginEnd);
+ ((int)
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_END))
+ - layoutMarginEnd;
} else {
extraPaddingEnd = view.getPaddingEnd();
}