Import updated Android Setupdesign Library 444422216
Copied from google3/third_party/java_src/android_libs/setupdesign
Test: mm
Bug: 230266991
Included changes:
- 444422216 Set partner configs to dimension name of design library
- 442786567 Create a theme that make the autofilled background to fit...
- 441912580 Update icon and container colors for Tortal modules accor...
- 441138276 Only set margin on the content area, and other set the pa...
- 440813206 Set partner configs to dimension name instead of numerica...
- 440811223 Fix the margin start error when partner config margin les...
- 440035323 Not using a constructed instance will soon be a compile e...
- 438705462 Add the targetAPI check for the attribute fontFamily
PiperOrigin-RevId: 444422216
Change-Id: I451fee54f44cdd4d957bcb7d248b208263e94746
diff --git a/Android.bp b/Android.bp
index 4d416d3..2cc13f0 100644
--- a/Android.bp
+++ b/Android.bp
@@ -34,6 +34,7 @@
"androidx.appcompat_appcompat",
"androidx.recyclerview_recyclerview",
"com.google.android.material_material",
+ "error_prone_annotations",
"setupcompat",
"setupdesign-strings",
],
diff --git a/main/res/drawable/sud_autofilled_highlight_mn_bg.xml b/main/res/drawable/sud_autofilled_highlight_mn_bg.xml
new file mode 100644
index 0000000..f2a57a4
--- /dev/null
+++ b/main/res/drawable/sud_autofilled_highlight_mn_bg.xml
@@ -0,0 +1,21 @@
+<?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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="@color/sud_autofilled_highlight_bg_color"/>
+ <corners android:radius="@dimen/sud_edit_text_corner_radius"/>
+</shape>
\ No newline at end of file
diff --git a/main/res/values-land-v31/dimens.xml b/main/res/values-land-v31/dimens.xml
index aa9358f..5accbbd 100644
--- a/main/res/values-land-v31/dimens.xml
+++ b/main/res/values-land-v31/dimens.xml
@@ -28,7 +28,7 @@
<dimen name="sud_glif_header_title_margin_bottom">0dp</dimen>
<dimen name="sud_glif_description_margin_top">8dp</dimen>
<dimen name="sud_glif_icon_margin_top">32dp</dimen>
- <dimen name="sud_glif_footer_min_height">52dp</dimen>
+ <dimen name="sud_glif_footer_bar_min_height">52dp</dimen>
<dimen name="sud_glif_content_padding_top">32dp</dimen>
</resources>
diff --git a/main/res/values-land/dimens.xml b/main/res/values-land/dimens.xml
index ca31ed0..9b74b4f 100644
--- a/main/res/values-land/dimens.xml
+++ b/main/res/values-land/dimens.xml
@@ -19,7 +19,7 @@
<!-- General -->
<dimen name="sud_glif_button_min_height">36dp</dimen>
- <dimen name="sud_glif_footer_min_height">52dp</dimen>
+ <dimen name="sud_glif_footer_bar_min_height">52dp</dimen>
<dimen name="sud_glif_footer_padding_vertical">0dp</dimen>
<!-- Card layout (for tablets) -->
@@ -45,6 +45,9 @@
<dimen name="sud_content_loading_frame_padding_end">0dp</dimen>
<dimen name="sud_content_loading_frame_padding_bottom">24dp</dimen>
+ <!-- General Material You -->
+ <dimen name="sud_glif_content_padding_top_material_you">32dp</dimen>
+
<!-- Page Margins Material You -->
<dimen name="sud_glif_margin_start_material_you">32dp</dimen>
<dimen name="sud_glif_margin_end_material_you">32dp</dimen>
diff --git a/main/res/values-sw600dp-land-v31/dimens.xml b/main/res/values-sw600dp-land-v31/dimens.xml
index ed4486c..da43b3b 100644
--- a/main/res/values-sw600dp-land-v31/dimens.xml
+++ b/main/res/values-sw600dp-land-v31/dimens.xml
@@ -33,4 +33,7 @@
<dimen name="sud_items_glif_icon_divider_inset">96dp</dimen>
<dimen name="sud_items_glif_text_divider_inset">48dp</dimen>
+ <!-- Footer Button-->
+ <dimen name="sud_glif_primary_button_button_margin_start">24dp</dimen>
+
</resources>
diff --git a/main/res/values-sw600dp-land/dimens.xml b/main/res/values-sw600dp-land/dimens.xml
index 571574d..aa70031 100644
--- a/main/res/values-sw600dp-land/dimens.xml
+++ b/main/res/values-sw600dp-land/dimens.xml
@@ -23,9 +23,17 @@
<!-- Illustration -->
<item name="sud_illustration_aspect_ratio" format="float" type="dimen">0.0</item>
+ <!-- General Material You -->
+ <dimen name="sud_glif_land_middle_horizontal_spacing_material_you">76dp</dimen>
+ <dimen name="sud_glif_content_padding_top_material_you">96dp</dimen>
+
<!-- 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 Button Material You-->
+ <dimen name="sud_glif_primary_button_button_margin_start_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">32dp</dimen>
diff --git a/main/res/values-sw600dp-v31/dimens.xml b/main/res/values-sw600dp-v31/dimens.xml
index 1151033..fd9215e 100644
--- a/main/res/values-sw600dp-v31/dimens.xml
+++ b/main/res/values-sw600dp-v31/dimens.xml
@@ -30,7 +30,7 @@
<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_footer_bar_min_height">72dp</dimen>
<dimen name="sud_glif_content_padding_top">0dp</dimen>
<dimen name="sud_header_title_size">24sp</dimen>
diff --git a/main/res/values-sw600dp/dimens.xml b/main/res/values-sw600dp/dimens.xml
index 032ec7a..16c77ec 100644
--- a/main/res/values-sw600dp/dimens.xml
+++ b/main/res/values-sw600dp/dimens.xml
@@ -42,13 +42,24 @@
<dimen name="sud_items_glif_icon_divider_inset">88dp</dimen>
<dimen name="sud_items_glif_text_divider_inset">40dp</dimen>
+ <!-- General Material You -->
+ <dimen name="sud_glif_content_padding_top_material_you">0dp</dimen>
+
+ <!-- Items Material You -->
+ <dimen name="sud_items_summary_text_size_material_you">16sp</dimen>
+
<!-- Page Margins Material You -->
<dimen name="sud_glif_margin_start_material_you">120dp</dimen>
<dimen name="sud_glif_margin_end_material_you">120dp</dimen>
+
+ <!-- Footer Button Material You-->
+ <dimen name="sud_glif_primary_button_button_margin_start_material_you">24dp</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 2ee51e8..1ed67df 100644
--- a/main/res/values-v31/colors.xml
+++ b/main/res/values-v31/colors.xml
@@ -44,6 +44,10 @@
+ <color name="sud_system_accent2_100">@android:color/system_accent2_100</color>
+
+
+
<color name="sud_system_neutral1_0">@android:color/system_neutral1_0</color>
<color name="sud_system_neutral1_10">@android:color/system_neutral1_10</color>
diff --git a/main/res/values/colors.xml b/main/res/values/colors.xml
index 70936e4..75fd097 100644
--- a/main/res/values/colors.xml
+++ b/main/res/values/colors.xml
@@ -79,6 +79,10 @@
+ <color name="sud_system_accent2_100">#FFE8DEF8</color>
+
+
+
<color name="sud_system_neutral1_0">#ffffff</color>
<color name="sud_system_neutral1_10">#f0f0f0</color>
@@ -175,4 +179,6 @@
<color name="sud_uniformity_backdrop_color">@android:color/white</color>
+
+ <color name="sud_autofilled_highlight_bg_color">#4dffeb3b</color>
</resources>
diff --git a/main/res/values/dimens.xml b/main/res/values/dimens.xml
index 242c370..4b821a4 100644
--- a/main/res/values/dimens.xml
+++ b/main/res/values/dimens.xml
@@ -48,7 +48,7 @@
<dimen name="sud_glif_footer_padding_start">8dp</dimen>
<!-- Calculated by (sud_glif_margin_end - 4dp internal padding of button) -->
<dimen name="sud_glif_footer_padding_end">20dp</dimen>
- <dimen name="sud_glif_footer_min_height">72dp</dimen>
+ <dimen name="sud_glif_footer_bar_min_height">72dp</dimen>
<dimen name="sud_glif_margin_start">24dp</dimen>
<dimen name="sud_glif_margin_end">24dp</dimen>
<dimen name="sud_glif_icon_margin_top">56dp</dimen>
@@ -160,6 +160,11 @@
<!-- Illustration -->
<item name="sud_illustration_aspect_ratio" format="float" type="dimen">2.22</item>
+ <!-- Footer Button-->
+ <dimen name="sud_glif_footer_button_text_size">14dp</dimen>
+ <dimen name="sud_glif_primary_button_button_margin_start">0dp</dimen>
+ <dimen name="sud_glif_secondary_button_button_margin_start">0dp</dimen>
+
<!-- Items -->
<dimen name="sud_items_icon_container_width">48dp</dimen>
<!-- TODO: Remove it when all attributes being used migrated into new one. -->
@@ -171,12 +176,36 @@
<dimen name="sud_items_padding_top">15dp</dimen>
<dimen name="sud_items_padding_bottom">15dp</dimen>
+ <!-- General Material You -->
+ <dimen name="sud_glif_land_middle_horizontal_spacing_material_you">48dp</dimen>
+ <dimen name="sud_glif_content_padding_top_material_you">8dp</dimen>
+
+ <!-- Content styles Material You -->
+ <dimen name="sud_content_text_size_material_you">18sp</dimen>
+
+ <!-- Glif Content info text Material You -->
+ <dimen name="sud_content_info_text_size_material_you">16sp</dimen>
+ <dimen name="sud_content_info_line_spacing_extra_material_you">8sp</dimen>
+ <dimen name="sud_content_info_icon_size_material_you">18dp</dimen>
+ <dimen name="sud_content_info_icon_margin_end_material_you">16dp</dimen>
+ <dimen name="sud_content_info_padding_top_material_you">16dp</dimen>
+ <dimen name="sud_content_info_padding_bottom_material_you">16dp</dimen>
+
+ <!-- Header layout Material You (for phones) -->
+ <dimen name="sud_header_title_max_size_material_you">36sp</dimen>
+ <dimen name="sud_header_title_min_size_material_you">28sp</dimen>
+ <dimen name="sud_header_title_line_spacing_extra_material_you">8sp</dimen>
+
<!-- Page Margins Material You -->
<dimen name="sud_glif_margin_start_material_you">40dp</dimen>
<dimen name="sud_glif_margin_end_material_you">24dp</dimen>
<!-- Footer Button Material You-->
<dimen name="sud_footer_bar_button_radius_material_you">20dp</dimen>
+ <dimen name="sud_glif_button_min_height_material_you">48dp</dimen>
+ <dimen name="sud_glif_footer_button_text_size_material_you">14dp</dimen>
+
+ <dimen name="sud_glif_primary_button_button_margin_start_material_you">0dp</dimen>
<!-- Footer Bar Material You -->
<dimen name="sud_glif_footer_bar_padding_vertical_material_you">6dp</dimen>
@@ -205,6 +234,10 @@
<dimen name="sud_items_summary_margin_top_material_you">4dp</dimen>
<dimen name="sud_items_min_height_material_you">72dp</dimen>
+ <!-- Progress bar -->
+ <dimen name="sud_progress_bar_margin_top_material_you">16dp</dimen>
+ <dimen name="sud_progress_bar_margin_bottom_material_you">-7dp</dimen>
+
<!-- Ignore UnusedResources: can be used by clients -->
<dimen name="sud_items_icon_divider_inset" tools:ignore="UnusedResources">88dp</dimen>
<!-- Ignore UnusedResources: can be used by clients -->
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml
index 7dd96db..d675c62 100644
--- a/main/res/values/styles.xml
+++ b/main/res/values/styles.xml
@@ -199,7 +199,7 @@
<item name="sucFooterBarPaddingVertical">@dimen/sud_glif_footer_padding_vertical</item>
<item name="sucFooterBarPaddingStart">@dimen/sud_glif_footer_padding_start</item>
<item name="sucFooterBarPaddingEnd">@dimen/sud_glif_footer_padding_end</item>
- <item name="sucFooterBarMinHeight">@dimen/sud_glif_footer_min_height</item>
+ <item name="sucFooterBarMinHeight">@dimen/sud_glif_footer_bar_min_height</item>
<item name="sucFooterButtonPaddingStart">@dimen/sud_glif_button_padding</item>
<item name="sucFooterButtonPaddingEnd">@dimen/sud_glif_button_padding</item>
<item name="sudContentIllustrationMaxWidth">@dimen/sud_content_illustration_max_width</item>
@@ -292,7 +292,7 @@
<item name="sucFooterBarPaddingVertical">@dimen/sud_glif_footer_padding_vertical</item>
<item name="sucFooterBarPaddingStart">@dimen/sud_glif_footer_padding_start</item>
<item name="sucFooterBarPaddingEnd">@dimen/sud_glif_footer_padding_end</item>
- <item name="sucFooterBarMinHeight">@dimen/sud_glif_footer_min_height</item>
+ <item name="sucFooterBarMinHeight">@dimen/sud_glif_footer_bar_min_height</item>
<item name="sucFooterButtonPaddingStart">@dimen/sud_glif_button_padding</item>
<item name="sucFooterButtonPaddingEnd">@dimen/sud_glif_button_padding</item>
<item name="sudContentIllustrationMaxWidth">@dimen/sud_content_illustration_max_width</item>
@@ -467,6 +467,10 @@
<style name="SudDynamicColorTheme.DayNight" parent="SudDynamicColorTheme.Light" />
<style name="SudFullDynamicColorTheme.DayNight" parent="SudFullDynamicColorTheme.Light" />
+ <!-- Text Field AutoFilled theme -->
+ <style name="SudTextFieldAutoFilledTheme">
+ <item name="android:autofilledHighlight" tools:targetApi="26">@drawable/sud_autofilled_highlight_mn_bg</item>
+ </style>
<style name="Animation.SudWindowAnimation" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/sud_slide_next_in</item>
@@ -728,7 +732,7 @@
<item name="android:clipChildren">false</item>
<item name="android:clipToPadding">false</item>
<item name="android:gravity">center_vertical</item>
- <item name="android:minHeight">@dimen/sud_glif_footer_min_height</item>
+ <item name="android:minHeight">@dimen/sud_glif_footer_bar_min_height</item>
<item name="android:orientation">horizontal</item>
<item name="android:paddingTop">@dimen/sud_glif_footer_padding_vertical</item>
<item name="android:paddingBottom">@dimen/sud_glif_footer_padding_vertical</item>
diff --git a/main/src/com/google/android/setupdesign/template/HeaderMixin.java b/main/src/com/google/android/setupdesign/template/HeaderMixin.java
index 96f9f67..814f873 100644
--- a/main/src/com/google/android/setupdesign/template/HeaderMixin.java
+++ b/main/src/com/google/android/setupdesign/template/HeaderMixin.java
@@ -41,6 +41,7 @@
import com.google.android.setupdesign.util.HeaderAreaStyler;
import com.google.android.setupdesign.util.LayoutStyler;
import com.google.android.setupdesign.util.PartnerStyleHelper;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
/**
* A {@link com.google.android.setupcompat.template.Mixin} for setting and getting the header text.
@@ -62,6 +63,7 @@
* @param attrs XML attributes given to the layout
* @param defStyleAttr The default style attribute as given to the constructor of the layout
*/
+ @CanIgnoreReturnValue
public HeaderMixin(
@NonNull TemplateLayout layout, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
templateLayout = layout;
diff --git a/main/src/com/google/android/setupdesign/util/LayoutStyler.java b/main/src/com/google/android/setupdesign/util/LayoutStyler.java
index a50dfb1..b377327 100644
--- a/main/src/com/google/android/setupdesign/util/LayoutStyler.java
+++ b/main/src/com/google/android/setupdesign/util/LayoutStyler.java
@@ -21,6 +21,8 @@
import android.content.res.TypedArray;
import android.os.Build.VERSION_CODES;
import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.LinearLayout.LayoutParams;
import androidx.annotation.Nullable;
import com.google.android.setupcompat.partnerconfig.PartnerConfig;
import com.google.android.setupcompat.partnerconfig.PartnerConfigHelper;
@@ -119,8 +121,8 @@
if (partnerMarginStartAvailable) {
extraPaddingStart =
((int)
- PartnerConfigHelper.get(context)
- .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_START))
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_START))
- layoutMarginStart;
} else {
extraPaddingStart = view.getPaddingStart();
@@ -129,20 +131,38 @@
if (partnerMarginEndAvailable) {
extraPaddingEnd =
((int)
- PartnerConfigHelper.get(context)
- .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_END))
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_END))
- layoutMarginEnd;
+ // If the view is a content view, padding start and padding end will be the same.
+ if (view.getId() == R.id.sud_layout_content) {
+ extraPaddingEnd =
+ ((int)
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_START))
+ - layoutMarginEnd;
+ }
} else {
extraPaddingEnd = view.getPaddingEnd();
+ // If the view is a content view, padding start and padding end will be the same.
+ if (view.getId() == R.id.sud_layout_content) {
+ extraPaddingEnd = view.getPaddingStart();
+ }
}
if (extraPaddingStart != view.getPaddingStart() || extraPaddingEnd != view.getPaddingEnd()) {
- // If the view is a content view, padding start and padding end will be the same.
- view.setPadding(
- extraPaddingStart,
- view.getPaddingTop(),
- view.getId() == R.id.sud_layout_content ? extraPaddingStart : extraPaddingEnd,
- view.getPaddingBottom());
+ if (view.getId() == R.id.sud_layout_content) {
+ // The sud_layout_content is framelayout.
+ // The framelayout background maybe infected by this change.
+ // Currently the content background is same as the activity background, and there is no
+ // partner config to customize it.
+ LinearLayout.LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
+ layoutParams.setMargins(
+ extraPaddingStart, view.getPaddingTop(), extraPaddingEnd, view.getPaddingBottom());
+ } else {
+ view.setPadding(
+ extraPaddingStart, view.getPaddingTop(), extraPaddingEnd, view.getPaddingBottom());
+ }
}
}
}