Snap for 8564071 from 99ef7c38f304896d8b60d71f496db6f43c1a97cc to mainline-sdkext-release
Change-Id: Ie398287483f06e9e945ffb49a9401cde6ddc4cfc
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/OWNERS b/OWNERS
index 11d6750..3381026 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,11 +1,11 @@
-ajayns@google.com
alexylli@google.com
catinglin@google.com
cnchen@google.com
cyrillee@google.com
-justinklaassen@google.com
nicolehuang@google.com
pastychang@google.com
pihuei@google.com
prochinwang@google.com
-yukl@google.com
+
+cipson@google.com #{LAST_RESORT_SUGGESTION}
+luyota@google.com #{LAST_RESORT_SUGGESTION}
diff --git a/exempting_lint_checks.txt b/exempting_lint_checks.txt
index 201fd64..949488a 100644
--- a/exempting_lint_checks.txt
+++ b/exempting_lint_checks.txt
@@ -47,3 +47,45 @@
third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/NavigationBar.java: ResourceType: @StyleableRes int colorForeground = 1;
third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/StickyHeaderListView.java: CustomViewStyleable: .obtainStyledAttributes(attrs, R.styleable.SudStickyHeaderListView, defStyleAttr, 0);
third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/StickyHeaderScrollView.java: ObsoleteSdkInt: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/GlifLayout.java: CustomViewStyleable: getContext().obtainStyledAttributes(attrs, R.styleable.SudGlifLayout, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/SetupWizardLayout.java: CustomViewStyleable: .obtainStyledAttributes(attrs, R.styleable.SudSetupWizardLayout, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/items/RecyclerItemAdapter.java: NotifyDataSetChanged: notifyDataSetChanged();
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/util/Partner.java: DiscouragedApi: return resources.getIdentifier(name, defType, packageName);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/FillContentLayout.java: CustomViewStyleable: context.obtainStyledAttributes(attrs, R.styleable.SudFillContentLayout, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/HeaderRecyclerView.java: CustomViewStyleable: .obtainStyledAttributes(attrs, R.styleable.SudHeaderRecyclerView, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/HeaderRecyclerView.java: NotifyDataSetChanged: notifyDataSetChanged();
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/IconUniformityAppImageView.java: AnnotateVersionCheck: private static final boolean ON_L_PLUS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/Illustration.java: CustomViewStyleable: getContext().obtainStyledAttributes(attrs, R.styleable.SudIllustration, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/IllustrationVideoView.java: CustomViewStyleable: context.obtainStyledAttributes(attrs, R.styleable.SudIllustrationVideoView);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/IntrinsicSizeFrameLayout.java: CustomViewStyleable: attrs, R.styleable.SudIntrinsicSizeFrameLayout, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/NavigationBar.java: ResourceType: @StyleableRes int colorBackground = 2;
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/NavigationBar.java: ResourceType: @StyleableRes int colorForeground = 1;
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/RichTextView.java: DiscouragedApi: .getIdentifier(textAppearance, "style", context.getPackageName());
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/StickyHeaderListView.java: CustomViewStyleable: .obtainStyledAttributes(attrs, R.styleable.SudStickyHeaderListView, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/StickyHeaderScrollView.java: ObsoleteSdkInt: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/GlifLayout.java: CustomViewStyleable: getContext().obtainStyledAttributes(attrs, R.styleable.SudGlifLayout, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/GlifLayout.java: NewApi: LayoutStyler.applyPartnerCustomizationExtraPaddingStyle(view);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/GlifLayout.java: NewApi: tryApplyPartnerCustomizationContentPaddingTopStyle(view);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/GlifListLayout.java: NewApi: tryApplyPartnerCustomizationContentPaddingTopStyle(view);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java: NewApi: tryApplyPartnerCustomizationContentPaddingTopStyle(view);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/SetupWizardLayout.java: CustomViewStyleable: .obtainStyledAttributes(attrs, R.styleable.SudSetupWizardLayout, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/items/ExpandableSwitchItem.java: NewApi: LayoutStyler.applyPartnerCustomizationLayoutPaddingStyle(content);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/items/Item.java: NewApi: ItemStyler.applyPartnerCustomizationItemStyle(view);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/items/Item.java: NewApi: LayoutStyler.applyPartnerCustomizationLayoutPaddingStyle(view);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/items/RecyclerItemAdapter.java: NotifyDataSetChanged: notifyDataSetChanged();
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/template/HeaderMixin.java: NewApi: LayoutStyler.applyPartnerCustomizationExtraPaddingStyle(headerAreaView);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/util/Partner.java: DiscouragedApi: return resources.getIdentifier(name, defType, packageName);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java: NewApi: ((RichTextView) textView).setSpanTypeface(linkFont);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/FillContentLayout.java: CustomViewStyleable: context.obtainStyledAttributes(attrs, R.styleable.SudFillContentLayout, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/HeaderRecyclerView.java: CustomViewStyleable: .obtainStyledAttributes(attrs, R.styleable.SudHeaderRecyclerView, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/HeaderRecyclerView.java: NotifyDataSetChanged: notifyDataSetChanged();
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/IconUniformityAppImageView.java: AnnotateVersionCheck: private static final boolean ON_L_PLUS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/Illustration.java: CustomViewStyleable: getContext().obtainStyledAttributes(attrs, R.styleable.SudIllustration, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/IllustrationVideoView.java: CustomViewStyleable: context.obtainStyledAttributes(attrs, R.styleable.SudIllustrationVideoView);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/IntrinsicSizeFrameLayout.java: CustomViewStyleable: attrs, R.styleable.SudIntrinsicSizeFrameLayout, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/NavigationBar.java: ResourceType: @StyleableRes int colorBackground = 2;
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/NavigationBar.java: ResourceType: @StyleableRes int colorForeground = 1;
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/RichTextView.java: DiscouragedApi: .getIdentifier(textAppearance, "style", context.getPackageName());
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/RichTextView.java: NewApi: text = getRichText(getContext(), text);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/StickyHeaderListView.java: CustomViewStyleable: .obtainStyledAttributes(attrs, R.styleable.SudStickyHeaderListView, defStyleAttr, 0);
+third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupdesign/view/StickyHeaderScrollView.java: ObsoleteSdkInt: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
diff --git a/lottie_loading_layout/AndroidManifest.xml b/lottie_loading_layout/AndroidManifest.xml
index 3cf1948..3053930 100644
--- a/lottie_loading_layout/AndroidManifest.xml
+++ b/lottie_loading_layout/AndroidManifest.xml
@@ -20,6 +20,6 @@
<uses-sdk
android:minSdkVersion="14"
- android:targetSdkVersion="30" />
+ android:targetSdkVersion="32" />
</manifest>
diff --git a/lottie_loading_layout/res/layout-land-v31/sud_glif_loading_template_content.xml b/lottie_loading_layout/res/layout-land-v31/sud_glif_loading_template_content.xml
index 65e20a9..ef0ba71 100644
--- a/lottie_loading_layout/res/layout-land-v31/sud_glif_loading_template_content.xml
+++ b/lottie_loading_layout/res/layout-land-v31/sud_glif_loading_template_content.xml
@@ -56,13 +56,13 @@
<LinearLayout
android:id="@+id/sud_landscape_content_area"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@dimen/sud_glif_land_content_area_weight"
+ style="@style/SudLandContentContianerStyle"
+ android:focusedByDefault="false"
android:orientation="vertical">
<FrameLayout
android:id="@+id/sud_layout_loading_content"
+ android:paddingTop="?attr/sudGlifContentPaddingTop"
android:layout_width="match_parent"
android:layout_height="match_parent">
diff --git a/lottie_loading_layout/res/layout-sw600dp-land-v31/sud_glif_fullscreen_loading_template_content.xml b/lottie_loading_layout/res/layout-sw600dp-land-v31/sud_glif_fullscreen_loading_template_content.xml
new file mode 100644
index 0000000..e5e1bb5
--- /dev/null
+++ b/lottie_loading_layout/res/layout-sw600dp-land-v31/sud_glif_fullscreen_loading_template_content.xml
@@ -0,0 +1,103 @@
+<?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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ViewStub
+ android:id="@+id/sud_loading_layout_lottie_stub"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:inflatedId="@+id/sud_layout_lottie_illustration"
+ android:layout="@layout/sud_loading_fullscreen_lottie_layout" />
+
+ <LinearLayout
+ android:id="@+id/sud_layout_template_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:id="@+id/sud_landscape_header_area"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="@dimen/sud_glif_land_header_area_weight"
+ android:orientation="vertical">
+
+ <ViewStub
+ android:id="@+id/sud_layout_sticky_header"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <com.google.android.setupdesign.view.BottomScrollView
+ android:id="@+id/sud_header_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:scrollIndicators="?attr/sudScrollIndicators">
+
+ <include layout="@layout/sud_glif_header" />
+
+ </com.google.android.setupdesign.view.BottomScrollView>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/sud_landscape_content_area"
+ style="@style/SudLandContentContianerStyle"
+ android:paddingTop="?attr/sudGlifContentPaddingTop"
+ android:focusedByDefault="false"
+ android:orientation="vertical">
+
+ <FrameLayout
+ android:id="@+id/sud_layout_loading_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ViewStub
+ android:id="@+id/sud_loading_layout_illustration_stub"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:inflatedId="@+id/sud_layout_progress_illustration"
+ android:layout="@layout/sud_loading_illustration_layout" />
+
+ <FrameLayout
+ android:id="@+id/sud_layout_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone" />
+
+ </FrameLayout>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <ViewStub
+ android:id="@+id/suc_layout_footer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </LinearLayout>
+
+</FrameLayout>
diff --git a/lottie_loading_layout/res/layout-sw600dp-v31/sud_glif_fullscreen_loading_template_card.xml b/lottie_loading_layout/res/layout-sw600dp-v31/sud_glif_fullscreen_loading_template_card.xml
new file mode 100644
index 0000000..8cd6af2
--- /dev/null
+++ b/lottie_loading_layout/res/layout-sw600dp-v31/sud_glif_fullscreen_loading_template_card.xml
@@ -0,0 +1,49 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/suc_layout_status"
+ style="@style/SudGlifCardBackground"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+
+ <View
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:visibility="invisible" />
+
+ <com.google.android.setupdesign.view.IntrinsicSizeFrameLayout
+ style="@style/SudGlifCardContainer"
+ android:layout_width="@dimen/sud_glif_card_width"
+ android:layout_height="wrap_content"
+ android:height="@dimen/sud_glif_card_height">
+
+ <include layout="@layout/sud_glif_fullscreen_loading_template_content" />
+
+ </com.google.android.setupdesign.view.IntrinsicSizeFrameLayout>
+
+ <View
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:visibility="invisible" />
+
+</LinearLayout>
diff --git a/lottie_loading_layout/res/layout-sw600dp-v31/sud_glif_fullscreen_loading_template_content.xml b/lottie_loading_layout/res/layout-sw600dp-v31/sud_glif_fullscreen_loading_template_content.xml
new file mode 100644
index 0000000..97f86be
--- /dev/null
+++ b/lottie_loading_layout/res/layout-sw600dp-v31/sud_glif_fullscreen_loading_template_content.xml
@@ -0,0 +1,96 @@
+<?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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ViewStub
+ android:id="@+id/sud_loading_layout_lottie_stub"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:inflatedId="@+id/sud_layout_lottie_illustration"
+ android:layout="@layout/sud_loading_fullscreen_lottie_layout" />
+
+ <LinearLayout
+ android:id="@+id/sud_layout_template_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <ViewStub
+ android:id="@+id/sud_layout_sticky_header"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <!-- Ignore UnusedAttribute: scrollIndicators is new in M. Default to no indicators in older
+ versions. -->
+ <com.google.android.setupdesign.view.BottomScrollView
+ android:id="@+id/sud_header_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/sudLoadingHeaderHeight"
+ android:fillViewport="true"
+ android:scrollIndicators="?attr/sudScrollIndicators"
+ tools:ignore="UnusedAttribute">
+
+ <include layout="@layout/sud_glif_header" />
+
+ </com.google.android.setupdesign.view.BottomScrollView>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <ViewStub
+ android:id="@+id/sud_loading_layout_illustration_stub"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:inflatedId="@+id/sud_layout_progress_illustration"
+ android:layout="@layout/sud_loading_illustration_layout" />
+
+ <FrameLayout
+ android:id="@+id/sud_layout_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone" />
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <ViewStub
+ android:id="@+id/suc_layout_footer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </LinearLayout>
+
+</FrameLayout>
diff --git a/lottie_loading_layout/res/layout-sw600dp-v31/sud_loading_fullscreen_lottie_layout.xml b/lottie_loading_layout/res/layout-sw600dp-v31/sud_loading_fullscreen_lottie_layout.xml
new file mode 100644
index 0000000..8c98e74
--- /dev/null
+++ b/lottie_loading_layout/res/layout-sw600dp-v31/sud_loading_fullscreen_lottie_layout.xml
@@ -0,0 +1,34 @@
+<?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.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <com.airbnb.lottie.LottieAnimationView
+ android:id="@+id/sud_lottie_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:importantForAccessibility="no"
+ android:layout_gravity="start|bottom"
+ android:scaleType="fitStart"
+ app:lottie_autoPlay="false"
+ app:lottie_loop="true" />
+
+</LinearLayout>
diff --git a/lottie_loading_layout/res/layout-v31/sud_glif_loading_template_content.xml b/lottie_loading_layout/res/layout-v31/sud_glif_loading_template_content.xml
index 8415324..c5d36ef 100644
--- a/lottie_loading_layout/res/layout-v31/sud_glif_loading_template_content.xml
+++ b/lottie_loading_layout/res/layout-v31/sud_glif_loading_template_content.xml
@@ -89,4 +89,4 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/lottie_loading_layout/res/layout-v31/sud_loading_illustration_layout.xml b/lottie_loading_layout/res/layout-v31/sud_loading_illustration_layout.xml
index 0f60d02..8873b42 100644
--- a/lottie_loading_layout/res/layout-v31/sud_loading_illustration_layout.xml
+++ b/lottie_loading_layout/res/layout-v31/sud_loading_illustration_layout.xml
@@ -22,18 +22,29 @@
android:layout_height="match_parent"
android:orientation="vertical">
- <ProgressBar
- android:id="@+id/sud_progress_bar"
- android:visibility="gone"
- style="@style/SudFourColorIndeterminateProgressBar"
+ <com.google.android.setupdesign.view.FillContentLayout
+ android:orientation="vertical"
+ android:paddingTop="0dp"
+ android:paddingBottom="0dp"
+ android:paddingStart="0dp"
+ android:paddingEnd="0dp"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent">
- <com.google.android.setupdesign.view.IllustrationVideoView
- android:id="@+id/sud_progress_illustration"
- android:visibility="gone"
- style="@style/SudContentIllustration"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ <ProgressBar
+ android:id="@+id/sud_progress_bar"
+ android:visibility="gone"
+ style="@style/SudFourColorIndeterminateProgressBar"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <com.google.android.setupdesign.view.IllustrationVideoView
+ android:id="@+id/sud_progress_illustration"
+ android:visibility="gone"
+ style="@style/SudContentIllustration"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </com.google.android.setupdesign.view.FillContentLayout>
</LinearLayout>
\ No newline at end of file
diff --git a/lottie_loading_layout/res/layout/sud_glif_loading_template_compat.xml b/lottie_loading_layout/res/layout/sud_glif_loading_template_compat.xml
index 86003b9..d8e9177 100644
--- a/lottie_loading_layout/res/layout/sud_glif_loading_template_compat.xml
+++ b/lottie_loading_layout/res/layout/sud_glif_loading_template_compat.xml
@@ -23,4 +23,4 @@
<include layout="@layout/sud_glif_loading_template_content" />
-</com.google.android.setupcompat.view.StatusBarBackgroundLayout>
\ No newline at end of file
+</com.google.android.setupcompat.view.StatusBarBackgroundLayout>
diff --git a/lottie_loading_layout/res/values-sw600dp-v31/layouts.xml b/lottie_loading_layout/res/values-sw600dp-v31/layouts.xml
new file mode 100644
index 0000000..f627c06
--- /dev/null
+++ b/lottie_loading_layout/res/values-sw600dp-v31/layouts.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 xmlns:tools="http://schemas.android.com/tools">
+ <item name="sud_glif_loading_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_card</item>
+ <item name="sud_glif_fullscreen_loading_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_fullscreen_loading_template_card</item>
+</resources>
diff --git a/lottie_loading_layout/res/values/layouts.xml b/lottie_loading_layout/res/values/layouts.xml
index 483f09d..9ea5e67 100644
--- a/lottie_loading_layout/res/values/layouts.xml
+++ b/lottie_loading_layout/res/values/layouts.xml
@@ -17,4 +17,5 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<item name="sud_glif_loading_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_compat</item>
+ <item name="sud_glif_fullscreen_loading_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_compat</item>
</resources>
\ No newline at end of file
diff --git a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java
index d239e3d..db0b1f3 100644
--- a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java
+++ b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java
@@ -24,15 +24,14 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.provider.Settings.Global;
+import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.util.AttributeSet;
import android.util.Log;
@@ -62,6 +61,7 @@
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.util.BuildCompatUtils;
import com.google.android.setupdesign.lottieloadinglayout.R;
+import com.google.android.setupdesign.util.LayoutStyler;
import com.google.android.setupdesign.view.IllustrationVideoView;
import java.io.InputStream;
import java.lang.annotation.Retention;
@@ -90,6 +90,11 @@
@VisibleForTesting Map<KeyPath, SimpleColorFilter> customizationMap = new HashMap<>();
+ private AnimatorListener animatorListener;
+ private Runnable nextActionRunnable;
+ private boolean workFinished;
+ @VisibleForTesting public boolean runRunnable;
+
@VisibleForTesting
public List<LottieAnimationFinishListener> animationFinishListeners = new ArrayList<>();
@@ -125,8 +130,6 @@
.obtainStyledAttributes(attrs, R.styleable.SudGlifLoadingLayout, defStyleAttr, 0);
customLottieResource = a.getResourceId(R.styleable.SudGlifLoadingLayout_sudLottieRes, 0);
String illustrationType = a.getString(R.styleable.SudGlifLoadingLayout_sudIllustrationType);
- boolean usePartnerHeavyTheme =
- a.getBoolean(R.styleable.SudGlifLoadingLayout_sudUsePartnerHeavyTheme, false);
a.recycle();
if (customLottieResource != 0) {
@@ -145,16 +148,54 @@
}
}
- boolean applyPartnerHeavyThemeResource = shouldApplyPartnerResource() && usePartnerHeavyTheme;
- if (applyPartnerHeavyThemeResource) {
- View view = findManagedViewById(R.id.sud_layout_loading_content);
- if (view != null) {
- applyPartnerCustomizationContentPaddingTopStyle(view);
+ View view = findManagedViewById(R.id.sud_layout_loading_content);
+ if (view != null) {
+ if (shouldApplyPartnerResource()) {
+ LayoutStyler.applyPartnerCustomizationExtraPaddingStyle(view);
}
+ tryApplyPartnerCustomizationContentPaddingTopStyle(view);
}
updateHeaderHeight();
updateLandscapeMiddleHorizontalSpacing();
+
+ workFinished = false;
+ runRunnable = true;
+
+ LottieAnimationView lottieAnimationView = findLottieAnimationView();
+ if (lottieAnimationView != null) {
+ /*
+ * add the listener used to log animation end and check whether the
+ * work in background finish when repeated.
+ */
+ animatorListener =
+ new AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ // Do nothing.
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ Log.i(TAG, "Animate enable:" + isAnimateEnable() + ". Animation end.");
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ // Do nothing.
+ }
+
+ @Override
+ public void onAnimationRepeat(Animator animation) {
+ if (workFinished) {
+ Log.i(TAG, "Animation repeat but work finished, run the register runnable.");
+ finishRunnable(nextActionRunnable);
+ workFinished = false;
+ }
+ }
+ };
+ lottieAnimationView.addAnimatorListener(animatorListener);
+ }
}
@Override
@@ -166,6 +207,21 @@
}
}
+ private boolean isAnimateEnable() {
+ try {
+ if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
+ return Settings.Global.getFloat(
+ getContext().getContentResolver(), Settings.Global.ANIMATOR_DURATION_SCALE)
+ != 0f;
+ } else {
+ return true;
+ }
+
+ } catch (SettingNotFoundException e) {
+ return true;
+ }
+ }
+
public void setIllustrationType(@IllustrationType String type) {
if (customLottieResource != 0) {
throw new IllegalStateException(
@@ -251,7 +307,7 @@
if (activity == null) {
throw new NullPointerException("activity should not be null");
}
- registerAnimationFinishRunnable(activity::finish, /* allowFinishWithMaximumDuration= */ true);
+ registerAnimationFinishRunnable(activity::finish);
}
/**
@@ -289,8 +345,7 @@
if (finish) {
activity.finish();
}
- },
- /* allowFinishWithMaximumDuration= */ true);
+ });
}
/**
@@ -332,15 +387,16 @@
if (finish) {
activity.finish();
}
- },
- /* allowFinishWithMaximumDuration= */ true);
+ });
}
private void updateHeaderHeight() {
View headerView = findManagedViewById(R.id.sud_header_scroll_view);
+ Configuration currentConfig = getResources().getConfiguration();
if (headerView != null
&& PartnerConfigHelper.get(getContext())
- .isPartnerConfigAvailable(PartnerConfig.CONFIG_LOADING_LAYOUT_HEADER_HEIGHT)) {
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_LOADING_LAYOUT_HEADER_HEIGHT)
+ && currentConfig.orientation != Configuration.ORIENTATION_LANDSCAPE) {
float configHeaderHeight =
PartnerConfigHelper.get(getContext())
.getDimension(getContext(), PartnerConfig.CONFIG_LOADING_LAYOUT_HEADER_HEIGHT);
@@ -407,7 +463,7 @@
linearLayout.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
}
- private static final int getButtonContainerHeight(View view) {
+ private static int getButtonContainerHeight(View view) {
view.measure(
MeasureSpec.makeMeasureSpec(view.getMeasuredWidth(), MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(view.getMeasuredHeight(), MeasureSpec.EXACTLY));
@@ -612,7 +668,8 @@
String[] splitItem = item.split(":");
if (splitItem.length == 2) {
customizationMap.put(
- new KeyPath(splitItem[0]), new SimpleColorFilter(Color.parseColor(splitItem[1])));
+ new KeyPath("**", splitItem[0], "**"),
+ new SimpleColorFilter(Color.parseColor(splitItem[1])));
} else {
Log.w(TAG, "incorrect format customization, value=" + item);
}
@@ -647,7 +704,17 @@
@Override
protected View onInflateTemplate(LayoutInflater inflater, int template) {
if (template == 0) {
- template = R.layout.sud_glif_loading_template;
+ boolean useFullScreenIllustration =
+ PartnerConfigHelper.get(getContext())
+ .getBoolean(
+ getContext(),
+ PartnerConfig.CONFIG_LOADING_LAYOUT_FULL_SCREEN_ILLUSTRATION_ENABLED,
+ false);
+ if (useFullScreenIllustration) {
+ template = R.layout.sud_glif_fullscreen_loading_template;
+ } else {
+ template = R.layout.sud_glif_loading_template;
+ }
}
return inflateTemplate(inflater, R.style.SudThemeGlif_Light, template);
}
@@ -727,38 +794,31 @@
}
/**
- * Register the {@link Runnable} as a callback class that will be perform when animation finished.
+ * Register the {@link Runnable} as a callback that will be performed when the animation finished.
*/
public void registerAnimationFinishRunnable(Runnable runnable) {
- registerAnimationFinishRunnable(runnable, /* allowFinishWithMaximumDuration= */ false);
+ workFinished = true;
+ nextActionRunnable = runnable;
+ synchronized (this) {
+ runRunnable = true;
+ animationFinishListeners.add(
+ new LottieAnimationFinishListener(this, () -> finishRunnable(runnable)));
+ }
}
- /**
- * Register the {@link Runnable} as a callback class that will be perform when animation finished.
- * {@code allowFinishWithMaximumDuration} to allow the animation finish advanced by {@link
- * PartnerConfig#CONFIG_PROGRESS_ILLUSTRATION_DISPLAY_MINIMUM_MS} config. The {@code runnable}
- * will be performed if the Lottie animation finish played and the duration of Lottie animation
- * less than @link PartnerConfig#CONFIG_PROGRESS_ILLUSTRATION_DISPLAY_MINIMUM_MS} config.
- */
- public void registerAnimationFinishRunnable(
- Runnable runnable, boolean allowFinishWithMaximumDuration) {
- if (allowFinishWithMaximumDuration) {
- int delayMs =
- PartnerConfigHelper.get(getContext())
- .getInteger(
- getContext(), PartnerConfig.CONFIG_PROGRESS_ILLUSTRATION_DISPLAY_MINIMUM_MS, 0);
- animationFinishListeners.add(new LottieAnimationFinishListener(this, runnable, delayMs));
- } else {
- animationFinishListeners.add(
- new LottieAnimationFinishListener(this, runnable, /* finishWithMinimumDuration= */ 0L));
+ @VisibleForTesting
+ public synchronized void finishRunnable(Runnable runnable) {
+ // to avoid run the runnable twice.
+ if (runRunnable) {
+ runnable.run();
}
+ runRunnable = false;
}
/** The listener that to indicate the playing status for lottie animation. */
@VisibleForTesting
public static class LottieAnimationFinishListener {
- private final Handler handler;
private final Runnable runnable;
private final GlifLoadingLayout glifLoadingLayout;
private final LottieAnimationView lottieAnimationView;
@@ -788,22 +848,28 @@
};
@VisibleForTesting
- LottieAnimationFinishListener(
- GlifLoadingLayout glifLoadingLayout, Runnable runnable, long finishWithMinimumDuration) {
+ LottieAnimationFinishListener(GlifLoadingLayout glifLoadingLayout, Runnable runnable) {
if (runnable == null) {
throw new NullPointerException("Runnable can not be null");
}
this.glifLoadingLayout = glifLoadingLayout;
this.runnable = runnable;
- this.handler = new Handler(Looper.getMainLooper());
this.lottieAnimationView = glifLoadingLayout.findLottieAnimationView();
- if (glifLoadingLayout.isLottieLayoutVisible() && !isZeroAnimatorDurationScale()) {
- lottieAnimationView.setRepeatCount(0);
+ boolean shouldAnimationBeFinished =
+ PartnerConfigHelper.get(glifLoadingLayout.getContext())
+ .getBoolean(
+ glifLoadingLayout.getContext(),
+ PartnerConfig.CONFIG_LOADING_LAYOUT_WAIT_FOR_ANIMATION_FINISHED,
+ true);
+ // TODO: add test case for verify the case which isAnimating returns true.
+ if (glifLoadingLayout.isLottieLayoutVisible()
+ && lottieAnimationView.isAnimating()
+ && !isZeroAnimatorDurationScale()
+ && shouldAnimationBeFinished) {
+ Log.i(TAG, "Register animation finish.");
lottieAnimationView.addAnimatorListener(animatorListener);
- if (finishWithMinimumDuration > 0) {
- handler.postDelayed(this::onAnimationFinished, finishWithMinimumDuration);
- }
+ lottieAnimationView.setRepeatCount(0);
} else {
onAnimationFinished();
}
@@ -813,8 +879,9 @@
boolean isZeroAnimatorDurationScale() {
try {
if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
- return Global.getFloat(
- glifLoadingLayout.getContext().getContentResolver(), Global.ANIMATOR_DURATION_SCALE)
+ return Settings.Global.getFloat(
+ glifLoadingLayout.getContext().getContentResolver(),
+ Settings.Global.ANIMATOR_DURATION_SCALE)
== 0f;
} else {
return false;
@@ -827,7 +894,6 @@
@VisibleForTesting
public void onAnimationFinished() {
- handler.removeCallbacks(runnable);
runnable.run();
if (lottieAnimationView != null) {
lottieAnimationView.removeAnimatorListener(animatorListener);
diff --git a/main/res/anim-ldrtl-v31/sud_slide_back_in.xml b/main/res/anim-ldrtl-v31/sud_slide_back_in.xml
new file mode 100644
index 0000000..0f9bba9
--- /dev/null
+++ b/main/res/anim-ldrtl-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="@interpolator/sud_interpolator" />
diff --git a/main/res/anim-ldrtl-v31/sud_slide_back_out.xml b/main/res/anim-ldrtl-v31/sud_slide_back_out.xml
new file mode 100644
index 0000000..8c5c439
--- /dev/null
+++ b/main/res/anim-ldrtl-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="@interpolator/sud_interpolator" />
diff --git a/main/res/anim-ldrtl-v31/sud_slide_next_in.xml b/main/res/anim-ldrtl-v31/sud_slide_next_in.xml
new file mode 100644
index 0000000..cf524a3
--- /dev/null
+++ b/main/res/anim-ldrtl-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="@interpolator/sud_interpolator" />
diff --git a/main/res/anim-ldrtl-v31/sud_slide_next_out.xml b/main/res/anim-ldrtl-v31/sud_slide_next_out.xml
new file mode 100644
index 0000000..18b760e
--- /dev/null
+++ b/main/res/anim-ldrtl-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="@interpolator/sud_interpolator" />
diff --git a/main/res/anim-v31/sud_slide_back_in.xml b/main/res/anim-v31/sud_slide_back_in.xml
index 77d4cd5..cf524a3 100644
--- a/main/res/anim-v31/sud_slide_back_in.xml
+++ b/main/res/anim-v31/sud_slide_back_in.xml
@@ -19,4 +19,4 @@
android:duration="@integer/sudTransitionDuration"
android:fromXDelta="-100%"
android:toXDelta="0%"
- android:interpolator="@anim/sud_interpolator" />
+ android:interpolator="@interpolator/sud_interpolator" />
diff --git a/main/res/anim-v31/sud_slide_back_out.xml b/main/res/anim-v31/sud_slide_back_out.xml
index 8ae16d4..18b760e 100644
--- a/main/res/anim-v31/sud_slide_back_out.xml
+++ b/main/res/anim-v31/sud_slide_back_out.xml
@@ -19,4 +19,4 @@
android:duration="@integer/sudTransitionDuration"
android:fromXDelta="0%"
android:toXDelta="100%"
- android:interpolator="@anim/sud_interpolator" />
+ android:interpolator="@interpolator/sud_interpolator" />
diff --git a/main/res/anim-v31/sud_slide_next_in.xml b/main/res/anim-v31/sud_slide_next_in.xml
index 006d9b4..0f9bba9 100644
--- a/main/res/anim-v31/sud_slide_next_in.xml
+++ b/main/res/anim-v31/sud_slide_next_in.xml
@@ -19,4 +19,4 @@
android:duration="@integer/sudTransitionDuration"
android:fromXDelta="100%"
android:toXDelta="0%"
- android:interpolator="@anim/sud_interpolator" />
+ android:interpolator="@interpolator/sud_interpolator" />
diff --git a/main/res/anim-v31/sud_slide_next_out.xml b/main/res/anim-v31/sud_slide_next_out.xml
index 341bbad..8c5c439 100644
--- a/main/res/anim-v31/sud_slide_next_out.xml
+++ b/main/res/anim-v31/sud_slide_next_out.xml
@@ -19,4 +19,4 @@
android:duration="@integer/sudTransitionDuration"
android:fromXDelta="0%"
android:toXDelta="-100%"
- android:interpolator="@anim/sud_interpolator" />
+ android:interpolator="@interpolator/sud_interpolator" />
diff --git a/main/res/color-v31/sud_dynamic_switch_track_off_light.xml b/main/res/color-v31/sud_dynamic_switch_track_off_light.xml
new file mode 100644
index 0000000..fc9cc97
--- /dev/null
+++ b/main/res/color-v31/sud_dynamic_switch_track_off_light.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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral2_500" android:lStar="45" />
+</selector>
\ No newline at end of file
diff --git a/main/res/color-v31/sud_dynamic_switch_track_on_dark.xml b/main/res/color-v31/sud_dynamic_switch_track_on_dark.xml
new file mode 100644
index 0000000..b8997f9
--- /dev/null
+++ b/main/res/color-v31/sud_dynamic_switch_track_on_dark.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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_accent2_500" android:lStar="51" />
+</selector>
\ No newline at end of file
diff --git a/main/res/color/sud_switch_thumb_off.xml b/main/res/color/sud_switch_thumb_off.xml
new file mode 100644
index 0000000..8e54c8c
--- /dev/null
+++ b/main/res/color/sud_switch_thumb_off.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools">
+ <item android:state_enabled="false"
+ android:color="?attr/sudSwitchBarThumbOffColor"
+ android:alpha="?android:attr/disabledAlpha" />
+ <item android:color="?attr/sudSwitchBarThumbOffColor" />
+</selector>
\ No newline at end of file
diff --git a/main/res/color/sud_switch_thumb_on.xml b/main/res/color/sud_switch_thumb_on.xml
new file mode 100644
index 0000000..494c179
--- /dev/null
+++ b/main/res/color/sud_switch_thumb_on.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools">
+ <item android:state_enabled="false"
+ android:color="?attr/sudSwitchBarThumbOnColor"
+ android:alpha="?android:attr/disabledAlpha" />
+ <item android:color="?attr/sudSwitchBarThumbOnColor" />
+</selector>
\ No newline at end of file
diff --git a/main/res/color/sud_switch_track_off.xml b/main/res/color/sud_switch_track_off.xml
new file mode 100644
index 0000000..4770393
--- /dev/null
+++ b/main/res/color/sud_switch_track_off.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools">
+ <item android:state_enabled="false"
+ android:color="?attr/sudSwitchBarTrackOffColor"
+ android:alpha="?android:attr/disabledAlpha" />
+ <item android:color="?attr/sudSwitchBarTrackOffColor" />
+</selector>
diff --git a/main/res/color/sud_switch_track_on.xml b/main/res/color/sud_switch_track_on.xml
index a95a1ee..fb93f05 100644
--- a/main/res/color/sud_switch_track_on.xml
+++ b/main/res/color/sud_switch_track_on.xml
@@ -17,10 +17,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<item android:state_enabled="false"
- android:color="?android:attr/colorForeground"
+ android:color="?attr/sudSwitchBarTrackOnColor"
android:alpha="?android:attr/disabledAlpha" />
- <item android:state_checked="true"
- android:color="?android:attr/colorControlActivated" tools:ignore="NewApi"
- android:alpha="?android:attr/disabledAlpha" />
- <item android:color="?android:attr/colorForeground" />
+ <item android:color="?attr/sudSwitchBarTrackOnColor" />
</selector>
diff --git a/main/res/drawable-v21/sud_switch_thumb_on.xml b/main/res/drawable-v21/sud_switch_thumb_on.xml
deleted file mode 100644
index 224f181..0000000
--- a/main/res/drawable-v21/sud_switch_thumb_on.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
- -->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item
- android:top="@dimen/sud_switch_thumb_margin"
- android:left="@dimen/sud_switch_thumb_margin"
- android:right="@dimen/sud_switch_thumb_margin"
- android:bottom="@dimen/sud_switch_thumb_margin">
- <shape android:shape="oval">
- <size
- android:height="@dimen/sud_switch_thumb_size"
- android:width="@dimen/sud_switch_thumb_size" />
- <solid android:color="?android:attr/colorControlActivated" />
- </shape>
- </item>
-</layer-list>
\ No newline at end of file
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/drawable/sud_switch_thumb_on.xml b/main/res/drawable/sud_switch_thumb_on.xml
index cc1cf06..d4dad6f 100644
--- a/main/res/drawable/sud_switch_thumb_on.xml
+++ b/main/res/drawable/sud_switch_thumb_on.xml
@@ -26,7 +26,7 @@
<size
android:height="@dimen/sud_switch_thumb_size"
android:width="@dimen/sud_switch_thumb_size" />
- <solid android:color="?android:attr/colorAccent" tools:ignore="NewApi" />
+ <solid android:color="@color/sud_switch_thumb_on" />
</shape>
</item>
</layer-list>
diff --git a/main/res/anim-v31/sud_interpolator.xml b/main/res/interpolator-v31/sud_interpolator.xml
similarity index 100%
rename from main/res/anim-v31/sud_interpolator.xml
rename to main/res/interpolator-v31/sud_interpolator.xml
diff --git a/main/res/layout-land-v31/sud_glif_blank_template_content.xml b/main/res/layout-land-v31/sud_glif_blank_template_content.xml
index dd4d52d..aeef4a3 100644
--- a/main/res/layout-land-v31/sud_glif_blank_template_content.xml
+++ b/main/res/layout-land-v31/sud_glif_blank_template_content.xml
@@ -44,9 +44,8 @@
<LinearLayout
android:id="@+id/sud_landscape_content_area"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@dimen/sud_glif_land_content_area_weight"
+ style="@style/SudLandContentContianerStyle"
+ android:paddingTop="?attr/sudGlifContentPaddingTop"
android:orientation="vertical">
<FrameLayout
diff --git a/main/res/layout-land-v31/sud_glif_list_template_content.xml b/main/res/layout-land-v31/sud_glif_list_template_content.xml
index 478ac5f..9b0dd5d 100644
--- a/main/res/layout-land-v31/sud_glif_list_template_content.xml
+++ b/main/res/layout-land-v31/sud_glif_list_template_content.xml
@@ -55,9 +55,8 @@
<LinearLayout
android:id="@+id/sud_landscape_content_area"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@dimen/sud_glif_land_content_area_weight"
+ style="@style/SudLandContentContianerStyle"
+ android:paddingTop="?attr/sudGlifContentPaddingTop"
android:orientation="vertical">
<com.google.android.setupdesign.view.StickyHeaderListView
diff --git a/main/res/layout-land-v31/sud_glif_preference_template_content.xml b/main/res/layout-land-v31/sud_glif_preference_template_content.xml
index c03d2fe..1d95b42 100644
--- a/main/res/layout-land-v31/sud_glif_preference_template_content.xml
+++ b/main/res/layout-land-v31/sud_glif_preference_template_content.xml
@@ -55,9 +55,8 @@
<LinearLayout
android:id="@+id/sud_landscape_content_area"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@dimen/sud_glif_land_content_area_weight"
+ style="@style/SudLandContentContianerStyle"
+ android:paddingTop="?attr/sudGlifContentPaddingTop"
android:orientation="vertical">
<FrameLayout
diff --git a/main/res/layout-land-v31/sud_glif_recycler_template_content.xml b/main/res/layout-land-v31/sud_glif_recycler_template_content.xml
index 4840caf..a75c068 100644
--- a/main/res/layout-land-v31/sud_glif_recycler_template_content.xml
+++ b/main/res/layout-land-v31/sud_glif_recycler_template_content.xml
@@ -56,9 +56,8 @@
<LinearLayout
android:id="@+id/sud_landscape_content_area"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@dimen/sud_glif_land_content_area_weight"
+ style="@style/SudLandContentContianerStyle"
+ android:paddingTop="?attr/sudGlifContentPaddingTop"
android:orientation="vertical">
<com.google.android.setupdesign.view.HeaderRecyclerView
diff --git a/main/res/layout-land-v31/sud_glif_template_content.xml b/main/res/layout-land-v31/sud_glif_template_content.xml
index d1b6b92..6329e4b 100644
--- a/main/res/layout-land-v31/sud_glif_template_content.xml
+++ b/main/res/layout-land-v31/sud_glif_template_content.xml
@@ -55,9 +55,7 @@
<LinearLayout
android:id="@+id/sud_landscape_content_area"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@dimen/sud_glif_land_content_area_weight"
+ style="@style/SudLandContentContianerStyle"
android:orientation="vertical">
<com.google.android.setupdesign.view.BottomScrollView
@@ -65,7 +63,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
- android:scrollIndicators="?attr/sudScrollIndicators">
+ android:scrollIndicators="?attr/sudScrollIndicators"
+ android:importantForAccessibility="no">
<LinearLayout
android:layout_width="match_parent"
@@ -74,6 +73,7 @@
<FrameLayout
android:id="@+id/sud_layout_content"
+ android:paddingTop="?attr/sudGlifContentPaddingTop"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
diff --git a/main/res/layout-sw600dp-v31/sud_glif_preference_template_card.xml b/main/res/layout-sw600dp-v31/sud_glif_preference_template_card.xml
new file mode 100644
index 0000000..68ea99e
--- /dev/null
+++ b/main/res/layout-sw600dp-v31/sud_glif_preference_template_card.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/suc_layout_status"
+ style="@style/SudGlifCardBackground"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+
+ <View
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:visibility="invisible" />
+
+ <com.google.android.setupdesign.view.IntrinsicSizeFrameLayout
+ style="@style/SudGlifCardContainer"
+ android:layout_width="@dimen/sud_glif_card_width"
+ android:layout_height="wrap_content"
+ android:height="@dimen/sud_glif_card_height">
+
+ <include layout="@layout/sud_glif_preference_template_content" />
+
+ </com.google.android.setupdesign.view.IntrinsicSizeFrameLayout>
+
+ <View
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:visibility="invisible" />
+
+</LinearLayout>
diff --git a/main/res/layout/sud_glif_header.xml b/main/res/layout/sud_glif_header.xml
index 50feeb2..70b8daa 100644
--- a/main/res/layout/sud_glif_header.xml
+++ b/main/res/layout/sud_glif_header.xml
@@ -31,20 +31,15 @@
<ImageView
android:id="@+id/sud_layout_icon"
style="?attr/sudGlifIconStyle"
- android:layout_marginLeft="0dp"
- android:layout_marginRight="0dp"
- android:layout_marginTop="0dp"
- android:layout_marginBottom="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
- android:layout_gravity="?attr/sudGlifHeaderGravity"
android:visibility="gone" />
</FrameLayout>
<TextView
android:id="@+id/suc_layout_title"
- style="@style/SudGlifHeaderTitle"
+ style="?attr/sudGlifHeaderTitleStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@@ -61,7 +56,7 @@
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/sud_layout_subtitle"
- style="@style/SudGlifDescription"
+ style="?attr/sudGlifDescriptionStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
@@ -73,8 +68,6 @@
android:layout_height="wrap_content"
android:layout_marginLeft="?attr/sudMarginStart"
android:layout_marginRight="?attr/sudMarginStart"
- android:layout_marginBottom="@dimen/sud_progress_bar_margin_vertical"
- android:layout_marginTop="@dimen/sud_progress_bar_margin_vertical"
android:visibility="gone"
android:indeterminate="true" />
diff --git a/main/res/layout/sud_items_default.xml b/main/res/layout/sud_items_default.xml
index 4f3f3ac..11f89fa 100644
--- a/main/res/layout/sud_items_default.xml
+++ b/main/res/layout/sud_items_default.xml
@@ -17,7 +17,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- style="@style/SudItemContainer"
+ style="?attr/sudItemContainerStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
@@ -25,7 +25,7 @@
<FrameLayout
android:id="@+id/sud_items_icon_container"
- android:layout_width="@dimen/sud_items_icon_container_width"
+ style="?attr/sudItemIconContainerStyle"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="start">
@@ -42,12 +42,13 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
+ android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:orientation="vertical">
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/sud_items_title"
- style="@style/SudItemTitle"
+ style="?attr/sudItemTitleStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
@@ -56,10 +57,9 @@
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/sud_items_summary"
- style="@style/SudItemSummary"
+ style="?attr/sudItemSummaryStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/sud_items_padding_bottom_extra"
android:gravity="start"
android:textAlignment="viewStart"
android:visibility="gone"
diff --git a/main/res/layout/sud_items_description.xml b/main/res/layout/sud_items_description.xml
index 1caa5ee..8c24e87 100644
--- a/main/res/layout/sud_items_description.xml
+++ b/main/res/layout/sud_items_description.xml
@@ -52,7 +52,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="@dimen/sud_description_line_spacing_extra"
- android:textAppearance="@style/TextAppearance.SudDescription"
+ android:textAppearance="?attr/sudItemDescriptionTitleTextAppearence"
tools:ignore="UnusedAttribute" />
<com.google.android.setupdesign.view.RichTextView
diff --git a/main/res/layout/sud_items_switch.xml b/main/res/layout/sud_items_switch.xml
index 3826ae3..28660a4 100644
--- a/main/res/layout/sud_items_switch.xml
+++ b/main/res/layout/sud_items_switch.xml
@@ -17,7 +17,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- style="@style/SudItemContainer"
+ style="?attr/sudItemContainerStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
@@ -47,7 +47,7 @@
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/sud_items_title"
- style="@style/SudItemTitle"
+ style="?attr/sudItemTitleStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
@@ -57,7 +57,7 @@
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/sud_items_summary"
- style="@style/SudItemSummary"
+ style="?attr/sudItemSummaryStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
diff --git a/main/res/layout/sud_items_verbose.xml b/main/res/layout/sud_items_verbose.xml
index 210c41c..f246e61 100644
--- a/main/res/layout/sud_items_verbose.xml
+++ b/main/res/layout/sud_items_verbose.xml
@@ -49,7 +49,7 @@
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/sud_items_title"
- style="@style/SudItemTitle.Verbose"
+ style="?attr/sudItemVerboseTitleStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
@@ -58,7 +58,7 @@
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/sud_items_summary"
- style="@style/SudItemSummary"
+ style="?attr/sudItemSummaryStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
diff --git a/main/res/values-h720dp/dimens.xml b/main/res/values-h720dp/dimens.xml
new file mode 100644
index 0000000..e495f71
--- /dev/null
+++ b/main/res/values-h720dp/dimens.xml
@@ -0,0 +1,26 @@
+<?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 xmlns:tools="http://schemas.android.com/tools">
+
+ <!-- Device default style -->
+
+ <!-- Copy from Widget.DeviceDefault.Button.ButtonBar.AlertDialog -->
+ <!-- Dialog button bar height -->
+ <dimen name="sud_alert_dialog_button_bar_height">54dip</dimen>
+
+</resources>
diff --git a/main/res/values-land-v31/dimens.xml b/main/res/values-land-v31/dimens.xml
index 8b8d10d..5accbbd 100644
--- a/main/res/values-land-v31/dimens.xml
+++ b/main/res/values-land-v31/dimens.xml
@@ -24,4 +24,11 @@
<dimen name="sud_glif_margin_start">32dp</dimen>
<dimen name="sud_glif_margin_end">32dp</dimen>
+ <dimen name="sud_glif_header_title_margin_top">24dp</dimen>
+ <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_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 49ed20d..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,4 +45,17 @@
<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>
+ <!-- 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 f929595..cd2a6d5 100644
--- a/main/res/values-night-v31/colors.xml
+++ b/main/res/values-night-v31/colors.xml
@@ -29,5 +29,7 @@
<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_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-night/styles.xml b/main/res/values-night/styles.xml
index d609b4c..555473e 100644
--- a/main/res/values-night/styles.xml
+++ b/main/res/values-night/styles.xml
@@ -22,7 +22,12 @@
<style name="SudThemeGlif.DayNight" parent="SudThemeGlif" />
<style name="SudThemeGlifV2.DayNight" parent="SudThemeGlifV2" />
<style name="SudThemeGlifV3.DayNight" parent="SudThemeGlifV3" />
+ <style name="SudThemeGlifV4.DayNight" parent="SudThemeGlifV4" />
+
+ <!-- DynamicColor DayNight themes -->
<style name="SudDynamicColorThemeGlifV3.DayNight" parent="SudDynamicColorThemeGlifV3" />
<style name="SudFullDynamicColorThemeGlifV3.DayNight" parent="SudFullDynamicColorThemeGlifV3" />
+ <style name="SudDynamicColorTheme.DayNight" parent="SudDynamicColorTheme" />
+ <style name="SudFullDynamicColorTheme.DayNight" parent="SudFullDynamicColorTheme" />
</resources>
diff --git a/main/res/values-sw600dp-land-v31/dimens.xml b/main/res/values-sw600dp-land-v31/dimens.xml
new file mode 100644
index 0000000..da43b3b
--- /dev/null
+++ b/main/res/values-sw600dp-land-v31/dimens.xml
@@ -0,0 +1,39 @@
+<?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 -->
+ <!-- Calculated by (sud_glif_margin_start - 4dp internal padding of button) -->
+ <dimen name="sud_glif_button_margin_end">44dp</dimen>
+ <!-- Calculated by (sud_glif_margin_start - sud_glif_button_padding) -->
+ <dimen name="sud_glif_button_margin_start">32dp</dimen>
+ <!-- Calculated by (sud_glif_margin_start - sud_glif_button_padding) -->
+ <dimen name="sud_glif_footer_padding_start">32dp</dimen>
+ <!-- Calculated by (sud_glif_margin_end - 4dp internal padding of button) -->
+ <dimen name="sud_glif_footer_padding_end">44dp</dimen>
+ <dimen name="sud_glif_margin_start">48dp</dimen>
+ <dimen name="sud_glif_margin_end">48dp</dimen>
+
+ <dimen name="sud_glif_content_padding_top">88dp</dimen>
+ <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 d68c884..aa70031 100644
--- a/main/res/values-sw600dp-land/dimens.xml
+++ b/main/res/values-sw600dp-land/dimens.xml
@@ -23,4 +23,22 @@
<!-- 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>
+ <!-- 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
new file mode 100644
index 0000000..fd9215e
--- /dev/null
+++ b/main/res/values-sw600dp-v31/dimens.xml
@@ -0,0 +1,40 @@
+<?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 -->
+ <!-- Calculated by (sud_glif_margin_start - 4dp internal padding of button) -->
+ <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">80dp</dimen>
+ <!-- Calculated by (sud_glif_margin_start - sud_glif_button_padding) -->
+ <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">92dp</dimen>
+
+ <dimen name="sud_glif_margin_start">96dp</dimen>
+ <dimen name="sud_glif_margin_end">96dp</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>
+ <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-v31/layouts.xml b/main/res/values-sw600dp-v31/layouts.xml
new file mode 100644
index 0000000..b013475
--- /dev/null
+++ b/main/res/values-sw600dp-v31/layouts.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 xmlns:tools="http://schemas.android.com/tools">
+
+ <item name="sud_glif_preference_template" type="layout">@layout/sud_glif_preference_template_card</item>
+
+</resources>
diff --git a/main/res/values-sw600dp/dimens.xml b/main/res/values-sw600dp/dimens.xml
index b7802b1..16c77ec 100644
--- a/main/res/values-sw600dp/dimens.xml
+++ b/main/res/values-sw600dp/dimens.xml
@@ -18,10 +18,14 @@
<resources>
<!-- General -->
+ <!-- Calculated by (sud_glif_margin_start - sud_glif_button_padding) -->
+ <dimen name="sud_glif_button_margin_start">24dp</dimen>
<!-- Calculated by (sud_glif_margin_start - 4dp internal padding of button) -->
<dimen name="sud_glif_button_margin_end">36dp</dimen>
<!-- Calculated by (sud_glif_margin_start - sud_glif_button_padding) -->
- <dimen name="sud_glif_button_margin_start">24dp</dimen>
+ <dimen name="sud_glif_footer_padding_start">24dp</dimen>
+ <!-- Calculated by (sud_glif_margin_end - 4dp internal padding of button) -->
+ <dimen name="sud_glif_footer_padding_end">36dp</dimen>
<dimen name="sud_glif_margin_start">40dp</dimen>
<dimen name="sud_glif_margin_end">40dp</dimen>
@@ -38,4 +42,26 @@
<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>
+
</resources>
diff --git a/main/res/values-sw800dp/dimens.xml b/main/res/values-sw800dp/dimens.xml
new file mode 100644
index 0000000..163e342
--- /dev/null
+++ b/main/res/values-sw800dp/dimens.xml
@@ -0,0 +1,23 @@
+<?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 xmlns:tools="http://schemas.android.com/tools">
+
+ <dimen name="sud_content_illustration_max_height">468dp</dimen>
+ <dimen name="sud_content_illustration_max_width">468dp</dimen>
+
+</resources>
diff --git a/main/res/values-v31/colors.xml b/main/res/values-v31/colors.xml
index 91587ee..1ed67df 100644
--- a/main/res/values-v31/colors.xml
+++ b/main/res/values-v31/colors.xml
@@ -38,27 +38,49 @@
<color name="sud_system_accent1_200">@android:color/system_accent1_200</color>
+ <color name="sud_system_accent1_300">@android:color/system_accent1_300</color>
+
<color name="sud_system_accent1_600">@android:color/system_accent1_600</color>
+ <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>
+
<color name="sud_system_neutral1_50">@android:color/system_neutral1_50</color>
+ <color name="sud_system_neutral1_200">@android:color/system_neutral1_200</color>
+
+ <color name="sud_system_neutral1_300">@android:color/system_neutral1_300</color>
+
+ <color name="sud_system_neutral1_400">@android:color/system_neutral1_400</color>
+
+ <color name="sud_system_neutral1_500">@android:color/system_neutral1_500</color>
+
+ <color name="sud_system_neutral1_600">@android:color/system_neutral1_600</color>
+
+ <color name="sud_system_neutral1_700">@android:color/system_neutral1_700</color>
+
<color name="sud_system_neutral1_800">@android:color/system_neutral1_800</color>
<color name="sud_system_neutral1_900">@android:color/system_neutral1_900</color>
+ <color name="sud_system_neutral1_1000">@android:color/system_neutral1_1000</color>
- <color name="sud_system_neutral2_50">@android:color/system_neutral1_50</color>
- <color name="sud_system_neutral2_100">@android:color/system_neutral1_100</color>
+ <color name="sud_system_neutral2_50">@android:color/system_neutral2_50</color>
+
+ <color name="sud_system_neutral2_100">@android:color/system_neutral2_100</color>
<color name="sud_system_neutral2_200">@android:color/system_neutral2_200</color>
- <color name="sud_system_neutral2_300">@android:color/system_accent2_300</color>
+ <color name="sud_system_neutral2_300">@android:color/system_neutral2_300</color>
<color name="sud_system_neutral2_400">@android:color/system_neutral2_400</color>
@@ -76,5 +98,20 @@
<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>
-</resources>
\ No newline at end of file
+
+ <color name="sud_dynamic_switch_thumb_off_light">@color/sud_system_neutral2_300</color>
+
+ <color name="sud_dynamic_switch_track_off_dark">@color/sud_system_neutral1_700</color>
+
+ <color name="sud_dynamic_switch_thumb_off_dark">@color/sud_system_neutral1_400</color>
+
+
+ <color name="sud_dynamic_switch_track_on_light">@color/sud_system_accent1_600</color>
+
+ <color name="sud_dynamic_switch_thumb_on_light">@color/sud_system_accent1_100</color>
+
+ <color name="sud_dynamic_switch_thumb_on_dark">@color/sud_system_accent1_100</color>
+</resources>
diff --git a/main/res/values-v31/styles.xml b/main/res/values-v31/styles.xml
index e1240e4..df86de7 100644
--- a/main/res/values-v31/styles.xml
+++ b/main/res/values-v31/styles.xml
@@ -15,34 +15,126 @@
limitations under the License.
-->
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Main theme for dynamic color -->
- <style name="SudDynamicColorThemeGlifV3" parent="SudThemeGlifV3">
+ <style name="SudDynamicColorBaseTheme">
<item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_dark</item>
- <item name="android:textColorLink">@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>
<item name="android:datePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme</item>
<item name="android:timePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme</item>
<item name="sucFullDynamicColor">false</item>
+ <item name="sudSwitchBarThumbOnColor">@color/sud_dynamic_switch_thumb_on_dark</item>
+ <item name="sudSwitchBarTrackOnColor">@color/sud_dynamic_switch_track_on_dark</item>
+ <item name="sudSwitchBarThumbOffColor">@color/sud_dynamic_switch_thumb_off_dark</item>
+ <item name="sudSwitchBarTrackOffColor">@color/sud_dynamic_switch_track_off_dark</item>
+ <item name="sudEditBoxColor">@color/sud_dynamic_color_accent_glif_v3_dark</item>
</style>
- <style name="SudDynamicColorThemeGlifV3.Light" parent="SudThemeGlifV3.Light">
+ <style name="SudDynamicColorBaseTheme.Light">
<item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_light</item>
- <item name="android:textColorLink">@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>
<item name="android:datePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme.Light</item>
<item name="android:timePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme.Light</item>
<item name="sucFullDynamicColor">false</item>
+ <item name="sudSwitchBarThumbOnColor">@color/sud_dynamic_switch_thumb_on_light</item>
+ <item name="sudSwitchBarTrackOnColor">@color/sud_dynamic_switch_track_on_light</item>
+ <item name="sudSwitchBarThumbOffColor">@color/sud_dynamic_switch_thumb_off_light</item>
+ <item name="sudSwitchBarTrackOffColor">@color/sud_dynamic_switch_track_off_light</item>
+ <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>
+ <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>
+ <item name="colorBackgroundFloating">@color/sud_system_background_surface</item>
+ <item name="android:navigationBarColor">@color/sud_system_background_surface</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="alertDialogTheme">@style/SudFullDynamicColorAlertDialogThemeCompat</item>
+
+ <item name="sucFullDynamicColor">true</item>
+ </style>
+
+ <style name="SudFullDynamicColorTheme.Light" parent="SudDynamicColorTheme.Light">
+ <item name="android:windowBackground">@color/sud_system_background_surface</item>
+ <item name="android:colorForeground">@android:color/system_neutral1_900</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>
+ <item name="colorBackgroundFloating">@color/sud_system_background_surface</item>
+ <item name="android:navigationBarColor">@color/sud_system_background_surface</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="alertDialogTheme">@style/SudFullDynamicColorAlertDialogThemeCompat.Light</item>
+
+ <item name="sucFullDynamicColor">true</item>
+ </style>
+
+ <!-- Main theme for dynamic color -->
+ <!-- TODO: cleanup the Glifv3 dependent dynamic color theme -->
+ <style name="SudDynamicColorThemeGlifV3" parent="SudThemeGlifV3">
+ <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>
+ <item name="android:datePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme</item>
+ <item name="android:timePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme</item>
+ <item name="sucFullDynamicColor">false</item>
+ <item name="sudSwitchBarThumbOnColor">@color/sud_dynamic_switch_thumb_on_dark</item>
+ <item name="sudSwitchBarTrackOnColor">@color/sud_dynamic_switch_track_on_dark</item>
+ <item name="sudSwitchBarThumbOffColor">@color/sud_dynamic_switch_thumb_off_dark</item>
+ <item name="sudSwitchBarTrackOffColor">@color/sud_dynamic_switch_track_off_dark</item>
+ <item name="sudEditBoxColor">@color/sud_dynamic_color_accent_glif_v3_dark</item>
+ </style>
+
+ <style name="SudDynamicColorThemeGlifV3.Light" parent="SudThemeGlifV3.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>
+ <item name="android:datePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme.Light</item>
+ <item name="android:timePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme.Light</item>
+ <item name="sucFullDynamicColor">false</item>
+ <item name="sudSwitchBarThumbOnColor">@color/sud_dynamic_switch_thumb_on_light</item>
+ <item name="sudSwitchBarTrackOnColor">@color/sud_dynamic_switch_track_on_light</item>
+ <item name="sudSwitchBarThumbOffColor">@color/sud_dynamic_switch_thumb_off_light</item>
+ <item name="sudSwitchBarTrackOffColor">@color/sud_dynamic_switch_track_off_light</item>
+ <item name="sudEditBoxColor">@color/sud_dynamic_color_accent_glif_v3_light</item>
</style>
<style name="SudFullDynamicColorThemeGlifV3" parent="SudDynamicColorThemeGlifV3">
- <item name="android:windowBackground">@android:color/system_neutral1_900</item>
+ <item name="android:windowBackground">@color/sud_system_background_surface</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:navigationBarColor">@android:color/system_neutral1_900</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>
+ <item name="colorBackgroundFloating">@color/sud_system_background_surface</item>
+ <item name="android:navigationBarColor">@color/sud_system_background_surface</item>
<item name="android:textColorPrimary">@color/sud_system_primary_text</item>
<item name="android:textColorSecondary">@color/sud_system_secondary_text</item>
@@ -61,13 +153,13 @@
</style>
<style name="SudFullDynamicColorThemeGlifV3.Light" parent="SudDynamicColorThemeGlifV3.Light">
- <item name="android:windowBackground">@android:color/system_neutral1_50</item>
+ <item name="android:windowBackground">@color/sud_system_background_surface</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: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>
+ <item name="colorBackgroundFloating">@color/sud_system_background_surface</item>
+ <item name="android:navigationBarColor">@color/sud_system_background_surface</item>
<item name="android:textColorPrimary">@color/sud_system_primary_text</item>
<item name="android:textColorSecondary">@color/sud_system_secondary_text</item>
@@ -90,6 +182,8 @@
<item name="android:colorBackground">@color/sud_glif_v3_dialog_background_color_dark</item>
<item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_dark</item>
<item name="dialogCornerRadius">@dimen/sud_glif_device_default_dialog_corner_radius</item>
+ <item name="buttonBarButtonStyle">@style/SudAppCompatButtonButtonBarAlertDialog</item>
+ <item name="android:windowTitleStyle">@style/SudMaterialYouWindowTitleStyle</item>
</style>
<style name="SudDynamicColorAlertDialogThemeCompat.Light" parent="Theme.AppCompat.Light.Dialog.Alert">
@@ -97,6 +191,35 @@
<item name="android:colorBackground">@color/sud_glif_v3_dialog_background_color_light</item>
<item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_light</item>
<item name="dialogCornerRadius">@dimen/sud_glif_device_default_dialog_corner_radius</item>
+ <item name="buttonBarButtonStyle">@style/SudAppCompatButtonButtonBarAlertDialog.Light</item>
+ <item name="android:windowTitleStyle">@style/SudMaterialYouWindowTitleStyle</item>
+ </style>
+
+ <style name="SudAppCompatButtonButtonBarAlertDialog" parent="Widget.AppCompat.ButtonBar.AlertDialog">
+ <item name="android:textAppearance">@style/SudTextAppearanceDeviceDefaultMedium</item>
+ <item name="android:minWidth">@dimen/sud_alert_dialog_button_bar_width</item>
+ <item name="android:minHeight">@dimen/sud_alert_dialog_button_bar_height</item>
+ </style>
+
+ <style name="SudAppCompatButtonButtonBarAlertDialog.Light" parent="SudAppCompatButtonButtonBarAlertDialog">
+ <item name="android:textAppearance">@style/SudTextAppearanceDeviceDefaultMedium.Light</item>
+ </style>
+
+ <style name="SudWindowTitleStyle" parent="RtlOverlay.DialogWindowTitle.AppCompat">
+ <item name="android:textAppearance">@style/SudDeviceDefaultWindowTitleTextAppearance</item>
+ </style>
+
+ <style name="SudDeviceDefaultWindowTitleTextAppearance" parent="android:TextAppearance.DeviceDefault.WindowTitle">
+ <item name="android:textSize">@dimen/sud_alert_dialog_title_text_size</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ </style>
+
+ <style name="SudMaterialYouWindowTitleStyle" parent="RtlOverlay.DialogWindowTitle.AppCompat">
+ <item name="android:textAppearance">@style/SudMaterialYouDeviceDefaultWindowTitleTextAppearance</item>
+ </style>
+
+ <style name="SudMaterialYouDeviceDefaultWindowTitleTextAppearance" parent="SudDeviceDefaultWindowTitleTextAppearance">
+ <item name="android:textSize">@dimen/sud_alert_dialog_title_text_size_material_you</item>
</style>
<style name="SudFullDynamicColorAlertDialogThemeCompat" parent="SudDynamicColorAlertDialogThemeCompat">
@@ -117,4 +240,100 @@
<item name="dialogCornerRadius">@dimen/sud_glif_device_default_dialog_corner_radius</item>
</style>
+ <style name="SudAlertDialogTheme" parent="android:Theme.DeviceDefault.Dialog.Alert">
+ <item name="android:colorBackground">@color/sud_glif_v3_dialog_background_color_dark</item>
+ <item name="android:buttonBarButtonStyle">@style/SudDeviceDefaultButtonBarButtonStyle</item>
+ </style>
+
+ <style name="SudAlertDialogTheme.Light" parent="android:Theme.DeviceDefault.Light.Dialog.Alert">
+ <item name="android:buttonBarButtonStyle">@style/SudDeviceDefaultButtonBarButtonStyle.Light</item>
+ </style>
+
+ <!-- Can't set style Widget.DeviceDefault.Button.ButtonBar.AlertDialog as parent theme directly,
+ since it is not public. Thus here sets Widget.DeviceDefault.Button.Borderless.Colored and
+ bring the minWidth/minHeight. -->
+ <style name="SudDeviceDefaultButtonBarButtonStyle" parent="android:Widget.DeviceDefault.Button.Borderless.Colored">
+ <item name="android:textAppearance">@style/SudTextAppearanceDeviceDefaultMedium</item>
+ <item name="android:minWidth">@dimen/sud_alert_dialog_button_bar_width</item>
+ <item name="android:minHeight">@dimen/sud_alert_dialog_button_bar_height</item>
+ </style>
+
+ <style name="SudDeviceDefaultButtonBarButtonStyle.Light" parent="SudDeviceDefaultButtonBarButtonStyle">
+ <item name="android:textAppearance">@style/SudTextAppearanceDeviceDefaultMedium.Light</item>
+ </style>
+
+ <style name="SudTextAppearanceDeviceDefaultMedium" parent="android:TextAppearance.DeviceDefault.Medium">
+ <item name="android:textSize">@dimen/sud_alert_dialog_button_bar_button_text_size</item>
+ <item name="android:textColor">@color/sud_dynamic_color_accent_glif_v3_dark</item>
+ <item name="android:textAllCaps">false</item>
+ </style>
+
+ <style name="SudTextAppearanceDeviceDefaultMedium.Light" parent="SudTextAppearanceDeviceDefaultMedium">
+ <item name="android:textColor">@color/sud_dynamic_color_accent_glif_v3_light</item>
+ </style>
+
+ <style name="SudThemeGlif" parent="SudBaseThemeGlif">
+ <item name="sucSystemNavBarBackgroundColor">?android:attr/navigationBarColor</item>
+ <item name="android:windowSplashScreenBackground">?android:attr/colorBackground</item>
+ </style>
+
+ <style name="SudThemeGlif.Light" parent="SudBaseThemeGlif.Light">
+ <item name="sucSystemNavBarBackgroundColor">?android:attr/navigationBarColor</item>
+ <item name="android:windowSplashScreenBackground">?android:attr/colorBackground</item>
+ </style>
+
+ <style name="SudThemeGlifV3" parent="SudBaseThemeGlifV3">
+
+ <!-- Copied from v27 SudThemeGlifV3 -->
+ <item name="android:navigationBarColor">@color/sud_glif_v3_nav_bar_color_dark</item>
+ <item name="android:navigationBarDividerColor" tools:ignore="NewApi">@color/sud_glif_v3_nav_bar_divider_color_dark</item>
+ <item name="android:windowLightNavigationBar" tools:ignore="NewApi">false</item>
+ <item name="sucLightSystemNavBar" tools:ignore="NewApi">?android:attr/windowLightNavigationBar</item>
+ <item name="sucSystemNavBarDividerColor" tools:ignore="NewApi">?android:attr/navigationBarDividerColor</item>
+
+ <!-- Default font family-->
+ <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault</item>
+ <item name="android:textAppearanceInverse">@android:style/TextAppearance.DeviceDefault.Inverse</item>
+ <item name="android:textAppearanceLarge">@android:style/TextAppearance.DeviceDefault.Large</item>
+ <item name="android:textAppearanceMedium">@android:style/TextAppearance.DeviceDefault.Medium</item>
+ <!-- For textView -->
+ <item name="android:textAppearanceSmall">@android:style/TextAppearance.DeviceDefault.Small</item>
+ <item name="android:textAppearanceLargeInverse">@android:style/TextAppearance.DeviceDefault.Large.Inverse</item>
+ <!-- For editText -->
+ <item name="android:textAppearanceMediumInverse">@android:style/TextAppearance.DeviceDefault.Medium.Inverse</item>
+ <item name="android:textAppearanceSmallInverse">@android:style/TextAppearance.DeviceDefault.Small.Inverse</item>
+ <item name="android:textAppearanceSearchResultTitle">@android:style/TextAppearance.DeviceDefault.SearchResult.Title</item>
+ <item name="android:textAppearanceSearchResultSubtitle">@android:style/TextAppearance.DeviceDefault.SearchResult.Subtitle</item>
+ <item name="android:textAppearanceButton">@android:style/TextAppearance.DeviceDefault.Widget.Button</item>
+ <item name="android:textAppearanceLargePopupMenu">@android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Large</item>
+ <item name="android:textAppearanceSmallPopupMenu">@android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Small</item>
+ </style>
+
+ <style name="SudThemeGlifV3.Light" parent="SudBaseThemeGlifV3.Light">
+
+ <!-- Copied from v27 SudThemeGlifV3.Light -->
+ <item name="android:navigationBarColor">@color/sud_glif_v3_nav_bar_color_light</item>
+ <item name="android:navigationBarDividerColor">@color/sud_glif_v3_nav_bar_divider_color_light</item>
+ <item name="android:windowLightNavigationBar">true</item>
+ <item name="sucLightSystemNavBar" tools:ignore="NewApi">?android:attr/windowLightNavigationBar</item>
+ <item name="sucSystemNavBarDividerColor" tools:ignore="NewApi">?android:attr/navigationBarDividerColor</item>
+
+ <!-- Default font family-->
+ <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault</item>
+ <item name="android:textAppearanceInverse">@android:style/TextAppearance.DeviceDefault.Inverse</item>
+ <item name="android:textAppearanceLarge">@android:style/TextAppearance.DeviceDefault.Large</item>
+ <item name="android:textAppearanceMedium">@android:style/TextAppearance.DeviceDefault.Medium</item>
+ <!-- For textView -->
+ <item name="android:textAppearanceSmall">@android:style/TextAppearance.DeviceDefault.Small</item>
+ <item name="android:textAppearanceLargeInverse">@android:style/TextAppearance.DeviceDefault.Large.Inverse</item>
+ <!-- For editText -->
+ <item name="android:textAppearanceMediumInverse">@android:style/TextAppearance.DeviceDefault.Medium.Inverse</item>
+ <item name="android:textAppearanceSmallInverse">@android:style/TextAppearance.DeviceDefault.Small.Inverse</item>
+ <item name="android:textAppearanceSearchResultTitle">@android:style/TextAppearance.DeviceDefault.SearchResult.Title</item>
+ <item name="android:textAppearanceSearchResultSubtitle">@android:style/TextAppearance.DeviceDefault.SearchResult.Subtitle</item>
+ <item name="android:textAppearanceButton">@android:style/TextAppearance.DeviceDefault.Widget.Button</item>
+ <item name="android:textAppearanceLargePopupMenu">@android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Large</item>
+ <item name="android:textAppearanceSmallPopupMenu">@android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Small</item>
+ </style>
+
</resources>
diff --git a/main/res/values-v33/colors.xml b/main/res/values-v33/colors.xml
new file mode 100644
index 0000000..c46c6fc
--- /dev/null
+++ b/main/res/values-v33/colors.xml
@@ -0,0 +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/attrs.xml b/main/res/values/attrs.xml
index c946912..d739189 100644
--- a/main/res/values/attrs.xml
+++ b/main/res/values/attrs.xml
@@ -24,6 +24,7 @@
<attr name="sudEditTextBackgroundColor" format="color" />
<attr name="sudButtonHighlightAlpha" format="float" />
+ <attr name="sudGlifHeaderTitleStyle" format="reference" />
<!-- Subset of values in "gravity" in frameworks/base/core/res/res/values/attrs.xml. Only
horizontal values are listed here as the header does not support vertical gravity. -->
<attr name="sudGlifHeaderGravity">
@@ -59,6 +60,8 @@
<attr name="sudGlifIconStyle" format="reference" />
<attr name="sudGlifIconSize" format="dimension" />
+ <attr name="sudGlifDescriptionStyle" format="reference" />
+
<attr name="sudButtonAllCaps" format="boolean" />
<attr name="sudButtonCornerRadius" format="dimension" />
<attr name="sudButtonFontFamily" format="string|reference" />
@@ -112,11 +115,28 @@
<attr name="sudDividerInsetEnd" format="dimension|reference" />
<attr name="sudDividerInsetStart" format="dimension|reference" />
<attr name="sudDividerInsetStartNoIcon" format="dimension|reference" />
+ <attr name="sudDividerShown" format="boolean"/>
+ <attr name="sudItemContainerStyle" format="reference"/>
+ <attr name="sudItemIconContainerStyle" format="reference"/>
+ <attr name="sudItemTitleStyle" format="reference"/>
+ <attr name="sudItemSummaryStyle" format="reference"/>
<attr name="sudItemDescriptionStyle" format="reference" />
<attr name="sudItemDescriptionTitleStyle" format="reference" />
+ <attr name="sudItemDescriptionTitleTextAppearence" format="reference" />
+ <attr name="sudItemVerboseTitleStyle" format="reference" />
<attr name="sudContentFramePaddingTop" format="dimension|reference" />
<attr name="sudContentFramePaddingBottom" format="dimension|reference" />
+ <!-- EditBox -->
+ <attr name="sudEditBoxStyle" format="reference" />
+ <attr name="sudEditBoxColor" format="reference" />
+ <attr name="boxCornerRadiusTopStart" format="dimension"/>
+ <attr name="boxCornerRadiusTopEnd" format="dimension"/>
+ <attr name="boxCornerRadiusBottomStart" format="dimension"/>
+ <attr name="boxCornerRadiusBottomEnd" format="dimension"/>
+
+ <attr name="sudGlifContentPaddingTop" format="dimension|reference" />
+
<attr name="sudHasStableIds" format="boolean|reference" />
<declare-styleable name="SudIllustration">
@@ -187,6 +207,7 @@
<attr name="android:summary" />
<attr name="android:title" />
<attr name="android:visible" />
+ <attr name="android:contentDescription" />
<attr name="sudIconTint" />
<attr name="sudIconGravity" />
</declare-styleable>
@@ -215,6 +236,7 @@
<attr name="sudDividerInset" />
<attr name="sudDividerInsetEnd" />
<attr name="sudDividerInsetStart" />
+ <attr name="sudDividerShown" />
</declare-styleable>
<declare-styleable name="SudRecyclerItemAdapter">
@@ -259,4 +281,10 @@
</declare-styleable>
<attr name="sudLoadingHeaderHeight" format="dimension|reference" />
+
+ <!-- Glif Switch Bar style -->
+ <attr name="sudSwitchBarThumbOnColor" format="color|reference" />
+ <attr name="sudSwitchBarThumbOffColor" format="color|reference" />
+ <attr name="sudSwitchBarTrackOnColor" format="color|reference" />
+ <attr name="sudSwitchBarTrackOffColor" format="color|reference" />
</resources>
diff --git a/main/res/values/colors.xml b/main/res/values/colors.xml
index 798abc9..75fd097 100644
--- a/main/res/values/colors.xml
+++ b/main/res/values/colors.xml
@@ -73,18 +73,40 @@
<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_accent2_100">#FFE8DEF8</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>
+
+ <color name="sud_system_neutral1_300">#ababab</color>
+
+ <color name="sud_system_neutral1_400">#909090</color>
+
+ <color name="sud_system_neutral1_500">#757575</color>
+
+ <color name="sud_system_neutral1_600">#5e5e5e</color>
+
+ <color name="sud_system_neutral1_700">#464646</color>
+
<color name="sud_system_neutral1_800">#303030</color>
<color name="sud_system_neutral1_900">#1b1b1b</color>
+ <color name="sud_system_neutral1_1000">#000000</color>
+
<color name="sud_system_neutral2_50">#f0f0f0</color>
@@ -140,10 +162,23 @@
<color name="sud_portal_pending_progress">@color/sud_portal_pending_progress_light</color>
- <color name="sud_switch_track_off">#FF757575</color>
- <color name="sud_switch_thumb_off">#BFFFFFFF</color>
+
+ <color name="sud_switch_track_off_light">#FF55575E</color>
+ <color name="sud_switch_thumb_off_light">#FFA5ACB2</color>
+ <color name="sud_switch_track_off_dark">#FF454749</color>
+ <color name="sud_switch_thumb_off_dark">#FF8F9193</color>
+
+ <color name="sud_switch_track_on_light">#3B78E7</color>
+
+ <color name="sud_switch_thumb_on_light">#C6DAFC</color>
+
+ <color name="sud_switch_track_on_dark">#824285F4</color>
+
+ <color name="sud_switch_thumb_on_dark">#C6DAFC</color>
<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/config.xml b/main/res/values/config.xml
index dafc0dd..de724a3 100644
--- a/main/res/values/config.xml
+++ b/main/res/values/config.xml
@@ -25,8 +25,10 @@
<!-- Secondary font for use with headings, title, and other non-body text -->
<string name="sudFontSecondary" translatable="false">google-sans</string>
+ <string name="sudFontSecondaryText" translatable="false">google-sans-text</string>
<string name="sudFontSecondaryMedium" translatable="false">google-sans-medium</string>
-
+ <!-- Material You button font family-->
+ <string name="sudFontSecondaryMediumMaterialYou" translatable="false">google-sans-text-medium</string>
<item name="sud_layout_description" type="id" />
</resources>
diff --git a/main/res/values/dimens.xml b/main/res/values/dimens.xml
index 64970c8..4b821a4 100644
--- a/main/res/values/dimens.xml
+++ b/main/res/values/dimens.xml
@@ -17,6 +17,21 @@
<resources xmlns:tools="http://schemas.android.com/tools">
+ <!-- Device default style -->
+
+ <!-- Copy from Widget.DeviceDefault.Button.ButtonBar.AlertDialog -->
+ <!-- Dialog button bar width -->
+ <dimen name="sud_alert_dialog_button_bar_width">64dp</dimen>
+ <!-- Dialog button bar height -->
+ <dimen name="sud_alert_dialog_button_bar_height">48dip</dimen>
+
+ <!-- Dialog button bar button text size -->
+ <dimen name="sud_alert_dialog_button_bar_button_text_size">14sp</dimen>
+ <!-- Dialog title text size -->
+ <dimen name="sud_alert_dialog_title_text_size">20sp</dimen>
+
+ <dimen name="sud_alert_dialog_title_text_size_material_you">24sp</dimen>
+
<!-- General -->
<dimen name="sud_layout_margin_sides">40dp</dimen>
@@ -33,10 +48,12 @@
<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>
+ <dimen name="sud_glif_content_padding_top">0dp</dimen>
+ <dimen name="sud_horizontal_icon_height">32dp</dimen>
<dimen name="sud_glif_alert_dialog_corner_radius">8dp</dimen>
<dimen name="sud_glif_v3_button_corner_radius">4dp</dimen>
@@ -143,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. -->
@@ -154,6 +176,68 @@
<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>
+ <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>
+ <dimen name="sud_glif_header_title_margin_top_material_you">24dp</dimen>
+ <dimen name="sud_glif_header_title_margin_bottom_material_you">0dp</dimen>
+ <dimen name="sud_glif_description_text_size_material_you">18sp</dimen>
+ <dimen name="sud_glif_description_margin_top_material_you">24dp</dimen>
+ <dimen name="sud_glif_description_margin_bottom_material_you">0dp</dimen>
+
+ <dimen name="sud_glif_icon_margin_top_material_you">32dp</dimen>
+ <dimen name="sud_glif_icon_max_height_material_you">48dp</dimen>
+
+ <!-- Items Material You -->
+ <dimen name="sud_items_padding_top_material_you">16dp</dimen>
+ <dimen name="sud_items_padding_bottom_material_you">16dp</dimen>
+ <dimen name="sud_items_title_text_size_material_you">20sp</dimen>
+ <dimen name="sud_items_summary_text_size_material_you">14sp</dimen>
+ <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 -->
@@ -181,12 +265,15 @@
<!-- Progress bar -->
<!-- The margin to compensate for the padding built-in to the widget itself -->
<dimen name="sud_progress_bar_margin_vertical">-7dp</dimen>
+ <dimen name="sud_progress_bar_margin_top">-7dp</dimen>
+ <dimen name="sud_progress_bar_margin_bottom">-7dp</dimen>
<dimen name="sud_glif_progress_bar_margin_vertical">7dp</dimen>
<dimen name="sud_glif_progress_bar_padding">40dp</dimen>
<!-- Edit Text dimensions -->
<dimen name="sud_edit_text_min_height">56dp</dimen>
<dimen name="sud_edit_text_padding_horizontal">12dp</dimen>
+ <dimen name="sud_edit_text_corner_radius">28dp</dimen>
<!-- SwitchItem -->
<dimen name="sud_switch_padding_start">16dp</dimen>
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml
index 4725735..d675c62 100644
--- a/main/res/values/styles.xml
+++ b/main/res/values/styles.xml
@@ -52,6 +52,7 @@
<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>
+ <item name="sudDividerShown">true</item>
<item name="sudItemDescriptionStyle">@style/SudItemContainer.Description</item>
<item name="sudItemDescriptionTitleStyle">@style/SudItemTitle</item>
<item name="sudListItemIconColor">@color/sud_list_item_icon_color_dark</item>
@@ -64,6 +65,13 @@
<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>
+ <item name="sudEditBoxStyle">@style/SudEditBoxTheme</item>
+ <item name="sudEditBoxColor">@color/sud_color_accent_dark</item>
+ <item name="sudItemContainerStyle">@style/SudItemContainer</item>
+ <item name="sudItemIconContainerStyle">@style/SudItemIconContainer</item>
+ <item name="sudItemTitleStyle">@style/SudItemTitle</item>
+ <item name="sudItemSummaryStyle">@style/SudItemSummaryGlif</item>
+ <item name="sudItemDescriptionTitleTextAppearence">@style/TextAppearance.SudDescription</item>
</style>
<style name="SudThemeMaterial.Light" parent="Theme.AppCompat.Light.NoActionBar">
@@ -99,6 +107,7 @@
<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>
+ <item name="sudDividerShown">true</item>
<item name="sudItemDescriptionStyle">@style/SudItemContainer.Description</item>
<item name="sudItemDescriptionTitleStyle">@style/SudItemTitle</item>
<item name="sudListItemIconColor">@color/sud_list_item_icon_color_light</item>
@@ -111,6 +120,13 @@
<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>
+ <item name="sudEditBoxStyle">@style/SudEditBoxTheme</item>
+ <item name="sudEditBoxColor">@color/sud_color_accent_light</item>
+ <item name="sudItemContainerStyle">@style/SudItemContainer</item>
+ <item name="sudItemIconContainerStyle">@style/SudItemIconContainer</item>
+ <item name="sudItemTitleStyle">@style/SudItemTitle</item>
+ <item name="sudItemSummaryStyle">@style/SudItemSummaryGlif</item>
+ <item name="sudItemDescriptionTitleTextAppearence">@style/TextAppearance.SudDescription</item>
</style>
<style name="SudBaseThemeGlif" parent="Theme.AppCompat.NoActionBar">
@@ -150,16 +166,20 @@
<item name="sudDividerInsetEnd">0dp</item>
<item name="sudDividerInsetStart">@dimen/sud_items_glif_icon_divider_inset</item>
<item name="sudDividerInsetStartNoIcon">@dimen/sud_items_glif_text_divider_inset</item>
+ <item name="sudDividerShown">true</item>
+ <item name="sudGlifHeaderTitleStyle">@style/SudGlifHeaderTitle</item>
<item name="sudGlifHeaderGravity">start</item>
<item name="sudGlifSubtitleGravity">start</item>
<item name="sucGlifHeaderMarginTop">@dimen/sud_glif_header_title_margin_top</item>
- <item name="sudGlifDescriptionMarginTop">@dimen/sud_glif_description_margin_top</item>
<item name="sucGlifHeaderMarginBottom">@dimen/sud_glif_header_title_margin_bottom</item>
+ <item name="sudGlifDescriptionStyle">@style/SudGlifDescription</item>
+ <item name="sudGlifDescriptionMarginTop">@dimen/sud_glif_description_margin_top</item>
<item name="sudGlifDescriptionMarginBottom">@dimen/sud_glif_description_margin_bottom</item>
<item name="sucHeaderContainerMarginBottom">@dimen/sud_header_container_margin_bottom</item>
<item name="sudGlifIconStyle">@style/SudGlifIcon</item>
<item name="sucGlifIconMarginTop">@dimen/sud_glif_icon_margin_top</item>
<item name="sudGlifIconSize">@dimen/sud_glif_icon_max_height</item>
+ <item name="sudGlifContentPaddingTop">@dimen/sud_glif_content_padding_top</item>
<item name="sudItemDescriptionStyle">@style/SudItemContainer.Description.Glif</item>
<item name="sudItemDescriptionTitleStyle">@style/SudItemTitle.GlifDescription</item>
<item name="sudListItemIconColor">@color/sud_list_item_icon_color_dark</item>
@@ -179,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>
@@ -187,6 +207,18 @@
<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>
+ <item name="sudSwitchBarThumbOnColor">@color/sud_switch_thumb_on_dark</item>
+ <item name="sudSwitchBarTrackOnColor">@color/sud_switch_track_on_dark</item>
+ <item name="sudSwitchBarThumbOffColor">@color/sud_switch_thumb_off_dark</item>
+ <item name="sudSwitchBarTrackOffColor">@color/sud_switch_track_off_dark</item>
+ <item name="sudEditBoxStyle">@style/SudEditBoxTheme</item>
+ <item name="sudEditBoxColor">@color/sud_color_accent_glif_dark</item>
+ <item name="sudItemContainerStyle">@style/SudItemContainer</item>
+ <item name="sudItemIconContainerStyle">@style/SudItemIconContainer</item>
+ <item name="sudItemTitleStyle">@style/SudItemTitle</item>
+ <item name="sudItemSummaryStyle">@style/SudItemSummaryGlif</item>
+ <item name="sudItemDescriptionTitleTextAppearence">@style/TextAppearance.SudDescription</item>
+ <item name="sudItemVerboseTitleStyle">@style/SudItemTitle.Verbose</item>
</style>
<style name="SudThemeGlif" parent="SudBaseThemeGlif"/>
@@ -227,16 +259,20 @@
<item name="sudDividerInsetEnd">0dp</item>
<item name="sudDividerInsetStart">@dimen/sud_items_glif_icon_divider_inset</item>
<item name="sudDividerInsetStartNoIcon">@dimen/sud_items_glif_text_divider_inset</item>
+ <item name="sudDividerShown">true</item>
+ <item name="sudGlifHeaderTitleStyle">@style/SudGlifHeaderTitle</item>
<item name="sudGlifHeaderGravity">start</item>
<item name="sudGlifSubtitleGravity">start</item>
<item name="sucGlifHeaderMarginTop">@dimen/sud_glif_header_title_margin_top</item>
- <item name="sudGlifDescriptionMarginTop">@dimen/sud_glif_description_margin_top</item>
<item name="sucGlifHeaderMarginBottom">@dimen/sud_glif_header_title_margin_bottom</item>
+ <item name="sudGlifDescriptionStyle">@style/SudGlifDescription</item>
+ <item name="sudGlifDescriptionMarginTop">@dimen/sud_glif_description_margin_top</item>
<item name="sudGlifDescriptionMarginBottom">@dimen/sud_glif_description_margin_bottom</item>
<item name="sucHeaderContainerMarginBottom">@dimen/sud_header_container_margin_bottom</item>
<item name="sudGlifIconStyle">@style/SudGlifIcon</item>
<item name="sucGlifIconMarginTop">@dimen/sud_glif_icon_margin_top</item>
<item name="sudGlifIconSize">@dimen/sud_glif_icon_max_height</item>
+ <item name="sudGlifContentPaddingTop">@dimen/sud_glif_content_padding_top</item>
<item name="sudItemDescriptionStyle">@style/SudItemContainer.Description.Glif</item>
<item name="sudItemDescriptionTitleStyle">@style/SudItemTitle.GlifDescription</item>
<item name="sudListItemIconColor">@color/sud_list_item_icon_color_light</item>
@@ -256,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>
@@ -264,6 +300,18 @@
<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>
+ <item name="sudSwitchBarThumbOnColor">@color/sud_switch_thumb_on_light</item>
+ <item name="sudSwitchBarTrackOnColor">@color/sud_switch_track_on_light</item>
+ <item name="sudSwitchBarThumbOffColor">@color/sud_switch_thumb_off_light</item>
+ <item name="sudSwitchBarTrackOffColor">@color/sud_switch_track_off_light</item>
+ <item name="sudEditBoxStyle">@style/SudEditBoxTheme</item>
+ <item name="sudEditBoxColor">@color/sud_color_accent_glif_light</item>
+ <item name="sudItemContainerStyle">@style/SudItemContainer</item>
+ <item name="sudItemIconContainerStyle">@style/SudItemIconContainer</item>
+ <item name="sudItemTitleStyle">@style/SudItemTitle</item>
+ <item name="sudItemSummaryStyle">@style/SudItemSummaryGlif</item>
+ <item name="sudItemDescriptionTitleTextAppearence">@style/TextAppearance.SudDescription</item>
+ <item name="sudItemVerboseTitleStyle">@style/SudItemTitle.Verbose</item>
</style>
<style name="SudThemeGlif.Light" parent="SudBaseThemeGlif.Light"/>
@@ -314,6 +362,7 @@
<item name="sudButtonAllCaps">false</item>
<item name="sudButtonCornerRadius">@dimen/sud_glif_v3_button_corner_radius</item>
<item name="sudButtonFontFamily">@string/sudFontSecondaryMedium</item>
+ <item name="sudEditBoxColor">@color/sud_color_accent_glif_v3_dark</item>
</style>
<style name="SudThemeGlifV3" parent="SudBaseThemeGlifV3" />
<style name="SudDynamicColorThemeGlifV3" parent="SudThemeGlifV3" />
@@ -327,26 +376,108 @@
<item name="sudButtonAllCaps">false</item>
<item name="sudButtonCornerRadius">@dimen/sud_glif_v3_button_corner_radius</item>
<item name="sudButtonFontFamily">@string/sudFontSecondaryMedium</item>
+ <item name="sudEditBoxColor">@color/sud_color_accent_glif_v3_light</item>
</style>
<style name="SudThemeGlifV3.Light" parent="SudBaseThemeGlifV3.Light" />
<style name="SudDynamicColorThemeGlifV3.Light" parent="SudThemeGlifV3.Light" />
<style name="SudFullDynamicColorThemeGlifV3.Light" parent="SudDynamicColorThemeGlifV3.Light" />
+ <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="sucFooterBarButtonFontFamily">@string/sudFontSecondaryMediumMaterialYou</item>
+ <item name="sucGlifIconMarginTop">@dimen/sud_glif_icon_margin_top_material_you</item>
+ <item name="sudButtonCornerRadius">@dimen/sud_footer_bar_button_radius_material_you</item>
+ <item name="sudGlifIconSize">@dimen/sud_glif_icon_max_height_material_you</item>
+ <item name="sudGlifHeaderTitleStyle">@style/SudGlifHeaderTitleMaterialYou</item>
+ <item name="sudGlifHeaderGravity">start</item>
+ <item name="sucGlifHeaderMarginTop">@dimen/sud_glif_header_title_margin_top_material_you</item>
+ <item name="sucGlifHeaderMarginBottom">@dimen/sud_glif_header_title_margin_bottom_material_you</item>
+ <item name="sudGlifDescriptionStyle">@style/SudGlifDescriptionMaterialYou</item>
+ <item name="sudGlifDescriptionMarginTop">@dimen/sud_glif_description_margin_top_material_you</item>
+ <item name="sudGlifDescriptionMarginBottom">@dimen/sud_glif_description_margin_bottom_material_you</item>
+ <item name="textAppearanceListItem">@style/TextAppearance.SudMaterialYouItemTitle</item>
+ <item name="textAppearanceListItemSmall">@style/TextAppearance.SudMaterialYouItemSummary</item>
+ <item name="sudItemDescriptionTitleTextAppearence">@style/TextAppearance.SudMaterialYouDescription</item>
+ <item name="sudDividerShown">false</item>
+ <item name="sudItemContainerStyle">@style/SudItemContainerMaterialYou</item>
+ <item name="sudItemTitleStyle">@style/SudItemTitleMaterialYou</item>
+ <item name="sudItemSummaryStyle">@style/SudItemSummaryMaterialYou</item>
+ <item name="sudItemDescriptionTitleStyle">@style/SudItemTitleMaterialYou</item>
+ <item name="sudItemDescriptionStyle">@style/SudItemContainerMaterialYou.Description</item>
+ <item name="sudItemVerboseTitleStyle">@style/SudMaterialYouItemTitle.Verbose</item>
+ <item name="alertDialogTheme">@style/SudMaterialYouAlertDialogThemeCompat</item>
+ <item name="android:alertDialogTheme" >@style/SudMaterialYouAlertDialogTheme</item>
+ </style>
+
+ <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="sucFooterBarButtonFontFamily">@string/sudFontSecondaryMediumMaterialYou</item>
+ <item name="sucGlifIconMarginTop">@dimen/sud_glif_icon_margin_top_material_you</item>
+ <item name="sudButtonCornerRadius">@dimen/sud_footer_bar_button_radius_material_you</item>
+ <item name="sudGlifIconSize">@dimen/sud_glif_icon_max_height_material_you</item>
+ <item name="sudGlifHeaderTitleStyle">@style/SudGlifHeaderTitleMaterialYou</item>
+ <item name="sudGlifHeaderGravity">start</item>
+ <item name="sucGlifHeaderMarginTop">@dimen/sud_glif_header_title_margin_top_material_you</item>
+ <item name="sucGlifHeaderMarginBottom">@dimen/sud_glif_header_title_margin_bottom_material_you</item>
+ <item name="sudGlifDescriptionStyle">@style/SudGlifDescriptionMaterialYou</item>
+ <item name="sudGlifDescriptionMarginTop">@dimen/sud_glif_description_margin_top_material_you</item>
+ <item name="sudGlifDescriptionMarginBottom">@dimen/sud_glif_description_margin_bottom_material_you</item>
+ <item name="textAppearanceListItem">@style/TextAppearance.SudMaterialYouItemTitle</item>
+ <item name="textAppearanceListItemSmall">@style/TextAppearance.SudMaterialYouItemSummary</item>
+ <item name="sudItemDescriptionTitleTextAppearence">@style/TextAppearance.SudMaterialYouDescription</item>
+ <item name="sudDividerShown">false</item>
+ <item name="sudItemContainerStyle">@style/SudItemContainerMaterialYou</item>
+ <item name="sudItemTitleStyle">@style/SudItemTitleMaterialYou</item>
+ <item name="sudItemSummaryStyle">@style/SudItemSummaryMaterialYou</item>
+ <item name="sudItemDescriptionTitleStyle">@style/SudItemTitleMaterialYou</item>
+ <item name="sudItemDescriptionStyle">@style/SudItemContainerMaterialYou.Description</item>
+ <item name="sudItemVerboseTitleStyle">@style/SudMaterialYouItemTitle.Verbose</item>
+ <item name="alertDialogTheme">@style/SudMaterialYouAlertDialogThemeCompat.Light</item>
+ <item name="android:alertDialogTheme" >@style/SudMaterialYouAlertDialogTheme.Light</item>
+ </style>
+
+ <style name="SudDynamicColorTheme" />
+ <style name="SudDynamicColorTheme.Light" />
+ <style name="SudFullDynamicColorTheme" parent="SudDynamicColorTheme"/>
+ <style name="SudFullDynamicColorTheme.Light" parent="SudDynamicColorTheme.Light" />
+
+
+ <!-- DayNight themes -->
+ <style name="SudThemeMaterial.DayNight" parent="SudThemeMaterial.Light" />
+ <style name="SudThemeGlif.DayNight" parent="SudThemeGlif.Light" />
+ <style name="SudThemeGlifV2.DayNight" parent="SudThemeGlifV2.Light" />
+ <style name="SudThemeGlifV3.DayNight" parent="SudThemeGlifV3.Light" />
+ <style name="SudThemeGlifV4.DayNight" parent="SudThemeGlifV4.Light" />
+
+ <!-- DynamicColor DayNight themes -->
+ <style name="SudDynamicColorThemeGlifV3.DayNight" parent="SudDynamicColorThemeGlifV3.Light" />
+ <style name="SudFullDynamicColorThemeGlifV3.DayNight" parent="SudFullDynamicColorThemeGlifV3.Light" />
+ <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>
<item name="android:activityOpenExitAnimation">@anim/sud_slide_next_out</item>
<item name="android:activityCloseEnterAnimation">@anim/sud_slide_back_in</item>
<item name="android:activityCloseExitAnimation">@anim/sud_slide_back_out</item>
</style>
-
- <!-- DayNight themes -->
- <style name="SudThemeMaterial.DayNight" parent="SudThemeMaterial.Light" />
- <style name="SudThemeGlif.DayNight" parent="SudThemeGlif.Light" />
- <style name="SudThemeGlifV2.DayNight" parent="SudThemeGlifV2.Light" />
- <style name="SudThemeGlifV3.DayNight" parent="SudThemeGlifV3.Light" />
- <style name="SudDynamicColorThemeGlifV3.DayNight" parent="SudDynamicColorThemeGlifV3.Light" />
- <style name="SudFullDynamicColorThemeGlifV3.DayNight" parent="SudFullDynamicColorThemeGlifV3.Light" />
-
<!-- Content styles -->
<!-- Ignore UnusedResources: Used by clients -->
@@ -601,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>
@@ -614,6 +745,14 @@
<style name="SudGlifButtonBar.Stackable" parent="SudGlifButtonBar">
<item name="android:gravity">center</item>
</style>
+ <!-- Edit box theme-->
+ <style name="SudEditBoxTheme">
+ <item name="colorPrimary">?attr/sudEditBoxColor</item>
+ <item name="boxCornerRadiusTopStart">@dimen/sud_edit_text_corner_radius</item>
+ <item name="boxCornerRadiusTopEnd">@dimen/sud_edit_text_corner_radius</item>
+ <item name="boxCornerRadiusBottomStart">@dimen/sud_edit_text_corner_radius</item>
+ <item name="boxCornerRadiusBottomEnd">@dimen/sud_edit_text_corner_radius</item>
+ </style>
<!-- Items styles -->
@@ -627,6 +766,20 @@
<item name="android:paddingTop">@dimen/sud_items_padding_top</item>
</style>
+ <style name="SudItemContainerMaterialYou">
+ <item name="android:paddingBottom">@dimen/sud_items_padding_bottom_material_you</item>
+ <item name="android:paddingEnd" tools:ignore="NewApi">?attr/listPreferredItemPaddingRight</item>
+ <item name="android:paddingLeft">?attr/listPreferredItemPaddingLeft</item>
+ <item name="android:paddingRight">?attr/listPreferredItemPaddingRight</item>
+ <item name="android:paddingStart" tools:ignore="NewApi">?attr/listPreferredItemPaddingLeft</item>
+ <item name="android:paddingTop">@dimen/sud_items_padding_top_material_you</item>
+ <item name="android:minHeight">@dimen/sud_items_min_height_material_you</item>
+ </style>
+
+ <style name="SudItemIconContainer">
+ <item name="android:layout_width">@dimen/sud_items_icon_container_width</item>
+ </style>
+
<style name="SudItemContainer.Description" parent="SudItemContainer">
<item name="android:paddingTop">@dimen/sud_description_margin_top</item>
<item name="android:paddingBottom">@dimen/sud_description_margin_bottom_lists</item>
@@ -647,10 +800,31 @@
<item name="android:textAppearance">?attr/textAppearanceListItemSmall</item>
</style>
+ <style name="SudItemSummaryGlif">
+ <item name="android:textAppearance">?attr/textAppearanceListItemSmall</item>
+ <item name="android:layout_marginBottom">@dimen/sud_items_padding_bottom_extra</item>
+ </style>
+
+ <style name="SudItemSummaryMaterialYou">
+ <item name="android:textAppearance">?attr/textAppearanceListItemSmall</item>
+ <item name="android:layout_marginBottom">@dimen/sud_items_padding_bottom_extra</item>
+ <item name="android:layout_marginTop">@dimen/sud_items_summary_margin_top_material_you</item>
+ </style>
+
+ <style name="SudItemContainerMaterialYou.Description" parent="SudItemContainerMaterialYou">
+ <item name="android:minHeight">0dp</item>
+ <item name="android:paddingTop">@dimen/sud_items_padding_top_material_you</item>
+ <item name="android:paddingBottom">@dimen/sud_items_padding_bottom_material_you</item>
+ </style>
+
<style name="SudItemTitle">
<item name="android:textAppearance">?attr/textAppearanceListItem</item>
</style>
+ <style name="SudItemTitleMaterialYou">
+ <item name="android:textAppearance">?attr/textAppearanceListItem</item>
+ </style>
+
<style name="SudItemTitle.GlifDescription" parent="SudItemTitle">
<item name="android:gravity">?attr/sudGlifHeaderGravity</item>
<item name="android:textAlignment" tools:targetApi="jelly_bean_mr1">gravity</item>
@@ -660,9 +834,13 @@
<item name="android:textAppearance">@style/TextAppearance.SudGlifBody</item>
</style>
+ <style name="SudMaterialYouItemTitle.Verbose" parent="SudItemTitle">
+ <item name="android:textAppearance">?attr/textAppearanceListItem</item>
+ </style>
+
<style name="SudItemTitle.SectionHeader" parent="SudItemTitle">
<item name="android:textSize">14sp</item>
- <item name="android:fontFamily">@string/sudFontSecondaryMedium</item>
+ <item name="android:fontFamily" tools:targetApi="jelly_bean">@string/sudFontSecondaryMedium</item>
</style>
<style name="SudSwitchStyle">
@@ -693,6 +871,26 @@
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/sudFontSecondary</item>
<item name="android:textAlignment" tools:targetApi="jelly_bean_mr1">gravity</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textDirection" tools:targetApi="jelly_bean_mr1">locale</item>
+ <item name="android:accessibilityHeading" tools:targetApi="p">true</item>
+ </style>
+
+ <style name="SudGlifHeaderTitleMaterialYou">
+ <!-- Before Honeycomb, layout_gravity is needed for FrameLayout to apply the margins -->
+ <item name="android:layout_gravity">top</item>
+ <item name="android:ellipsize">end</item>
+ <item name="android:maxLines">3</item>
+ <item name="android:gravity">?attr/sudGlifHeaderGravity</item>
+ <item name="android:layout_marginBottom">?attr/sucGlifHeaderMarginBottom</item>
+ <item name="android:layout_marginLeft">?attr/sudMarginStart</item>
+ <item name="android:layout_marginRight">?attr/sudMarginEnd</item>
+ <item name="android:layout_marginTop">?attr/sucGlifHeaderMarginTop</item>
+ <item name="android:fontFamily" tools:targetApi="jelly_bean">@string/sudFontSecondary</item>
+ <item name="android:textAlignment" tools:targetApi="jelly_bean_mr1">gravity</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textDirection" tools:targetApi="jelly_bean_mr1">locale</item>
+ <item name="android:accessibilityHeading" tools:targetApi="p">true</item>
+ <item name="android:textSize">@dimen/sud_glif_header_title_size_material_you</item>
</style>
<style name="SudGlifDescription" parent="SudDescription.Glif">
@@ -704,6 +902,24 @@
<item name="android:layout_marginEnd">?attr/sudMarginEnd</item>
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/sudFontSecondary</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textDirection" tools:targetApi="jelly_bean_mr1">locale</item>
+ </style>
+
+ <style name="SudGlifDescriptionMaterialYou">
+ <!-- Before Honeycomb, layout_gravity is needed for FrameLayout to apply the margins -->
+ <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault</item>
+ <item name="android:lineSpacingExtra">@dimen/sud_description_line_spacing_extra</item>
+ <item name="android:gravity">?attr/sudGlifHeaderGravity</item>
+ <item name="android:textAlignment" tools:targetApi="jelly_bean_mr1">gravity</item>
+ <item name="android:layout_marginTop">?attr/sudGlifDescriptionMarginTop</item>
+ <item name="android:layout_marginBottom">?attr/sudGlifDescriptionMarginBottom</item>
+ <item name="android:layout_marginLeft">?attr/sudMarginStart</item>
+ <item name="android:layout_marginStart">?attr/sudMarginStart</item>
+ <item name="android:layout_marginRight">?attr/sudMarginEnd</item>
+ <item name="android:layout_marginEnd">?attr/sudMarginEnd</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textDirection" tools:targetApi="jelly_bean_mr1">locale</item>
+ <item name="android:textSize">@dimen/sud_glif_description_text_size_material_you</item>
</style>
<style name="SudGlifHeaderContainer">
@@ -713,18 +929,24 @@
<style name="SudGlifIconContainer">
<item name="android:layout_marginLeft">?attr/sudMarginStart</item>
+ <item name="android:layout_marginStart" tools:ignore="NewApi">?attr/sudMarginStart</item>
<item name="android:layout_marginRight">?attr/sudMarginEnd</item>
+ <item name="android:layout_marginEnd" tools:ignore="NewApi">?attr/sudMarginEnd</item>
<item name="android:layout_marginTop">?attr/sucGlifIconMarginTop</item>
<item name="android:maxHeight">?attr/sudGlifIconSize</item>
</style>
<style name="SudGlifIcon">
- <item name="android:layout_marginLeft">?attr/sudMarginStart</item>
- <item name="android:layout_marginRight">?attr/sudMarginEnd</item>
- <item name="android:layout_marginTop">?attr/sucGlifIconMarginTop</item>
+ <item name="android:layout_marginTop">0dp</item>
+ <item name="android:layout_marginBottom">0dp</item>
+ <item name="android:layout_marginLeft">0dp</item>
+ <item name="android:layout_marginStart" tools:ignore="NewApi">0dp</item>
+ <item name="android:layout_marginRight">0dp</item>
+ <item name="android:layout_marginEnd" tools:ignore="NewApi">0dp</item>
<item name="android:adjustViewBounds">true</item>
<item name="android:maxHeight">?attr/sudGlifIconSize</item>
<item name="android:scaleType">centerInside</item>
+ <item name="android:layout_gravity">?attr/sudGlifHeaderGravity</item>
</style>
<style name="TextAppearance.SudGlifBody" parent="android:TextAppearance">
@@ -742,6 +964,23 @@
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
+ <style name="TextAppearance.SudMaterialYouItemTitle" parent="android:TextAppearance">
+ <item name="android:textSize">@dimen/sud_items_title_text_size_material_you</item>
+ <item name="android:fontFamily" tools:targetApi="jelly_bean">@string/sudFontSecondary</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ </style>
+
+ <style name="TextAppearance.SudMaterialYouItemSummary" parent="android:TextAppearance">
+ <item name="android:textSize">@dimen/sud_items_summary_text_size_material_you</item>
+ <item name="android:fontFamily" tools:targetApi="jelly_bean">@string/sudFontSecondaryText</item>
+ <item name="android:textColor">?android:attr/textColorSecondary</item>
+ </style>
+
+ <style name="TextAppearance.SudMaterialYouDescription" parent="TextAppearance.AppCompat.Medium">
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textSize">@dimen/sud_items_title_text_size_material_you</item>
+ <item name="android:fontFamily" tools:targetApi="jelly_bean">@string/sudFontSecondary</item>
+ </style>
<!-- Navigation bar styles -->
<style name="SudNavBarTheme">
@@ -796,6 +1035,22 @@
<style name="SudAlertDialogTheme" parent="SudAlertDialogThemeCompat"/>
<style name="SudAlertDialogTheme.Light" parent="SudAlertDialogThemeCompat.Light"/>
+ <style name="SudMaterialYouAlertDialogTitleStyle" parent="android:TextAppearance.DeviceDefault.WindowTitle">
+ <item name="android:textSize">@dimen/sud_alert_dialog_title_text_size_material_you</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ </style>
+
+ <style name="SudMaterialYouAlertDialogThemeCompat" parent="SudAlertDialogThemeCompat">
+ <item name="android:windowTitleStyle">@style/SudMaterialYouAlertDialogTitleStyle</item>
+ </style>
+
+ <style name="SudMaterialYouAlertDialogThemeCompat.Light" parent="SudAlertDialogThemeCompat.Light">
+ <item name="android:windowTitleStyle">@style/SudMaterialYouAlertDialogTitleStyle</item>
+ </style>
+
+ <style name="SudMaterialYouAlertDialogTheme" parent="SudMaterialYouAlertDialogThemeCompat"/>
+ <style name="SudMaterialYouAlertDialogTheme.Light" parent="SudMaterialYouAlertDialogThemeCompat.Light"/>
+
<style name="SudDateTimePickerDialogTheme" parent="Theme.AppCompat.Dialog">
<item name="android:textAllCaps">false</item>
<item name="colorAccent">@color/sud_color_accent_glif_v3_dark</item>
@@ -818,4 +1073,10 @@
<item name="android:switchMinWidth">@dimen/sud_switch_min_width</item>
</style>
+ <style name="SudLandContentContianerStyle">
+ <item name="android:layout_width">0dp</item>
+ <item name="android:layout_height">match_parent</item>
+ <item name="android:layout_weight">@dimen/sud_glif_land_content_area_weight</item>
+ <item name="android:focusedByDefault" tools:targetApi="o">true</item>
+ </style>
</resources>
diff --git a/main/src/com/google/android/setupdesign/DividerItemDecoration.java b/main/src/com/google/android/setupdesign/DividerItemDecoration.java
index df86b23..dabe36f 100644
--- a/main/src/com/google/android/setupdesign/DividerItemDecoration.java
+++ b/main/src/com/google/android/setupdesign/DividerItemDecoration.java
@@ -21,10 +21,10 @@
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import androidx.annotation.IntDef;
+import androidx.core.view.ViewCompat;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/main/src/com/google/android/setupdesign/GlifLayout.java b/main/src/com/google/android/setupdesign/GlifLayout.java
index 829e3d7..1b8c8f8 100644
--- a/main/src/com/google/android/setupdesign/GlifLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifLayout.java
@@ -50,7 +50,6 @@
import com.google.android.setupdesign.template.ScrollViewScrollHandlingDelegate;
import com.google.android.setupdesign.util.DescriptionStyler;
import com.google.android.setupdesign.util.LayoutStyler;
-import com.google.android.setupdesign.util.PartnerStyleHelper;
/**
* Layout for the GLIF theme used in Setup Wizard for N.
@@ -137,12 +136,13 @@
if (primaryColor != null) {
setPrimaryColor(primaryColor);
}
-
- if (applyPartnerHeavyThemeResource) {
+ if (shouldApplyPartnerHeavyThemeResource()) {
updateContentBackgroundColorWithPartnerConfig();
+ }
- View view = findManagedViewById(R.id.sud_layout_content);
- if (view != null) {
+ View view = findManagedViewById(R.id.sud_layout_content);
+ if (view != null) {
+ if (shouldApplyPartnerResource()) {
// The margin of content is defined by @style/SudContentFrame. The Setupdesign library
// cannot obtain the content resource ID of the client, so the value of the content margin
// cannot be adjusted through GlifLayout. If the margin sides are changed through the
@@ -150,10 +150,16 @@
// value of pading. In this way, the value of content margin plus padding will be equal to
// the value of partner config.
LayoutStyler.applyPartnerCustomizationExtraPaddingStyle(view);
+ }
- applyPartnerCustomizationContentPaddingTopStyle(view);
+ // {@class GlifPreferenceLayout} Inherited from {@class GlifRecyclerLayout}. The API would
+ // be called twice from GlifRecyclerLayout and GlifLayout, so it should skip the API here
+ // when the instance is GlifPreferenceLayout.
+ if (!(this instanceof GlifPreferenceLayout)) {
+ tryApplyPartnerCustomizationContentPaddingTopStyle(view);
}
}
+
updateLandscapeMiddleHorizontalSpacing();
ColorStateList backgroundColor =
@@ -177,6 +183,7 @@
getMixin(IconMixin.class).tryApplyPartnerCustomizationStyle();
getMixin(HeaderMixin.class).tryApplyPartnerCustomizationStyle();
getMixin(DescriptionMixin.class).tryApplyPartnerCustomizationStyle();
+ getMixin(ProgressBarMixin.class).tryApplyPartnerCustomizationStyle();
tryApplyPartnerCustomizationStyleToShortDescription();
}
@@ -196,59 +203,77 @@
protected void updateLandscapeMiddleHorizontalSpacing() {
int horizontalSpacing =
getResources().getDimensionPixelSize(R.dimen.sud_glif_land_middle_horizontal_spacing);
+ if (shouldApplyPartnerResource()
+ && PartnerConfigHelper.get(getContext())
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAND_MIDDLE_HORIZONTAL_SPACING)) {
+ horizontalSpacing =
+ (int)
+ PartnerConfigHelper.get(getContext())
+ .getDimension(getContext(), PartnerConfig.CONFIG_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 layoutMarginEnd;
+ if (shouldApplyPartnerResource()
+ && PartnerConfigHelper.get(getContext())
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_END)) {
+ 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());
- }
+ } else {
+ TypedArray a = getContext().obtainStyledAttributes(new int[] {R.attr.sudMarginEnd});
+ layoutMarginEnd = a.getDimensionPixelSize(0, 0);
+ a.recycle();
+ }
+ 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 layoutMarginStart;
+ if (shouldApplyPartnerResource()
+ && PartnerConfigHelper.get(getContext())
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) {
+ 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());
- }
+ } else {
+ TypedArray a = getContext().obtainStyledAttributes(new int[] {R.attr.sudMarginStart});
+ layoutMarginStart = a.getDimensionPixelSize(0, 0);
+ a.recycle();
+ }
+ 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());
}
}
}
@@ -472,14 +497,13 @@
}
@TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
- protected static void applyPartnerCustomizationContentPaddingTopStyle(View view) {
+ protected void tryApplyPartnerCustomizationContentPaddingTopStyle(View view) {
Context context = view.getContext();
boolean partnerPaddingTopAvailable =
PartnerConfigHelper.get(context)
.isPartnerConfigAvailable(PartnerConfig.CONFIG_CONTENT_PADDING_TOP);
- if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view)
- && partnerPaddingTopAvailable) {
+ if (shouldApplyPartnerResource() && partnerPaddingTopAvailable) {
int paddingTop =
(int)
PartnerConfigHelper.get(context)
diff --git a/main/src/com/google/android/setupdesign/GlifListLayout.java b/main/src/com/google/android/setupdesign/GlifListLayout.java
index 60f0343..89d0888 100644
--- a/main/src/com/google/android/setupdesign/GlifListLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifListLayout.java
@@ -76,7 +76,7 @@
View view = this.findManagedViewById(R.id.sud_landscape_content_area);
if (view != null) {
- applyPartnerCustomizationContentPaddingTopStyle(view);
+ tryApplyPartnerCustomizationContentPaddingTopStyle(view);
}
updateLandscapeMiddleHorizontalSpacing();
}
diff --git a/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java b/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java
index 5e75436..87f871c 100644
--- a/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java
@@ -77,7 +77,7 @@
View view = this.findManagedViewById(R.id.sud_landscape_content_area);
if (view != null) {
- applyPartnerCustomizationContentPaddingTopStyle(view);
+ tryApplyPartnerCustomizationContentPaddingTopStyle(view);
}
updateLandscapeMiddleHorizontalSpacing();
}
diff --git a/main/src/com/google/android/setupdesign/accessibility/LinkAccessibilityHelper.java b/main/src/com/google/android/setupdesign/accessibility/LinkAccessibilityHelper.java
index 1a55b25..237cd83 100644
--- a/main/src/com/google/android/setupdesign/accessibility/LinkAccessibilityHelper.java
+++ b/main/src/com/google/android/setupdesign/accessibility/LinkAccessibilityHelper.java
@@ -19,9 +19,6 @@
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
-import androidx.core.view.AccessibilityDelegateCompat;
-import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
-import androidx.core.view.accessibility.AccessibilityNodeProviderCompat;
import android.text.Layout;
import android.text.Spanned;
import android.text.style.ClickableSpan;
@@ -33,6 +30,9 @@
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
+import androidx.core.view.AccessibilityDelegateCompat;
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
+import androidx.core.view.accessibility.AccessibilityNodeProviderCompat;
import androidx.customview.widget.ExploreByTouchHelper;
import java.util.List;
diff --git a/main/src/com/google/android/setupdesign/items/ExpandableSwitchItem.java b/main/src/com/google/android/setupdesign/items/ExpandableSwitchItem.java
index 29eaf23..c934612 100644
--- a/main/src/com/google/android/setupdesign/items/ExpandableSwitchItem.java
+++ b/main/src/com/google/android/setupdesign/items/ExpandableSwitchItem.java
@@ -24,16 +24,16 @@
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
-import androidx.core.view.AccessibilityDelegateCompat;
-import androidx.core.view.ViewCompat;
-import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
-import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
+import androidx.core.view.AccessibilityDelegateCompat;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
import com.google.android.setupdesign.R;
import com.google.android.setupdesign.util.LayoutStyler;
import com.google.android.setupdesign.view.CheckableLinearLayout;
diff --git a/main/src/com/google/android/setupdesign/items/Item.java b/main/src/com/google/android/setupdesign/items/Item.java
index fd3f2eb..407eacb 100644
--- a/main/src/com/google/android/setupdesign/items/Item.java
+++ b/main/src/com/google/android/setupdesign/items/Item.java
@@ -44,6 +44,7 @@
private int layoutRes;
@Nullable private CharSequence summary;
@Nullable private CharSequence title;
+ @Nullable private CharSequence contentDescription;
private boolean visible = true;
@ColorInt private int iconTint = Color.TRANSPARENT;
private int iconGravity = Gravity.CENTER_VERTICAL;
@@ -60,10 +61,12 @@
icon = a.getDrawable(R.styleable.SudItem_android_icon);
title = a.getText(R.styleable.SudItem_android_title);
summary = a.getText(R.styleable.SudItem_android_summary);
+ contentDescription = a.getText(R.styleable.SudItem_android_contentDescription);
layoutRes = a.getResourceId(R.styleable.SudItem_android_layout, getDefaultLayoutResource());
visible = a.getBoolean(R.styleable.SudItem_android_visible, true);
iconTint = a.getColor(R.styleable.SudItem_sudIconTint, Color.TRANSPARENT);
iconGravity = a.getInt(R.styleable.SudItem_sudIconGravity, Gravity.CENTER_VERTICAL);
+
a.recycle();
}
@@ -143,6 +146,16 @@
return title;
}
+ @Nullable
+ public CharSequence getContentDescription() {
+ return contentDescription;
+ }
+
+ public void setContentDescription(@Nullable CharSequence contentDescription) {
+ this.contentDescription = contentDescription;
+ notifyItemChanged();
+ }
+
public void setVisible(boolean visible) {
if (this.visible == visible) {
return;
@@ -159,6 +172,10 @@
return visible;
}
+ private boolean hasSummary(CharSequence summary) {
+ return summary != null && summary.length() > 0;
+ }
+
@Override
public int getViewId() {
return getId();
@@ -171,13 +188,15 @@
TextView summaryView = (TextView) view.findViewById(R.id.sud_items_summary);
CharSequence summary = getSummary();
- if (summary != null && summary.length() > 0) {
+ if (hasSummary(summary)) {
summaryView.setText(summary);
summaryView.setVisibility(View.VISIBLE);
} else {
summaryView.setVisibility(View.GONE);
}
+ view.setContentDescription(getContentDescription());
+
final View iconContainer = view.findViewById(R.id.sud_items_icon_container);
final Drawable icon = getIcon();
if (icon != null) {
@@ -208,6 +227,7 @@
// get its child view to adjust it first, so skip the Layout padding adjustment.
// If the item view is a header layout, it doesn't need to adjust the layout padding start/end
// here. It will be adjusted by HeaderMixin.
+ // TODO: Add partner resource enable check
if (!(this instanceof ExpandableSwitchItem) && view.getId() != R.id.sud_layout_header) {
LayoutStyler.applyPartnerCustomizationLayoutPaddingStyle(view);
}
diff --git a/main/src/com/google/android/setupdesign/template/DescriptionMixin.java b/main/src/com/google/android/setupdesign/template/DescriptionMixin.java
index bbccf82..63e4f41 100644
--- a/main/src/com/google/android/setupdesign/template/DescriptionMixin.java
+++ b/main/src/com/google/android/setupdesign/template/DescriptionMixin.java
@@ -28,7 +28,6 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
-import com.google.android.setupcompat.PartnerCustomizationLayout;
import com.google.android.setupcompat.internal.TemplateLayout;
import com.google.android.setupcompat.template.Mixin;
import com.google.android.setupdesign.R;
@@ -79,21 +78,12 @@
/**
* Applies the partner customizations to the description text (contains text alignment) and
- * background, if apply heavy theme resource, it will apply all partner customizations, otherwise,
- * only apply alignment style.
+ * background. It will apply all partner customizations.
*/
public void tryApplyPartnerCustomizationStyle() {
TextView description = templateLayout.findManagedViewById(R.id.sud_layout_subtitle);
- boolean partnerHeavyThemeLayout = PartnerStyleHelper.isPartnerHeavyThemeLayout(templateLayout);
- if (partnerHeavyThemeLayout) {
- if (description != null) {
- HeaderAreaStyler.applyPartnerCustomizationDescriptionHeavyStyle(description);
- }
- } else if (templateLayout instanceof PartnerCustomizationLayout
- && ((PartnerCustomizationLayout) templateLayout).shouldApplyPartnerResource()) {
- if (description != null) {
- HeaderAreaStyler.applyPartnerCustomizationDescriptionLightStyle(description);
- }
+ if (description != null && PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) {
+ HeaderAreaStyler.applyPartnerCustomizationDescriptionHeavyStyle(description);
}
}
diff --git a/main/src/com/google/android/setupdesign/template/HeaderMixin.java b/main/src/com/google/android/setupdesign/template/HeaderMixin.java
index d040c94..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;
@@ -77,8 +79,8 @@
a.recycle();
- // overlay the Auto size config settings
- updateAutoTextSizeWithPartnerConfig();
+ // Try to update the flag of the uto size config settings
+ tryUpdateAutoTextSizeFlagWithPartnerConfig();
// Set the header text
if (headerText != null) {
@@ -90,10 +92,9 @@
}
}
- private void updateAutoTextSizeWithPartnerConfig() {
+ private void tryUpdateAutoTextSizeFlagWithPartnerConfig() {
Context context = templateLayout.getContext();
- if (!PartnerStyleHelper.isPartnerHeavyThemeLayout(templateLayout)
- || !PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)) {
+ if (!PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) {
autoTextSizeEnabled = false;
return;
}
@@ -149,18 +150,14 @@
*/
public void tryApplyPartnerCustomizationStyle() {
TextView header = templateLayout.findManagedViewById(R.id.suc_layout_title);
- boolean partnerLightThemeLayout = PartnerStyleHelper.isPartnerLightThemeLayout(templateLayout);
- boolean partnerHeavyThemeLayout = PartnerStyleHelper.isPartnerHeavyThemeLayout(templateLayout);
- if (partnerHeavyThemeLayout) {
+ if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) {
View headerAreaView = templateLayout.findManagedViewById(R.id.sud_layout_header);
- HeaderAreaStyler.applyPartnerCustomizationHeaderHeavyStyle(header);
- HeaderAreaStyler.applyPartnerCustomizationHeaderAreaStyle((ViewGroup) headerAreaView);
LayoutStyler.applyPartnerCustomizationExtraPaddingStyle(headerAreaView);
- // overlay the Auto size config settings
- updateAutoTextSizeWithPartnerConfig();
- } else if (partnerLightThemeLayout) {
- HeaderAreaStyler.applyPartnerCustomizationHeaderLightStyle(header);
+ HeaderAreaStyler.applyPartnerCustomizationHeaderStyle(header);
+ HeaderAreaStyler.applyPartnerCustomizationHeaderAreaStyle((ViewGroup) headerAreaView);
}
+ // Try to update the flag of the uto size config settings
+ tryUpdateAutoTextSizeFlagWithPartnerConfig();
if (autoTextSizeEnabled) {
// Override the text size setting of the header
autoAdjustTextSize(header);
diff --git a/main/src/com/google/android/setupdesign/template/IconMixin.java b/main/src/com/google/android/setupdesign/template/IconMixin.java
index 75e624a..3c2b6d0 100644
--- a/main/src/com/google/android/setupdesign/template/IconMixin.java
+++ b/main/src/com/google/android/setupdesign/template/IconMixin.java
@@ -71,8 +71,8 @@
context.obtainStyledAttributes(
attrs, R.styleable.SudIconMixin, defStyleAttr, /* defStyleRes= */ 0);
- final @DrawableRes int icon =
- a.getResourceId(R.styleable.SudIconMixin_android_icon, /* defValue= */ 0);
+ @DrawableRes
+ final int icon = a.getResourceId(R.styleable.SudIconMixin_android_icon, /* defValue= */ 0);
if (icon != 0) {
setIcon(icon);
}
@@ -81,8 +81,8 @@
a.getBoolean(R.styleable.SudIconMixin_sudUpscaleIcon, /* defValue= */ false);
setUpscaleIcon(upscaleIcon);
- final @ColorInt int iconTint =
- a.getColor(R.styleable.SudIconMixin_sudIconTint, Color.TRANSPARENT);
+ @ColorInt
+ final int iconTint = a.getColor(R.styleable.SudIconMixin_sudIconTint, Color.TRANSPARENT);
if (iconTint != Color.TRANSPARENT) {
setIconTint(iconTint);
}
@@ -92,12 +92,9 @@
/** Tries to apply the partner customization to the header icon. */
public void tryApplyPartnerCustomizationStyle() {
- if (PartnerStyleHelper.isPartnerHeavyThemeLayout(templateLayout)) {
- // apply partner heavy configs
+ // apply partner configs for icon
+ if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) {
HeaderAreaStyler.applyPartnerCustomizationIconStyle(getView(), getContainerView());
- } else if (PartnerStyleHelper.isPartnerLightThemeLayout(templateLayout)) {
- // apply partner light configs
- HeaderAreaStyler.applyPartnerCustomizationIconStyle(getView());
}
}
@@ -117,6 +114,7 @@
iconView.setImageDrawable(icon);
iconView.setVisibility(icon != null ? View.VISIBLE : View.GONE);
setIconContainerVisibility(iconView.getVisibility());
+ tryApplyPartnerCustomizationStyle();
}
}
diff --git a/main/src/com/google/android/setupdesign/template/ListMixin.java b/main/src/com/google/android/setupdesign/template/ListMixin.java
index 5963a79..1cd55f2 100644
--- a/main/src/com/google/android/setupdesign/template/ListMixin.java
+++ b/main/src/com/google/android/setupdesign/template/ListMixin.java
@@ -52,7 +52,6 @@
private int dividerInsetStart;
private int dividerInsetEnd;
-
/** @param layout The layout this mixin belongs to. */
public ListMixin(
@NonNull TemplateLayout layout, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
@@ -68,8 +67,8 @@
setAdapter(new ItemAdapter(inflated));
}
- boolean isDividerDisplay = isDividerShown(context);
- if (isDividerDisplay) {
+ boolean isDividerDisplay = a.getBoolean(R.styleable.SudListMixin_sudDividerShown, true);
+ if (isDividerShown(context, isDividerDisplay)) {
int dividerInset = a.getDimensionPixelSize(R.styleable.SudListMixin_sudDividerInset, -1);
if (dividerInset != -1) {
setDividerInset(dividerInset);
@@ -79,7 +78,7 @@
int dividerInsetEnd =
a.getDimensionPixelSize(R.styleable.SudListMixin_sudDividerInsetEnd, 0);
- if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(templateLayout)) {
+ if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) {
if (PartnerConfigHelper.get(context)
.isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) {
dividerInsetStart =
@@ -98,23 +97,22 @@
setDividerInsets(dividerInsetStart, dividerInsetEnd);
}
}
+ else{
+ getListView().setDivider(null);
+ }
a.recycle();
}
- private boolean isDividerShown(Context context) {
+ private boolean isDividerShown(Context context, boolean isDividerDisplay) {
if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) {
if (PartnerConfigHelper.get(context)
.isPartnerConfigAvailable(PartnerConfig.CONFIG_ITEMS_DIVIDER_SHOWN)) {
- boolean isDividerDisplayed =
+ isDividerDisplay =
PartnerConfigHelper.get(context)
.getBoolean(context, PartnerConfig.CONFIG_ITEMS_DIVIDER_SHOWN, true);
- if (!isDividerDisplayed) {
- getListView().setDivider(null);
- return isDividerDisplayed;
- }
}
}
- return true;
+ return isDividerDisplay;
}
/**
diff --git a/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java b/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java
index da1b997..ac5ac69 100644
--- a/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java
+++ b/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java
@@ -16,12 +16,14 @@
package com.google.android.setupdesign.template;
+import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.util.AttributeSet;
import android.view.View;
+import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.ProgressBar;
import androidx.annotation.AttrRes;
@@ -30,6 +32,8 @@
import com.google.android.setupcompat.internal.TemplateLayout;
import com.google.android.setupcompat.template.Mixin;
import com.google.android.setupdesign.R;
+import com.google.android.setupdesign.util.HeaderAreaStyler;
+import com.google.android.setupdesign.util.PartnerStyleHelper;
/** A {@link Mixin} for showing a progress bar. */
public class ProgressBarMixin implements Mixin {
@@ -178,4 +182,34 @@
public ColorStateList getColor() {
return color;
}
+
+ /**
+ * Tries to apply the partner customizations to the progress bar. Use the default values if
+ * partner config isn't enable.
+ */
+ public void tryApplyPartnerCustomizationStyle() {
+ ProgressBar progressBar = peekProgressBar();
+ if (!useBottomProgressBar || progressBar == null) {
+ return;
+ }
+
+ boolean partnerHeavyThemeLayout = PartnerStyleHelper.isPartnerHeavyThemeLayout(templateLayout);
+
+ if (partnerHeavyThemeLayout) {
+ HeaderAreaStyler.applyPartnerCustomizationProgressBarStyle(progressBar);
+ } else {
+ Context context = progressBar.getContext();
+ final ViewGroup.LayoutParams lp = progressBar.getLayoutParams();
+
+ if (lp instanceof ViewGroup.MarginLayoutParams) {
+ int marginTop =
+ (int) context.getResources().getDimension(R.dimen.sud_progress_bar_margin_top);
+ int marginBottom =
+ (int) context.getResources().getDimension(R.dimen.sud_progress_bar_margin_bottom);
+
+ final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp;
+ mlp.setMargins(mlp.leftMargin, marginTop, mlp.rightMargin, marginBottom);
+ }
+ }
+ }
}
diff --git a/main/src/com/google/android/setupdesign/template/RecyclerMixin.java b/main/src/com/google/android/setupdesign/template/RecyclerMixin.java
index b327060..46b2faf 100644
--- a/main/src/com/google/android/setupdesign/template/RecyclerMixin.java
+++ b/main/src/com/google/android/setupdesign/template/RecyclerMixin.java
@@ -17,6 +17,7 @@
package com.google.android.setupdesign.template;
import android.content.Context;
+import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
@@ -26,6 +27,7 @@
import androidx.recyclerview.widget.RecyclerView.Adapter;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import android.util.AttributeSet;
+import android.util.TypedValue;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -90,22 +92,31 @@
header = ((HeaderRecyclerView) recyclerView).getHeader();
}
- isDividerDisplay = isShowItemsDivider();
+ isDividerDisplay = isShowItemsDivider(layout.getContext());
if (isDividerDisplay) {
this.recyclerView.addItemDecoration(dividerDecoration);
}
}
- private boolean isShowItemsDivider() {
+ private boolean isShowItemsDivider(Context context) {
+ // Get the dividershown attribute value from theme
+ TypedValue typedValue = new TypedValue();
+ Theme theme = context.getTheme();
+ theme.resolveAttribute(R.attr.sudDividerShown, typedValue, true);
+ boolean isShownDivider = (typedValue.data != 0);
+
// Skips to add item decoration if config flag is false.
if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) {
if (PartnerConfigHelper.get(recyclerView.getContext())
.isPartnerConfigAvailable(PartnerConfig.CONFIG_ITEMS_DIVIDER_SHOWN)) {
return PartnerConfigHelper.get(recyclerView.getContext())
- .getBoolean(recyclerView.getContext(), PartnerConfig.CONFIG_ITEMS_DIVIDER_SHOWN, true);
+ .getBoolean(
+ recyclerView.getContext(),
+ PartnerConfig.CONFIG_ITEMS_DIVIDER_SHOWN,
+ isShownDivider);
}
}
- return true;
+ return isShownDivider;
}
/**
@@ -154,7 +165,7 @@
int dividerInsetEnd =
a.getDimensionPixelSize(R.styleable.SudRecyclerMixin_sudDividerInsetEnd, 0);
- if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(templateLayout)) {
+ if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) {
if (PartnerConfigHelper.get(context)
.isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) {
dividerInsetStart =
@@ -269,6 +280,11 @@
return dividerInsetEnd;
}
+ /** Remove the divider inset from this RecyclerView. */
+ public void removeDividerInset() {
+ recyclerView.removeItemDecoration(dividerDecoration);
+ }
+
private void updateDivider() {
boolean shouldUpdate = true;
if (Build.VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
@@ -295,6 +311,10 @@
return divider;
}
+ public boolean hasDivider() {
+ return isDividerDisplay;
+ }
+
/**
* Sets the divider item decoration directly. This is a low level method which should be used only
* if custom divider behavior is needed, for example if the divider should be shown / hidden in
diff --git a/main/src/com/google/android/setupdesign/util/ContentStyler.java b/main/src/com/google/android/setupdesign/util/ContentStyler.java
index d390780..5fc1d1c 100644
--- a/main/src/com/google/android/setupdesign/util/ContentStyler.java
+++ b/main/src/com/google/android/setupdesign/util/ContentStyler.java
@@ -41,6 +41,7 @@
*/
public final class ContentStyler {
public static void applyBodyPartnerCustomizationStyle(TextView contentText) {
+ // TODO: Remove the check of applying the heavy theme.
if (!PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(contentText)) {
return;
}
@@ -52,6 +53,7 @@
PartnerConfig.CONFIG_CONTENT_LINK_TEXT_COLOR,
PartnerConfig.CONFIG_CONTENT_TEXT_SIZE,
PartnerConfig.CONFIG_CONTENT_FONT_FAMILY,
+ PartnerConfig.CONFIG_DESCRIPTION_LINK_FONT_FAMILY,
null,
null,
ContentStyler.getPartnerContentTextGravity(contentText.getContext())));
@@ -68,6 +70,7 @@
*/
public static void applyInfoPartnerCustomizationStyle(
@Nullable View infoContainer, @Nullable ImageView infoIcon, TextView infoText) {
+ // TODO: Remove the check of applying the heavy theme.
if (!PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(infoText)) {
return;
}
@@ -80,6 +83,9 @@
boolean fontFamilyConfigAvailable =
PartnerConfigHelper.get(context)
.isPartnerConfigAvailable(PartnerConfig.CONFIG_CONTENT_INFO_FONT_FAMILY);
+ boolean linkFontFamilyConfigAvailable =
+ PartnerConfigHelper.get(context)
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_DESCRIPTION_LINK_FONT_FAMILY);
TextViewPartnerStyler.applyPartnerCustomizationStyle(
infoText,
@@ -88,6 +94,9 @@
null,
textSizeConfigAvailable ? PartnerConfig.CONFIG_CONTENT_INFO_TEXT_SIZE : null,
fontFamilyConfigAvailable ? PartnerConfig.CONFIG_CONTENT_INFO_FONT_FAMILY : null,
+ linkFontFamilyConfigAvailable
+ ? PartnerConfig.CONFIG_DESCRIPTION_LINK_FONT_FAMILY
+ : null,
null,
null,
0));
@@ -128,7 +137,9 @@
(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);
}
@@ -183,13 +194,11 @@
// default value is GlifTheme layout margin start.
// That is the attr sudMarginStart, and the value is sud_layout_margin_sides.
float result = context.getResources().getDimension(R.dimen.sud_layout_margin_sides);
- if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(context)) {
- if (PartnerConfigHelper.get(context)
- .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) {
- result =
- PartnerConfigHelper.get(context)
- .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_START, result);
- }
+ if (PartnerConfigHelper.get(context)
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) {
+ result =
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_START, result);
}
return result;
}
diff --git a/main/src/com/google/android/setupdesign/util/DescriptionStyler.java b/main/src/com/google/android/setupdesign/util/DescriptionStyler.java
index 0a786c6..b779bc6 100644
--- a/main/src/com/google/android/setupdesign/util/DescriptionStyler.java
+++ b/main/src/com/google/android/setupdesign/util/DescriptionStyler.java
@@ -41,6 +41,7 @@
PartnerConfig.CONFIG_DESCRIPTION_LINK_TEXT_COLOR,
PartnerConfig.CONFIG_DESCRIPTION_TEXT_SIZE,
PartnerConfig.CONFIG_DESCRIPTION_FONT_FAMILY,
+ PartnerConfig.CONFIG_DESCRIPTION_LINK_FONT_FAMILY,
null,
null,
PartnerStyleHelper.getLayoutGravity(description.getContext())));
@@ -62,6 +63,7 @@
null,
null,
null,
+ null,
PartnerStyleHelper.getLayoutGravity(description.getContext())));
}
diff --git a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
index 2db8c75..ad66cb6 100644
--- a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
+++ b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
@@ -19,7 +19,6 @@
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;
@@ -27,8 +26,6 @@
/** The class to get dynamic colors. */
public final class DynamicColorPalette {
- @VisibleForTesting static int colorRes = 0;
-
private DynamicColorPalette() {}
/** Dynamic color category. */
@@ -41,7 +38,8 @@
ColorType.ERROR_WARNING,
ColorType.SUCCESS_DONE,
ColorType.FALLBACK_ACCENT,
- ColorType.BACKGROUND_SURFACE,
+ ColorType.BACKGROUND,
+ ColorType.SURFACE,
})
public @interface ColorType {
int ACCENT = 0;
@@ -51,11 +49,14 @@
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;
@@ -78,9 +79,12 @@
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/HeaderAreaStyler.java b/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
index 1b3daac..e233219 100644
--- a/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
+++ b/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
@@ -19,6 +19,7 @@
import static com.google.android.setupcompat.util.BuildCompatUtils.isAtLeastS;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import android.graphics.drawable.VectorDrawable;
import android.os.Build;
import android.os.Build.VERSION;
@@ -30,12 +31,14 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
+import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
import com.google.android.setupcompat.partnerconfig.PartnerConfig;
import com.google.android.setupcompat.partnerconfig.PartnerConfigHelper;
+import com.google.android.setupdesign.R;
import com.google.android.setupdesign.util.TextViewPartnerStyler.TextPartnerConfigs;
/**
@@ -51,11 +54,11 @@
"To achieve scaling icon in SetupDesign lib, should use vector drawable icon from ";
/**
- * Applies the partner heavy style of header text to the given textView {@code header}.
+ * Applies the partner style of header text to the given textView {@code header}.
*
- * @param header A header text would apply partner heavy style
+ * @param header A header text would apply partner style
*/
- public static void applyPartnerCustomizationHeaderHeavyStyle(@Nullable TextView header) {
+ public static void applyPartnerCustomizationHeaderStyle(@Nullable TextView header) {
if (header == null) {
return;
@@ -67,6 +70,7 @@
null,
PartnerConfig.CONFIG_HEADER_TEXT_SIZE,
PartnerConfig.CONFIG_HEADER_FONT_FAMILY,
+ null,
PartnerConfig.CONFIG_HEADER_TEXT_MARGIN_TOP,
PartnerConfig.CONFIG_HEADER_TEXT_MARGIN_BOTTOM,
PartnerStyleHelper.getLayoutGravity(header.getContext())));
@@ -90,59 +94,13 @@
PartnerConfig.CONFIG_DESCRIPTION_LINK_TEXT_COLOR,
PartnerConfig.CONFIG_DESCRIPTION_TEXT_SIZE,
PartnerConfig.CONFIG_DESCRIPTION_FONT_FAMILY,
+ PartnerConfig.CONFIG_DESCRIPTION_LINK_FONT_FAMILY,
PartnerConfig.CONFIG_DESCRIPTION_TEXT_MARGIN_TOP,
PartnerConfig.CONFIG_DESCRIPTION_TEXT_MARGIN_BOTTOM,
PartnerStyleHelper.getLayoutGravity(description.getContext())));
}
/**
- * Applies the partner light style of header text to the given textView {@code header}.
- *
- * @param header A header text would apply partner light style
- */
- public static void applyPartnerCustomizationHeaderLightStyle(@Nullable TextView header) {
-
- if (header == null) {
- return;
- }
-
- TextViewPartnerStyler.applyPartnerCustomizationLightStyle(
- header,
- new TextPartnerConfigs(
- null,
- null,
- null,
- null,
- null,
- null,
- PartnerStyleHelper.getLayoutGravity(header.getContext())));
- }
-
- /**
- * Applies the partner light style of description text to the given textView {@code description}.
- *
- * @param description A description text would apply partner light style
- */
- public static void applyPartnerCustomizationDescriptionLightStyle(
- @Nullable TextView description) {
-
- if (description == null) {
- return;
- }
-
- TextViewPartnerStyler.applyPartnerCustomizationLightStyle(
- description,
- new TextPartnerConfigs(
- null,
- null,
- null,
- null,
- null,
- null,
- PartnerStyleHelper.getLayoutGravity(description.getContext())));
- }
-
- /**
* Applies the partner style of header area to the given layout {@code headerArea}. The theme
* should set partner heavy theme first, and then the partner style of header would be applied. As
* for the margin bottom of header, it would also be appied when heavy theme parter config is
@@ -154,34 +112,72 @@
if (headerArea == null) {
return;
}
- if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(headerArea)) {
- Context context = headerArea.getContext();
- int color =
- PartnerConfigHelper.get(context)
- .getColor(context, PartnerConfig.CONFIG_HEADER_AREA_BACKGROUND_COLOR);
- headerArea.setBackgroundColor(color);
+ Context context = headerArea.getContext();
+ int color =
+ PartnerConfigHelper.get(context)
+ .getColor(context, PartnerConfig.CONFIG_HEADER_AREA_BACKGROUND_COLOR);
+ headerArea.setBackgroundColor(color);
+ if (PartnerConfigHelper.get(context)
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_HEADER_CONTAINER_MARGIN_BOTTOM)) {
+ final ViewGroup.LayoutParams lp = headerArea.getLayoutParams();
+ if (lp instanceof ViewGroup.MarginLayoutParams) {
+ final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp;
+
+ int bottomMargin =
+ (int)
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_HEADER_CONTAINER_MARGIN_BOTTOM);
+ mlp.setMargins(mlp.leftMargin, mlp.topMargin, mlp.rightMargin, bottomMargin);
+ headerArea.setLayoutParams(lp);
+ }
+ }
+ }
+
+ public static void applyPartnerCustomizationProgressBarStyle(@Nullable ProgressBar progressBar) {
+ if (progressBar == null) {
+ return;
+ }
+ Context context = progressBar.getContext();
+ final ViewGroup.LayoutParams lp = progressBar.getLayoutParams();
+
+ if (lp instanceof ViewGroup.MarginLayoutParams) {
+ final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp;
+ int marginTop = mlp.topMargin;
if (PartnerConfigHelper.get(context)
- .isPartnerConfigAvailable(PartnerConfig.CONFIG_HEADER_CONTAINER_MARGIN_BOTTOM)) {
- final ViewGroup.LayoutParams lp = headerArea.getLayoutParams();
- if (lp instanceof ViewGroup.MarginLayoutParams) {
- final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp;
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_PROGRESS_BAR_MARGIN_TOP)) {
+ marginTop =
+ (int)
+ PartnerConfigHelper.get(context)
+ .getDimension(
+ context,
+ PartnerConfig.CONFIG_PROGRESS_BAR_MARGIN_TOP,
+ context.getResources().getDimension(R.dimen.sud_progress_bar_margin_top));
+ }
+ int marginBottom = mlp.bottomMargin;
+ if (PartnerConfigHelper.get(context)
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_PROGRESS_BAR_MARGIN_BOTTOM)) {
+ marginBottom =
+ (int)
+ PartnerConfigHelper.get(context)
+ .getDimension(
+ context,
+ PartnerConfig.CONFIG_PROGRESS_BAR_MARGIN_BOTTOM,
+ context
+ .getResources()
+ .getDimension(R.dimen.sud_progress_bar_margin_bottom));
+ }
- int bottomMargin =
- (int)
- PartnerConfigHelper.get(context)
- .getDimension(context, PartnerConfig.CONFIG_HEADER_CONTAINER_MARGIN_BOTTOM);
- mlp.setMargins(mlp.leftMargin, mlp.topMargin, mlp.rightMargin, bottomMargin);
- headerArea.setLayoutParams(lp);
- }
+ if (marginTop != mlp.topMargin || marginBottom != mlp.bottomMargin) {
+ mlp.setMargins(mlp.leftMargin, marginTop, mlp.rightMargin, marginBottom);
}
}
}
/**
- * Applies the partner heavy style of header icon to the given {@code iconImage}. The theme should
- * check partner heavy theme first, and then the partner icon size would be applied.
+ * Applies the partner style of header icon to the given {@code iconImage}. It needs to check if
+ * it should apply partner resource first, and then the partner icon size would be applied.
*
* @param iconImage A ImageView would apply the partner style of header icon
* @param iconContainer The container of the header icon
@@ -193,11 +189,36 @@
}
Context context = iconImage.getContext();
+ int reducedIconHeight = 0;
int gravity = PartnerStyleHelper.getLayoutGravity(context);
if (gravity != 0) {
setGravity(iconImage, gravity);
}
+ if (PartnerConfigHelper.get(context).isPartnerConfigAvailable(PartnerConfig.CONFIG_ICON_SIZE)) {
+ checkImageType(iconImage);
+
+ final ViewGroup.LayoutParams lpIcon = iconImage.getLayoutParams();
+
+ lpIcon.height =
+ (int)
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_ICON_SIZE);
+
+ lpIcon.width = LayoutParams.WRAP_CONTENT;
+ iconImage.setScaleType(ScaleType.FIT_CENTER);
+
+ Drawable drawable = iconImage.getDrawable();
+ if (drawable != null && drawable.getIntrinsicWidth() > (2 * drawable.getIntrinsicHeight())) {
+ int fixedIconHeight =
+ (int) context.getResources().getDimension(R.dimen.sud_horizontal_icon_height);
+ if (lpIcon.height > fixedIconHeight) {
+ reducedIconHeight = lpIcon.height - fixedIconHeight;
+ lpIcon.height = fixedIconHeight;
+ }
+ }
+ }
+
final ViewGroup.LayoutParams lp = iconContainer.getLayoutParams();
boolean partnerConfigAvailable =
PartnerConfigHelper.get(context)
@@ -208,32 +229,9 @@
(int)
PartnerConfigHelper.get(context)
.getDimension(context, PartnerConfig.CONFIG_ICON_MARGIN_TOP);
+ topMargin += reducedIconHeight;
mlp.setMargins(mlp.leftMargin, topMargin, mlp.rightMargin, mlp.bottomMargin);
}
-
- if (PartnerConfigHelper.get(context).isPartnerConfigAvailable(PartnerConfig.CONFIG_ICON_SIZE)) {
-
- checkImageType(iconImage);
-
- final ViewGroup.LayoutParams lpIcon = iconImage.getLayoutParams();
- lpIcon.height =
- (int)
- PartnerConfigHelper.get(context)
- .getDimension(context, PartnerConfig.CONFIG_ICON_SIZE);
- lpIcon.width = LayoutParams.WRAP_CONTENT;
- iconImage.setScaleType(ScaleType.FIT_CENTER);
- }
- }
-
- /** Applies the partner light style of header icon to the given {@code iconImage}. */
- public static void applyPartnerCustomizationIconStyle(@Nullable ImageView iconImage) {
- if (iconImage == null) {
- return;
- }
- int gravity = PartnerStyleHelper.getLayoutGravity(iconImage.getContext());
- if (gravity != 0) {
- setGravity(iconImage, gravity);
- }
}
private static void checkImageType(ImageView imageView) {
diff --git a/main/src/com/google/android/setupdesign/util/ItemStyler.java b/main/src/com/google/android/setupdesign/util/ItemStyler.java
index ecddfd4..5dbf0a4 100644
--- a/main/src/com/google/android/setupdesign/util/ItemStyler.java
+++ b/main/src/com/google/android/setupdesign/util/ItemStyler.java
@@ -95,6 +95,7 @@
PartnerConfig.CONFIG_ITEMS_TITLE_FONT_FAMILY,
null,
null,
+ null,
PartnerStyleHelper.getLayoutGravity(titleTextView.getContext())));
}
@@ -116,6 +117,7 @@
null,
PartnerConfig.CONFIG_ITEMS_SUMMARY_TEXT_SIZE,
PartnerConfig.CONFIG_ITEMS_SUMMARY_FONT_FAMILY,
+ null,
PartnerConfig.CONFIG_ITEMS_SUMMARY_MARGIN_TOP,
null,
PartnerStyleHelper.getLayoutGravity(summaryTextView.getContext())));
diff --git a/main/src/com/google/android/setupdesign/util/LayoutStyler.java b/main/src/com/google/android/setupdesign/util/LayoutStyler.java
index b707521..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;
@@ -52,7 +54,9 @@
PartnerConfigHelper.get(context)
.isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_END);
- if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view)
+ // TODO: After all users added the check before calling the API, this check can be
+ // deleted.
+ if (PartnerStyleHelper.shouldApplyPartnerResource(view)
&& (partnerMarginStartAvailable || partnerMarginEndAvailable)) {
int paddingStart;
int paddingEnd;
@@ -101,7 +105,9 @@
PartnerConfigHelper.get(context)
.isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_END);
- if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view)
+ // TODO: After all users added the check before calling the API, this check can be
+ // deleted.
+ if (PartnerStyleHelper.shouldApplyPartnerResource(view)
&& (partnerMarginStartAvailable || partnerMarginEndAvailable)) {
int extraPaddingStart;
int extraPaddingEnd;
@@ -115,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();
@@ -125,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());
+ }
}
}
}
diff --git a/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java b/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java
index 7b4acea..b56d09a 100644
--- a/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java
+++ b/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java
@@ -26,6 +26,7 @@
import androidx.annotation.Nullable;
import com.google.android.setupcompat.partnerconfig.PartnerConfig;
import com.google.android.setupcompat.partnerconfig.PartnerConfigHelper;
+import com.google.android.setupdesign.view.RichTextView;
/** Helper class to apply partner configurations to a textView. */
final class TextViewPartnerStyler {
@@ -85,8 +86,44 @@
}
}
+ if (textView instanceof RichTextView && textPartnerConfigs.getLinkTextFontFamilyConfig() != null
+ && PartnerConfigHelper.get(context)
+ .isPartnerConfigAvailable(textPartnerConfigs.getLinkTextFontFamilyConfig())) {
+ String linkFontFamilyName =
+ PartnerConfigHelper.get(context)
+ .getString(context, textPartnerConfigs.getLinkTextFontFamilyConfig());
+ Typeface linkFont = Typeface.create(linkFontFamilyName, Typeface.NORMAL);
+ if (linkFont != null) {
+ ((RichTextView) textView).setSpanTypeface(linkFont);
+ }
+ }
+
+ applyPartnerCustomizationVerticalMargins(textView, textPartnerConfigs);
+ textView.setGravity(textPartnerConfigs.getTextGravity());
+ }
+
+ /**
+ * Applies given partner configurations {@code textPartnerConfigs} to the {@code textView}.
+ *
+ * @param textView A text view would apply the gravity
+ * @param textPartnerConfigs A partner conflagrations contains text gravity would be set
+ */
+ public static void applyPartnerCustomizationLightStyle(
+ @NonNull TextView textView, @NonNull TextPartnerConfigs textPartnerConfigs) {
+
+ if (textView == null || textPartnerConfigs == null) {
+ return;
+ }
+
+ applyPartnerCustomizationVerticalMargins(textView, textPartnerConfigs);
+ textView.setGravity(textPartnerConfigs.getTextGravity());
+ }
+
+ private static void applyPartnerCustomizationVerticalMargins(
+ @NonNull TextView textView, @NonNull TextPartnerConfigs textPartnerConfigs) {
if (textPartnerConfigs.getTextMarginTop() != null
|| textPartnerConfigs.getTextMarginBottom() != null) {
+ Context context = textView.getContext();
int topMargin;
int bottomMargin;
final ViewGroup.LayoutParams lp = textView.getLayoutParams();
@@ -117,23 +154,6 @@
textView.setLayoutParams(lp);
}
}
- textView.setGravity(textPartnerConfigs.getTextGravity());
- }
-
- /**
- * Applies given partner configurations {@code textPartnerConfigs} to the {@code textView}.
- *
- * @param textView A text view would apply the gravity
- * @param textPartnerConfigs A partner conflagrations contains text gravity would be set
- */
- public static void applyPartnerCustomizationLightStyle(
- @NonNull TextView textView, @NonNull TextPartnerConfigs textPartnerConfigs) {
-
- if (textView == null || textPartnerConfigs == null) {
- return;
- }
-
- textView.setGravity(textPartnerConfigs.getTextGravity());
}
/** Keeps the partner conflagrations for a textView. */
@@ -142,6 +162,7 @@
private final PartnerConfig textLinkedColorConfig;
private final PartnerConfig textSizeConfig;
private final PartnerConfig textFontFamilyConfig;
+ private final PartnerConfig textLinkFontFamilyConfig;
private final PartnerConfig textMarginTopConfig;
private final PartnerConfig textMarginBottomConfig;
private final int textGravity;
@@ -151,6 +172,7 @@
@Nullable PartnerConfig textLinkedColorConfig,
@Nullable PartnerConfig textSizeConfig,
@Nullable PartnerConfig textFontFamilyConfig,
+ @Nullable PartnerConfig textLinkFontFamilyConfig,
@Nullable PartnerConfig textMarginTopConfig,
@Nullable PartnerConfig textMarginBottomConfig,
int textGravity) {
@@ -158,6 +180,7 @@
this.textLinkedColorConfig = textLinkedColorConfig;
this.textSizeConfig = textSizeConfig;
this.textFontFamilyConfig = textFontFamilyConfig;
+ this.textLinkFontFamilyConfig = textLinkFontFamilyConfig;
this.textMarginTopConfig = textMarginTopConfig;
this.textMarginBottomConfig = textMarginBottomConfig;
this.textGravity = textGravity;
@@ -179,6 +202,10 @@
return textFontFamilyConfig;
}
+ public PartnerConfig getLinkTextFontFamilyConfig() {
+ return textLinkFontFamilyConfig;
+ }
+
public PartnerConfig getTextMarginTop() {
return textMarginTopConfig;
}
diff --git a/main/src/com/google/android/setupdesign/util/ThemeHelper.java b/main/src/com/google/android/setupdesign/util/ThemeHelper.java
index 0b750c9..eeee7dd 100644
--- a/main/src/com/google/android/setupdesign/util/ThemeHelper.java
+++ b/main/src/com/google/android/setupdesign/util/ThemeHelper.java
@@ -71,12 +71,14 @@
public static final String THEME_GLIF_V3_LIGHT = "glif_v3_light";
/**
- * Placeholder, not avirailed yet.
+ * Passed in a setup wizard intent as {@link WizardManagerHelper#EXTRA_THEME}. This is the dark
+ * variant of the theme used in setup wizard for T.
*/
public static final String THEME_GLIF_V4 = "glif_v4";
/**
- * Placeholder, not avirailed yet.
+ * Passed in a setup wizard intent as {@link WizardManagerHelper#EXTRA_THEME}. This is the default
+ * theme used in setup wizard for T.
*/
public static final String THEME_GLIF_V4_LIGHT = "glif_v4_light";
@@ -166,16 +168,14 @@
return PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context);
}
- /**
- * 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 true if the SetupWizard is flow enabled "Material You(Glifv4)" style. */
+ public static boolean shouldApplyMaterialYouStyle(@NonNull Context context) {
+ return PartnerConfigHelper.shouldApplyMaterialYouStyle(context);
}
/** Returns {@code true} if this {@code context} should apply dynamic color. */
public static boolean shouldApplyDynamicColor(@NonNull Context context) {
- return shouldApplyExtendedPartnerConfig(context) && isSetupWizardDynamicColorEnabled(context);
+ return PartnerConfigHelper.isSetupWizardDynamicColorEnabled(context);
}
/**
@@ -203,19 +203,19 @@
// return theme for inside setup flow
resId =
isDayNightEnabled
- ? R.style.SudDynamicColorThemeGlifV3_DayNight
- : R.style.SudDynamicColorThemeGlifV3_Light;
+ ? R.style.SudDynamicColorTheme_DayNight
+ : R.style.SudDynamicColorTheme_Light;
} else {
// return theme for outside setup flow
resId =
isDayNightEnabled
- ? R.style.SudFullDynamicColorThemeGlifV3_DayNight
- : R.style.SudFullDynamicColorThemeGlifV3_Light;
+ ? R.style.SudFullDynamicColorTheme_DayNight
+ : R.style.SudFullDynamicColorTheme_Light;
LOG.atInfo(
"Return "
+ (isDayNightEnabled
- ? "SudFullDynamicColorThemeGlifV3_DayNight"
- : "SudFullDynamicColorThemeGlifV3_Light"));
+ ? "SudFullDynamicColorTheme_DayNight"
+ : "SudFullDynamicColorTheme_Light"));
}
LOG.atDebug(
@@ -237,12 +237,12 @@
/** Returns {@code true} if the dynamic color is set. */
public static boolean trySetDynamicColor(@NonNull Context context) {
- if (!shouldApplyExtendedPartnerConfig(context)) {
- LOG.w("SetupWizard does not supports the extended partner configs.");
+ if (!BuildCompatUtils.isAtLeastS()) {
+ LOG.w("Dynamic color require platform version at least S.");
return false;
}
- if (!isSetupWizardDynamicColorEnabled(context)) {
+ if (!shouldApplyDynamicColor(context)) {
LOG.w("SetupWizard does not support the dynamic color or supporting status unknown.");
return false;
}
diff --git a/main/src/com/google/android/setupdesign/util/ThemeResolver.java b/main/src/com/google/android/setupdesign/util/ThemeResolver.java
index c7a28b1..d90b104 100644
--- a/main/src/com/google/android/setupdesign/util/ThemeResolver.java
+++ b/main/src/com/google/android/setupdesign/util/ThemeResolver.java
@@ -156,6 +156,9 @@
private static int getDayNightThemeRes(@Nullable String theme) {
if (theme != null) {
switch (theme) {
+ case ThemeHelper.THEME_GLIF_V4_LIGHT:
+ case ThemeHelper.THEME_GLIF_V4:
+ return R.style.SudThemeGlifV4_DayNight;
case ThemeHelper.THEME_GLIF_V3_LIGHT:
case ThemeHelper.THEME_GLIF_V3:
return R.style.SudThemeGlifV3_DayNight;
@@ -183,6 +186,10 @@
private static int getThemeRes(@Nullable String theme) {
if (theme != null) {
switch (theme) {
+ case ThemeHelper.THEME_GLIF_V4_LIGHT:
+ return R.style.SudThemeGlifV4_Light;
+ case ThemeHelper.THEME_GLIF_V4:
+ return R.style.SudThemeGlifV4;
case ThemeHelper.THEME_GLIF_V3_LIGHT:
return R.style.SudThemeGlifV3_Light;
case ThemeHelper.THEME_GLIF_V3:
@@ -218,6 +225,9 @@
private static int getThemeVersion(String theme) {
if (theme != null) {
switch (theme) {
+ case ThemeHelper.THEME_GLIF_V4_LIGHT:
+ case ThemeHelper.THEME_GLIF_V4:
+ return 5;
case ThemeHelper.THEME_GLIF_V3_LIGHT:
case ThemeHelper.THEME_GLIF_V3:
return 4;
diff --git a/main/src/com/google/android/setupdesign/view/IconUniformityAppImageView.java b/main/src/com/google/android/setupdesign/view/IconUniformityAppImageView.java
index 9f0e21d..d4e6ad8 100644
--- a/main/src/com/google/android/setupdesign/view/IconUniformityAppImageView.java
+++ b/main/src/com/google/android/setupdesign/view/IconUniformityAppImageView.java
@@ -25,11 +25,11 @@
import android.graphics.RectF;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
-import androidx.annotation.ColorRes;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.widget.ImageView;
+import androidx.annotation.ColorRes;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.google.android.setupdesign.R;
diff --git a/main/src/com/google/android/setupdesign/view/IntrinsicSizeFrameLayout.java b/main/src/com/google/android/setupdesign/view/IntrinsicSizeFrameLayout.java
index d02839b..ffb3d70 100644
--- a/main/src/com/google/android/setupdesign/view/IntrinsicSizeFrameLayout.java
+++ b/main/src/com/google/android/setupdesign/view/IntrinsicSizeFrameLayout.java
@@ -16,13 +16,23 @@
package com.google.android.setupdesign.view;
+import static java.lang.Math.min;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
+import android.graphics.Rect;
+import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.util.AttributeSet;
+import android.util.DisplayMetrics;
+import android.view.Display;
import android.view.ViewGroup;
+import android.view.WindowInsets;
+import android.view.WindowManager;
+import android.view.WindowMetrics;
import android.widget.FrameLayout;
+import androidx.annotation.VisibleForTesting;
import com.google.android.setupcompat.partnerconfig.PartnerConfig;
import com.google.android.setupcompat.partnerconfig.PartnerConfigHelper;
import com.google.android.setupcompat.util.BuildCompatUtils;
@@ -40,6 +50,10 @@
private int intrinsicHeight = 0;
private int intrinsicWidth = 0;
+ private Object lastInsets; // Use generic Object type for compatibility
+
+ // Define here to avoid allocating resource during layout/draw operation.
+ private final Rect windowVisibleDisplayRect = new Rect();
public IntrinsicSizeFrameLayout(Context context) {
super(context);
@@ -105,9 +119,47 @@
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(
- getIntrinsicMeasureSpec(widthMeasureSpec, intrinsicWidth),
- getIntrinsicMeasureSpec(heightMeasureSpec, intrinsicHeight));
+ int measureWidth;
+
+ // The the content may be truncated if the layout show in multi-window mode or two pane mode,
+ // because the given width is fixed size which based on the display to compute. So the width
+ // the content may be truncated. Make the layout width align window while window width smaller
+ // than display size.
+ if (isWindowSizeSmallerThanDisplaySize()) {
+ getWindowVisibleDisplayFrame(windowVisibleDisplayRect);
+
+ measureWidth =
+ MeasureSpec.makeMeasureSpec(windowVisibleDisplayRect.width(), MeasureSpec.EXACTLY);
+ } else {
+ measureWidth = getIntrinsicMeasureSpec(widthMeasureSpec, intrinsicWidth);
+ }
+
+ super.onMeasure(measureWidth, getIntrinsicMeasureSpec(heightMeasureSpec, intrinsicHeight));
+ }
+
+ @VisibleForTesting
+ boolean isWindowSizeSmallerThanDisplaySize() {
+ boolean result = false;
+ /// NOMUTANTS--reason(b/221151816): Support setCurrentWindowMetrics from ShadowWindowManagerImpl
+ // to verify this case
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ WindowManager windowManager = getContext().getSystemService(WindowManager.class);
+ WindowMetrics windowMetrics = windowManager.getCurrentWindowMetrics();
+ windowVisibleDisplayRect.set(windowMetrics.getBounds());
+
+ Display display = getDisplay();
+ if (display != null) {
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ display.getRealMetrics(displayMetrics);
+
+ if (windowVisibleDisplayRect.width() > 0
+ && windowVisibleDisplayRect.width() < displayMetrics.widthPixels) {
+ result = true;
+ }
+ }
+ }
+
+ return result;
}
private int getIntrinsicMeasureSpec(int measureSpec, int intrinsicSize) {
@@ -123,9 +175,25 @@
} else if (mode == MeasureSpec.AT_MOST) {
// If intrinsic size is within parents constraint, take the intrinsic size.
// Otherwise take the parents size because that's closest to the intrinsic size.
- return MeasureSpec.makeMeasureSpec(Math.min(size, intrinsicHeight), MeasureSpec.EXACTLY);
+ return MeasureSpec.makeMeasureSpec(min(size, intrinsicHeight), MeasureSpec.EXACTLY);
}
// Parent specified EXACTLY, or in all other cases, just return the original spec
return measureSpec;
}
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ if (Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
+ if (lastInsets == null) {
+ requestApplyInsets();
+ }
+ }
+ }
+
+ @Override
+ public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ lastInsets = insets;
+ return super.onApplyWindowInsets(insets);
+ }
}
diff --git a/main/src/com/google/android/setupdesign/view/RichTextView.java b/main/src/com/google/android/setupdesign/view/RichTextView.java
index f3348b4..182981f 100644
--- a/main/src/com/google/android/setupdesign/view/RichTextView.java
+++ b/main/src/com/google/android/setupdesign/view/RichTextView.java
@@ -16,11 +16,13 @@
package com.google.android.setupdesign.view;
+import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
import android.content.Context;
+import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
-import androidx.core.view.ViewCompat;
import androidx.appcompat.widget.AppCompatTextView;
import android.text.Annotation;
import android.text.SpannableString;
@@ -32,6 +34,8 @@
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
+import androidx.annotation.VisibleForTesting;
+import androidx.core.view.ViewCompat;
import com.google.android.setupdesign.accessibility.LinkAccessibilityHelper;
import com.google.android.setupdesign.span.LinkSpan;
import com.google.android.setupdesign.span.LinkSpan.OnLinkClickListener;
@@ -51,6 +55,8 @@
private static final String ANNOTATION_LINK = "link";
private static final String ANNOTATION_TEXT_APPEARANCE = "textAppearance";
+ @VisibleForTesting static Typeface spanTypeface;
+
/**
* Replace <annotation> tags in strings to become their respective types. Currently 2 types
* are supported:
@@ -62,6 +68,8 @@
* android.text.style.TextAppearanceSpan} with @style/TextAppearance.FooBar
* </ol>
*/
+ @TargetApi(28)
+ @SuppressLint("NewApi")
public static CharSequence getRichText(Context context, CharSequence text) {
if (text instanceof Spanned) {
final SpannableString spannable = new SpannableString(text);
@@ -81,7 +89,10 @@
SpanHelper.replaceSpan(spannable, span, textAppearanceSpan);
} else if (ANNOTATION_LINK.equals(key)) {
LinkSpan link = new LinkSpan(span.getValue());
- TypefaceSpan typefaceSpan = new TypefaceSpan("sans-serif-medium");
+ TypefaceSpan typefaceSpan =
+ (spanTypeface != null)
+ ? new TypefaceSpan(spanTypeface)
+ : new TypefaceSpan("sans-serif-medium");
SpanHelper.replaceSpan(spannable, span, link, typefaceSpan);
}
}
@@ -114,6 +125,17 @@
ViewCompat.setAccessibilityDelegate(this, accessibilityHelper);
}
+ /**
+ * Sets the typeface in which the text should be displayed. The default typeface is {@code
+ * "sans-serif-medium"}
+ *
+ * @throws java.lang.NoSuchMethodError if sdk lower than {@code VERSION_CODES.P}
+ */
+ @TargetApi(VERSION_CODES.P)
+ public void setSpanTypeface(Typeface typeface) {
+ spanTypeface = typeface;
+ }
+
@Override
public void setText(CharSequence text, BufferType type) {
text = getRichText(getContext(), text);
diff --git a/strings/AndroidManifest.xml b/strings/AndroidManifest.xml
index e8316f3..7461fc6 100644
--- a/strings/AndroidManifest.xml
+++ b/strings/AndroidManifest.xml
@@ -20,6 +20,6 @@
<uses-sdk
android:minSdkVersion="14"
- android:targetSdkVersion="28" />
+ android:targetSdkVersion="32" />
</manifest>