diff options
92 files changed, 456 insertions, 2345 deletions
@@ -34,7 +34,6 @@ android_library { "androidx.appcompat_appcompat", "androidx.recyclerview_recyclerview", "com.google.android.material_material", - "error_prone_annotations", "setupcompat", "setupdesign-strings", ], @@ -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 - -cipson@google.com #{LAST_RESORT_SUGGESTION} -luyota@google.com #{LAST_RESORT_SUGGESTION} +yukl@google.com diff --git a/exempting_lint_checks.txt b/exempting_lint_checks.txt index 949488a..201fd64 100644 --- a/exempting_lint_checks.txt +++ b/exempting_lint_checks.txt @@ -47,45 +47,3 @@ third_party/java_src/android_libs/setupdesign/main/src/com/google/android/setupd 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 3053930..3cf1948 100644 --- a/lottie_loading_layout/AndroidManifest.xml +++ b/lottie_loading_layout/AndroidManifest.xml @@ -20,6 +20,6 @@ <uses-sdk android:minSdkVersion="14" - android:targetSdkVersion="32" /> + android:targetSdkVersion="30" /> </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 ef0ba71..65e20a9 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" - style="@style/SudLandContentContianerStyle" - android:focusedByDefault="false" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="@dimen/sud_glif_land_content_area_weight" 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 deleted file mode 100644 index e5e1bb5..0000000 --- a/lottie_loading_layout/res/layout-sw600dp-land-v31/sud_glif_fullscreen_loading_template_content.xml +++ /dev/null @@ -1,103 +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. ---> -<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 deleted file mode 100644 index 8cd6af2..0000000 --- a/lottie_loading_layout/res/layout-sw600dp-v31/sud_glif_fullscreen_loading_template_card.xml +++ /dev/null @@ -1,49 +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. ---> - -<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 deleted file mode 100644 index 97f86be..0000000 --- a/lottie_loading_layout/res/layout-sw600dp-v31/sud_glif_fullscreen_loading_template_content.xml +++ /dev/null @@ -1,96 +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. ---> -<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 deleted file mode 100644 index 8c98e74..0000000 --- a/lottie_loading_layout/res/layout-sw600dp-v31/sud_loading_fullscreen_lottie_layout.xml +++ /dev/null @@ -1,34 +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. ---> - -<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 c5d36ef..8415324 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> +</LinearLayout>
\ No newline at end of file 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 8873b42..0f60d02 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,29 +22,18 @@ android:layout_height="match_parent" android:orientation="vertical"> - <com.google.android.setupdesign.view.FillContentLayout - android:orientation="vertical" - android:paddingTop="0dp" - android:paddingBottom="0dp" - android:paddingStart="0dp" - android:paddingEnd="0dp" + <ProgressBar + android:id="@+id/sud_progress_bar" + android:visibility="gone" + style="@style/SudFourColorIndeterminateProgressBar" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" /> - <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> + <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" /> </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 d8e9177..86003b9 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> +</com.google.android.setupcompat.view.StatusBarBackgroundLayout>
\ No newline at end of file diff --git a/lottie_loading_layout/res/values-sw600dp-v31/layouts.xml b/lottie_loading_layout/res/values-sw600dp-v31/layouts.xml deleted file mode 100644 index f627c06..0000000 --- a/lottie_loading_layout/res/values-sw600dp-v31/layouts.xml +++ /dev/null @@ -1,21 +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. ---> - -<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 9ea5e67..483f09d 100644 --- a/lottie_loading_layout/res/values/layouts.xml +++ b/lottie_loading_layout/res/values/layouts.xml @@ -17,5 +17,4 @@ <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 db0b1f3..d239e3d 100644 --- a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java +++ b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java @@ -24,14 +24,15 @@ import android.annotation.TargetApi; 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.provider.Settings; +import android.os.Handler; +import android.os.Looper; +import android.provider.Settings.Global; import android.provider.Settings.SettingNotFoundException; import android.util.AttributeSet; import android.util.Log; @@ -61,7 +62,6 @@ import com.google.android.setupcompat.partnerconfig.ResourceEntry; 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,11 +90,6 @@ public class GlifLoadingLayout extends GlifLayout { @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<>(); @@ -130,6 +125,8 @@ public class GlifLoadingLayout extends GlifLayout { .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) { @@ -148,54 +145,16 @@ public class GlifLoadingLayout extends GlifLayout { } } - View view = findManagedViewById(R.id.sud_layout_loading_content); - if (view != null) { - if (shouldApplyPartnerResource()) { - LayoutStyler.applyPartnerCustomizationExtraPaddingStyle(view); + boolean applyPartnerHeavyThemeResource = shouldApplyPartnerResource() && usePartnerHeavyTheme; + if (applyPartnerHeavyThemeResource) { + View view = findManagedViewById(R.id.sud_layout_loading_content); + if (view != null) { + applyPartnerCustomizationContentPaddingTopStyle(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 @@ -207,21 +166,6 @@ public class GlifLoadingLayout extends GlifLayout { } } - 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( @@ -307,7 +251,7 @@ public class GlifLoadingLayout extends GlifLayout { if (activity == null) { throw new NullPointerException("activity should not be null"); } - registerAnimationFinishRunnable(activity::finish); + registerAnimationFinishRunnable(activity::finish, /* allowFinishWithMaximumDuration= */ true); } /** @@ -345,7 +289,8 @@ public class GlifLoadingLayout extends GlifLayout { if (finish) { activity.finish(); } - }); + }, + /* allowFinishWithMaximumDuration= */ true); } /** @@ -387,16 +332,15 @@ public class GlifLoadingLayout extends GlifLayout { 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) - && currentConfig.orientation != Configuration.ORIENTATION_LANDSCAPE) { + .isPartnerConfigAvailable(PartnerConfig.CONFIG_LOADING_LAYOUT_HEADER_HEIGHT)) { float configHeaderHeight = PartnerConfigHelper.get(getContext()) .getDimension(getContext(), PartnerConfig.CONFIG_LOADING_LAYOUT_HEADER_HEIGHT); @@ -463,7 +407,7 @@ public class GlifLoadingLayout extends GlifLayout { linearLayout.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); } - private static int getButtonContainerHeight(View view) { + private static final int getButtonContainerHeight(View view) { view.measure( MeasureSpec.makeMeasureSpec(view.getMeasuredWidth(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(view.getMeasuredHeight(), MeasureSpec.EXACTLY)); @@ -668,8 +612,7 @@ public class GlifLoadingLayout extends GlifLayout { 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); } @@ -704,17 +647,7 @@ public class GlifLoadingLayout extends GlifLayout { @Override protected View onInflateTemplate(LayoutInflater inflater, int template) { if (template == 0) { - 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; - } + template = R.layout.sud_glif_loading_template; } return inflateTemplate(inflater, R.style.SudThemeGlif_Light, template); } @@ -794,31 +727,38 @@ public class GlifLoadingLayout extends GlifLayout { } /** - * Register the {@link Runnable} as a callback that will be performed when the animation finished. + * Register the {@link Runnable} as a callback class that will be perform when animation finished. */ public void registerAnimationFinishRunnable(Runnable runnable) { - workFinished = true; - nextActionRunnable = runnable; - synchronized (this) { - runRunnable = true; - animationFinishListeners.add( - new LottieAnimationFinishListener(this, () -> finishRunnable(runnable))); - } + registerAnimationFinishRunnable(runnable, /* allowFinishWithMaximumDuration= */ false); } - @VisibleForTesting - public synchronized void finishRunnable(Runnable runnable) { - // to avoid run the runnable twice. - if (runRunnable) { - runnable.run(); + /** + * 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)); } - 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; @@ -848,28 +788,22 @@ public class GlifLoadingLayout extends GlifLayout { }; @VisibleForTesting - LottieAnimationFinishListener(GlifLoadingLayout glifLoadingLayout, Runnable runnable) { + LottieAnimationFinishListener( + GlifLoadingLayout glifLoadingLayout, Runnable runnable, long finishWithMinimumDuration) { 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(); - 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 (glifLoadingLayout.isLottieLayoutVisible() && !isZeroAnimatorDurationScale()) { lottieAnimationView.setRepeatCount(0); + lottieAnimationView.addAnimatorListener(animatorListener); + if (finishWithMinimumDuration > 0) { + handler.postDelayed(this::onAnimationFinished, finishWithMinimumDuration); + } } else { onAnimationFinished(); } @@ -879,9 +813,8 @@ public class GlifLoadingLayout extends GlifLayout { boolean isZeroAnimatorDurationScale() { try { if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) { - return Settings.Global.getFloat( - glifLoadingLayout.getContext().getContentResolver(), - Settings.Global.ANIMATOR_DURATION_SCALE) + return Global.getFloat( + glifLoadingLayout.getContext().getContentResolver(), Global.ANIMATOR_DURATION_SCALE) == 0f; } else { return false; @@ -894,6 +827,7 @@ public class GlifLoadingLayout extends GlifLayout { @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 deleted file mode 100644 index 0f9bba9..0000000 --- a/main/res/anim-ldrtl-v31/sud_slide_back_in.xml +++ /dev/null @@ -1,22 +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. ---> - -<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 deleted file mode 100644 index 8c5c439..0000000 --- a/main/res/anim-ldrtl-v31/sud_slide_back_out.xml +++ /dev/null @@ -1,22 +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. ---> - -<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 deleted file mode 100644 index cf524a3..0000000 --- a/main/res/anim-ldrtl-v31/sud_slide_next_in.xml +++ /dev/null @@ -1,22 +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. ---> - -<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 deleted file mode 100644 index 18b760e..0000000 --- a/main/res/anim-ldrtl-v31/sud_slide_next_out.xml +++ /dev/null @@ -1,22 +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. ---> - -<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/interpolator-v31/sud_interpolator.xml b/main/res/anim-v31/sud_interpolator.xml index bec77f0..bec77f0 100644 --- a/main/res/interpolator-v31/sud_interpolator.xml +++ b/main/res/anim-v31/sud_interpolator.xml diff --git a/main/res/anim-v31/sud_slide_back_in.xml b/main/res/anim-v31/sud_slide_back_in.xml index cf524a3..77d4cd5 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="@interpolator/sud_interpolator" /> + android:interpolator="@anim/sud_interpolator" /> diff --git a/main/res/anim-v31/sud_slide_back_out.xml b/main/res/anim-v31/sud_slide_back_out.xml index 18b760e..8ae16d4 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="@interpolator/sud_interpolator" /> + android:interpolator="@anim/sud_interpolator" /> diff --git a/main/res/anim-v31/sud_slide_next_in.xml b/main/res/anim-v31/sud_slide_next_in.xml index 0f9bba9..006d9b4 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="@interpolator/sud_interpolator" /> + android:interpolator="@anim/sud_interpolator" /> diff --git a/main/res/anim-v31/sud_slide_next_out.xml b/main/res/anim-v31/sud_slide_next_out.xml index 8c5c439..341bbad 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="@interpolator/sud_interpolator" /> + android:interpolator="@anim/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 deleted file mode 100644 index fc9cc97..0000000 --- a/main/res/color-v31/sud_dynamic_switch_track_off_light.xml +++ /dev/null @@ -1,19 +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. ---> - -<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 deleted file mode 100644 index b8997f9..0000000 --- a/main/res/color-v31/sud_dynamic_switch_track_on_dark.xml +++ /dev/null @@ -1,19 +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. ---> - -<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 deleted file mode 100644 index 8e54c8c..0000000 --- a/main/res/color/sud_switch_thumb_off.xml +++ /dev/null @@ -1,23 +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. ---> - -<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 deleted file mode 100644 index 494c179..0000000 --- a/main/res/color/sud_switch_thumb_on.xml +++ /dev/null @@ -1,23 +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. ---> - -<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 deleted file mode 100644 index 4770393..0000000 --- a/main/res/color/sud_switch_track_off.xml +++ /dev/null @@ -1,23 +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. ---> - -<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 fb93f05..a95a1ee 100644 --- a/main/res/color/sud_switch_track_on.xml +++ b/main/res/color/sud_switch_track_on.xml @@ -17,7 +17,10 @@ <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/sudSwitchBarTrackOnColor" + android:color="?android:attr/colorForeground" android:alpha="?android:attr/disabledAlpha" /> - <item android:color="?attr/sudSwitchBarTrackOnColor" /> + <item android:state_checked="true" + android:color="?android:attr/colorControlActivated" tools:ignore="NewApi" + android:alpha="?android:attr/disabledAlpha" /> + <item android:color="?android:attr/colorForeground" /> </selector> diff --git a/main/res/drawable-v21/sud_switch_thumb_on.xml b/main/res/drawable-v21/sud_switch_thumb_on.xml new file mode 100644 index 0000000..224f181 --- /dev/null +++ b/main/res/drawable-v21/sud_switch_thumb_on.xml @@ -0,0 +1,31 @@ +<?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 deleted file mode 100644 index f2a57a4..0000000 --- a/main/res/drawable/sud_autofilled_highlight_mn_bg.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?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 d4dad6f..cc1cf06 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="@color/sud_switch_thumb_on" /> + <solid android:color="?android:attr/colorAccent" tools:ignore="NewApi" /> </shape> </item> </layer-list> 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 aeef4a3..dd4d52d 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,8 +44,9 @@ <LinearLayout android:id="@+id/sud_landscape_content_area" - style="@style/SudLandContentContianerStyle" - android:paddingTop="?attr/sudGlifContentPaddingTop" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="@dimen/sud_glif_land_content_area_weight" 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 9b0dd5d..478ac5f 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,8 +55,9 @@ <LinearLayout android:id="@+id/sud_landscape_content_area" - style="@style/SudLandContentContianerStyle" - android:paddingTop="?attr/sudGlifContentPaddingTop" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="@dimen/sud_glif_land_content_area_weight" 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 1d95b42..c03d2fe 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,8 +55,9 @@ <LinearLayout android:id="@+id/sud_landscape_content_area" - style="@style/SudLandContentContianerStyle" - android:paddingTop="?attr/sudGlifContentPaddingTop" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="@dimen/sud_glif_land_content_area_weight" 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 a75c068..4840caf 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,8 +56,9 @@ <LinearLayout android:id="@+id/sud_landscape_content_area" - style="@style/SudLandContentContianerStyle" - android:paddingTop="?attr/sudGlifContentPaddingTop" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="@dimen/sud_glif_land_content_area_weight" 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 6329e4b..d1b6b92 100644 --- a/main/res/layout-land-v31/sud_glif_template_content.xml +++ b/main/res/layout-land-v31/sud_glif_template_content.xml @@ -55,7 +55,9 @@ <LinearLayout android:id="@+id/sud_landscape_content_area" - style="@style/SudLandContentContianerStyle" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="@dimen/sud_glif_land_content_area_weight" android:orientation="vertical"> <com.google.android.setupdesign.view.BottomScrollView @@ -63,8 +65,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" - android:scrollIndicators="?attr/sudScrollIndicators" - android:importantForAccessibility="no"> + android:scrollIndicators="?attr/sudScrollIndicators"> <LinearLayout android:layout_width="match_parent" @@ -73,7 +74,6 @@ <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 deleted file mode 100644 index 68ea99e..0000000 --- a/main/res/layout-sw600dp-v31/sud_glif_preference_template_card.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?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 70b8daa..50feeb2 100644 --- a/main/res/layout/sud_glif_header.xml +++ b/main/res/layout/sud_glif_header.xml @@ -31,15 +31,20 @@ <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="?attr/sudGlifHeaderTitleStyle" + style="@style/SudGlifHeaderTitle" android:layout_width="match_parent" android:layout_height="wrap_content" /> @@ -56,7 +61,7 @@ <com.google.android.setupdesign.view.RichTextView android:id="@+id/sud_layout_subtitle" - style="?attr/sudGlifDescriptionStyle" + style="@style/SudGlifDescription" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="gone" /> @@ -68,6 +73,8 @@ 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 11f89fa..4f3f3ac 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="?attr/sudItemContainerStyle" + style="@style/SudItemContainer" 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" - style="?attr/sudItemIconContainerStyle" + android:layout_width="@dimen/sud_items_icon_container_width" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:gravity="start"> @@ -42,13 +42,12 @@ 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="?attr/sudItemTitleStyle" + style="@style/SudItemTitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="start" @@ -57,9 +56,10 @@ <com.google.android.setupdesign.view.RichTextView android:id="@+id/sud_items_summary" - style="?attr/sudItemSummaryStyle" + style="@style/SudItemSummary" 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 8c24e87..1caa5ee 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="?attr/sudItemDescriptionTitleTextAppearence" + android:textAppearance="@style/TextAppearance.SudDescription" 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 28660a4..3826ae3 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="?attr/sudItemContainerStyle" + style="@style/SudItemContainer" 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="?attr/sudItemTitleStyle" + style="@style/SudItemTitle" 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="?attr/sudItemSummaryStyle" + style="@style/SudItemSummary" 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 f246e61..210c41c 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="?attr/sudItemVerboseTitleStyle" + style="@style/SudItemTitle.Verbose" 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="?attr/sudItemSummaryStyle" + style="@style/SudItemSummary" 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 deleted file mode 100644 index e495f71..0000000 --- a/main/res/values-h720dp/dimens.xml +++ /dev/null @@ -1,26 +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. ---> - -<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 5accbbd..8b8d10d 100644 --- a/main/res/values-land-v31/dimens.xml +++ b/main/res/values-land-v31/dimens.xml @@ -24,11 +24,4 @@ <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 9b74b4f..49ed20d 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_bar_min_height">52dp</dimen> + <dimen name="sud_glif_footer_min_height">52dp</dimen> <dimen name="sud_glif_footer_padding_vertical">0dp</dimen> <!-- Card layout (for tablets) --> @@ -45,17 +45,4 @@ <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 cd2a6d5..f929595 100644 --- a/main/res/values-night-v31/colors.xml +++ b/main/res/values-night-v31/colors.xml @@ -29,7 +29,5 @@ <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 deleted file mode 100644 index 79ed31a..0000000 --- a/main/res/values-night-v33/colors.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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 555473e..d609b4c 100644 --- a/main/res/values-night/styles.xml +++ b/main/res/values-night/styles.xml @@ -22,12 +22,7 @@ <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 deleted file mode 100644 index da43b3b..0000000 --- a/main/res/values-sw600dp-land-v31/dimens.xml +++ /dev/null @@ -1,39 +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. ---> - -<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 aa70031..d68c884 100644 --- a/main/res/values-sw600dp-land/dimens.xml +++ b/main/res/values-sw600dp-land/dimens.xml @@ -23,22 +23,4 @@ <!-- 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 deleted file mode 100644 index fd9215e..0000000 --- a/main/res/values-sw600dp-v31/dimens.xml +++ /dev/null @@ -1,40 +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. ---> - -<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 deleted file mode 100644 index b013475..0000000 --- a/main/res/values-sw600dp-v31/layouts.xml +++ /dev/null @@ -1,22 +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. ---> - -<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 16c77ec..b7802b1 100644 --- a/main/res/values-sw600dp/dimens.xml +++ b/main/res/values-sw600dp/dimens.xml @@ -18,14 +18,10 @@ <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_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_button_margin_start">24dp</dimen> <dimen name="sud_glif_margin_start">40dp</dimen> <dimen name="sud_glif_margin_end">40dp</dimen> @@ -42,26 +38,4 @@ <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 deleted file mode 100644 index 163e342..0000000 --- a/main/res/values-sw800dp/dimens.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?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-v22/styles.xml b/main/res/values-v22/styles.xml index b4d89b0..a3c7cee 100644 --- a/main/res/values-v22/styles.xml +++ b/main/res/values-v22/styles.xml @@ -22,10 +22,4 @@ </style> <style name="SudAlertDialogTheme.Light" parent="android:Theme.DeviceDefault.Light.Dialog.Alert" /> - <style name="SudMaterialYouAlertDialogTheme" parent="SudAlertDialogTheme"> - <item name="android:windowTitleStyle">@style/SudMaterialYouAlertDialogTitleStyle</item> - </style> - <style name="SudMaterialYouAlertDialogTheme.Light" parent="SudAlertDialogTheme.Light"> - <item name="android:windowTitleStyle">@style/SudMaterialYouAlertDialogTitleStyle</item> - </style> </resources> diff --git a/main/res/values-v31/colors.xml b/main/res/values-v31/colors.xml index 1ed67df..91587ee 100644 --- a/main/res/values-v31/colors.xml +++ b/main/res/values-v31/colors.xml @@ -38,49 +38,27 @@ <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_neutral2_50</color> + <color name="sud_system_neutral2_50">@android:color/system_neutral1_50</color> - <color name="sud_system_neutral2_100">@android:color/system_neutral2_100</color> + <color name="sud_system_neutral2_100">@android:color/system_neutral1_100</color> <color name="sud_system_neutral2_200">@android:color/system_neutral2_200</color> - <color name="sud_system_neutral2_300">@android:color/system_neutral2_300</color> + <color name="sud_system_neutral2_300">@android:color/system_accent2_300</color> <color name="sud_system_neutral2_400">@android:color/system_neutral2_400</color> @@ -98,20 +76,5 @@ <color name="sud_system_button_surface">@color/sud_system_accent1_100</color> <color name="sud_system_button_text">@color/sud_system_neutral1_900</color> <color name="sud_system_dividing_line">@color/sud_system_neutral2_300</color> - <color name="sud_system_hyperlink_text">@color/sud_system_accent1_600</color> - <color name="sud_system_surface">@color/sud_system_neutral1_50</color> - - - <color name="sud_dynamic_switch_thumb_off_light">@color/sud_system_neutral2_300</color> - - <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> +</resources>
\ No newline at end of file diff --git a/main/res/values-v31/styles.xml b/main/res/values-v31/styles.xml index df86de7..e1240e4 100644 --- a/main/res/values-v31/styles.xml +++ b/main/res/values-v31/styles.xml @@ -15,126 +15,34 @@ limitations under the License. --> -<resources xmlns:tools="http://schemas.android.com/tools"> +<resources> <!-- Main theme for dynamic color --> - <style name="SudDynamicColorBaseTheme"> - <item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_dark</item> - <item name="android:textColorLink">@color/sud_system_hyperlink_text</item> - <item name="alertDialogTheme">@style/SudDynamicColorAlertDialogThemeCompat</item> - <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="SudDynamicColorBaseTheme.Light"> - <item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_light</item> - <item name="android:textColorLink">@color/sud_system_hyperlink_text</item> - <item name="alertDialogTheme">@style/SudDynamicColorAlertDialogThemeCompat.Light</item> - <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="android:textColorLink">@color/sud_dynamic_color_accent_glif_v3_dark</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="android:textColorLink">@color/sud_dynamic_color_accent_glif_v3_light</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">@color/sud_system_background_surface</item> + <item name="android:windowBackground">@android:color/system_neutral1_900</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: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:textColorPrimary">@color/sud_system_primary_text</item> <item name="android:textColorSecondary">@color/sud_system_secondary_text</item> @@ -153,13 +61,13 @@ </style> <style name="SudFullDynamicColorThemeGlifV3.Light" parent="SudDynamicColorThemeGlifV3.Light"> - <item name="android:windowBackground">@color/sud_system_background_surface</item> + <item name="android:windowBackground">@android:color/system_neutral1_50</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:colorForegroundInverse">@android:color/system_neutral1_50</item> + <item name="android:colorBackground">@android:color/system_neutral1_50</item> + <item name="android:colorBackgroundCacheHint">@@android:color/system_neutral1_50</item> + <item name="colorBackgroundFloating">@android:color/system_neutral1_50</item> + <item name="android:navigationBarColor">@android:color/system_neutral1_50</item> <item name="android:textColorPrimary">@color/sud_system_primary_text</item> <item name="android:textColorSecondary">@color/sud_system_secondary_text</item> @@ -182,8 +90,6 @@ <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"> @@ -191,35 +97,6 @@ <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"> @@ -240,100 +117,4 @@ <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 deleted file mode 100644 index c46c6fc..0000000 --- a/main/res/values-v33/colors.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?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 deleted file mode 100644 index 5d02f04..0000000 --- a/main/res/values-v33/styles.xml +++ /dev/null @@ -1,25 +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. ---> -<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 22aee0d..c946912 100644 --- a/main/res/values/attrs.xml +++ b/main/res/values/attrs.xml @@ -24,7 +24,6 @@ <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"> @@ -60,26 +59,9 @@ <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" /> - <!-- Values copied from frameworks/base/core/res/res/values/attrs.xml --> - <attr name="sudButtonTertiaryGravity"> - <!-- Push object to the left of its container, not changing its size. --> - <flag name="left" value="0x03" /> - <!-- Push object to the right of its container, not changing its size. --> - <flag name="right" value="0x05" /> - <!-- Place object in the horizontal center of its container, not changing its size. --> - <flag name="center_horizontal" value="0x01" /> - <!-- Grow the horizontal size of the object if needed so it completely fills its container. --> - <flag name="fill_horizontal" value="0x07" /> - <!-- Push object to the beginning of its container, not changing its size. --> - <flag name="start" value="0x00800003" /> - <!-- Push object to the end of its container, not changing its size. --> - <flag name="end" value="0x00800005" /> - </attr> <attr name="sudCardBackground" format="color|reference" /> <attr name="sudDividerCondition"> <enum name="either" value="0" /> @@ -130,28 +112,11 @@ <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"> @@ -222,7 +187,6 @@ <attr name="android:summary" /> <attr name="android:title" /> <attr name="android:visible" /> - <attr name="android:contentDescription" /> <attr name="sudIconTint" /> <attr name="sudIconGravity" /> </declare-styleable> @@ -251,7 +215,6 @@ <attr name="sudDividerInset" /> <attr name="sudDividerInsetEnd" /> <attr name="sudDividerInsetStart" /> - <attr name="sudDividerShown" /> </declare-styleable> <declare-styleable name="SudRecyclerItemAdapter"> @@ -296,10 +259,4 @@ </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 75fd097..798abc9 100644 --- a/main/res/values/colors.xml +++ b/main/res/values/colors.xml @@ -73,40 +73,18 @@ <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> @@ -162,23 +140,10 @@ <color name="sud_portal_pending_progress">@color/sud_portal_pending_progress_light</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_switch_track_off">#FF757575</color> + <color name="sud_switch_thumb_off">#BFFFFFFF</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 de724a3..dafc0dd 100644 --- a/main/res/values/config.xml +++ b/main/res/values/config.xml @@ -25,10 +25,8 @@ <!-- 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 4b821a4..64970c8 100644 --- a/main/res/values/dimens.xml +++ b/main/res/values/dimens.xml @@ -17,21 +17,6 @@ <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> @@ -48,12 +33,10 @@ <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_bar_min_height">72dp</dimen> + <dimen name="sud_glif_footer_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> @@ -160,11 +143,6 @@ <!-- 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. --> @@ -176,68 +154,6 @@ <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 --> @@ -265,15 +181,12 @@ <!-- 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 e33b305..4725735 100644 --- a/main/res/values/styles.xml +++ b/main/res/values/styles.xml @@ -52,7 +52,6 @@ <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> @@ -65,13 +64,6 @@ <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"> @@ -107,7 +99,6 @@ <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> @@ -120,13 +111,6 @@ <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"> @@ -155,7 +139,6 @@ <item name="sudButtonCornerRadius">@dimen/sud_glif_button_corner_radius</item> <item name="sudButtonFontFamily">sans-serif-medium</item> <item name="sudButtonHighlightAlpha">0.24</item> - <item name="sudButtonTertiaryGravity">?attr/sudGlifHeaderGravity</item> <item name="sudColorPrimary">?attr/colorPrimary</item> <item name="sudContentFramePaddingTop">@dimen/sud_content_frame_padding_top</item> <item name="sudContentFramePaddingBottom">@dimen/sud_content_frame_padding_bottom</item> @@ -167,20 +150,16 @@ <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="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="sucGlifHeaderMarginBottom">@dimen/sud_glif_header_title_margin_bottom</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> @@ -200,7 +179,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_bar_min_height</item> + <item name="sucFooterBarMinHeight">@dimen/sud_glif_footer_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> @@ -208,18 +187,6 @@ <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"/> @@ -249,7 +216,6 @@ <item name="sudButtonCornerRadius">@dimen/sud_glif_button_corner_radius</item> <item name="sudButtonFontFamily">sans-serif-medium</item> <item name="sudButtonHighlightAlpha">0.12</item> - <item name="sudButtonTertiaryGravity">?attr/sudGlifHeaderGravity</item> <item name="sudColorPrimary">?attr/colorPrimary</item> <item name="sudContentFramePaddingTop">@dimen/sud_content_frame_padding_top</item> <item name="sudContentFramePaddingBottom">@dimen/sud_content_frame_padding_bottom</item> @@ -261,20 +227,16 @@ <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="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="sucGlifHeaderMarginBottom">@dimen/sud_glif_header_title_margin_bottom</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> @@ -294,7 +256,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_bar_min_height</item> + <item name="sucFooterBarMinHeight">@dimen/sud_glif_footer_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> @@ -302,18 +264,6 @@ <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"/> @@ -364,7 +314,6 @@ <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" /> @@ -378,110 +327,26 @@ <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="sudButtonTertiaryGravity">center_horizontal</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="sudButtonTertiaryGravity">center_horizontal</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" /> - + <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="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> <!-- Content styles --> <!-- Ignore UnusedResources: Used by clients --> @@ -672,7 +537,7 @@ <item name="android:theme">@style/SudGlifButton.Tertiary</item> <item name="android:fontFamily" tools:targetApi="jelly_bean">sans-serif</item> - <item name="android:layout_gravity">?attr/sudButtonTertiaryGravity</item> + <item name="android:layout_gravity">?attr/sudGlifHeaderGravity</item> <item name="android:layout_marginLeft">@dimen/sud_glif_negative_button_padding</item> <item name="android:layout_marginRight">@dimen/sud_glif_negative_button_padding</item> <!-- Always lowercase instead of reading attr/sudButtonAllCaps, since this is a tertiary @@ -736,7 +601,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_bar_min_height</item> + <item name="android:minHeight">@dimen/sud_glif_footer_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> @@ -749,14 +614,6 @@ <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 --> @@ -770,20 +627,6 @@ <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> @@ -804,31 +647,10 @@ <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> @@ -838,13 +660,9 @@ <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" tools:targetApi="jelly_bean">@string/sudFontSecondaryMedium</item> + <item name="android:fontFamily">@string/sudFontSecondaryMedium</item> </style> <style name="SudSwitchStyle"> @@ -875,26 +693,6 @@ <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"> @@ -906,24 +704,6 @@ <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"> @@ -933,24 +713,18 @@ <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_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:layout_marginLeft">?attr/sudMarginStart</item> + <item name="android:layout_marginRight">?attr/sudMarginEnd</item> + <item name="android:layout_marginTop">?attr/sucGlifIconMarginTop</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"> @@ -968,23 +742,6 @@ <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"> @@ -1039,22 +796,6 @@ <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> @@ -1077,10 +818,4 @@ <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 dabe36f..df86b23 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.content.res.TypedArray; 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 1b8c8f8..829e3d7 100644 --- a/main/src/com/google/android/setupdesign/GlifLayout.java +++ b/main/src/com/google/android/setupdesign/GlifLayout.java @@ -50,6 +50,7 @@ import com.google.android.setupdesign.template.RequireScrollMixin; 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. @@ -136,13 +137,12 @@ public class GlifLayout extends PartnerCustomizationLayout { if (primaryColor != null) { setPrimaryColor(primaryColor); } - if (shouldApplyPartnerHeavyThemeResource()) { + + if (applyPartnerHeavyThemeResource) { updateContentBackgroundColorWithPartnerConfig(); - } - View view = findManagedViewById(R.id.sud_layout_content); - if (view != null) { - if (shouldApplyPartnerResource()) { + View view = findManagedViewById(R.id.sud_layout_content); + if (view != null) { // 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,16 +150,10 @@ public class GlifLayout extends PartnerCustomizationLayout { // 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); - } - // {@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); + applyPartnerCustomizationContentPaddingTopStyle(view); } } - updateLandscapeMiddleHorizontalSpacing(); ColorStateList backgroundColor = @@ -183,7 +177,6 @@ public class GlifLayout extends PartnerCustomizationLayout { getMixin(IconMixin.class).tryApplyPartnerCustomizationStyle(); getMixin(HeaderMixin.class).tryApplyPartnerCustomizationStyle(); getMixin(DescriptionMixin.class).tryApplyPartnerCustomizationStyle(); - getMixin(ProgressBarMixin.class).tryApplyPartnerCustomizationStyle(); tryApplyPartnerCustomizationStyleToShortDescription(); } @@ -203,77 +196,59 @@ public class GlifLayout extends PartnerCustomizationLayout { 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) { - int layoutMarginEnd; - if (shouldApplyPartnerResource() - && PartnerConfigHelper.get(getContext()) - .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_END)) { - layoutMarginEnd = + if (PartnerConfigHelper.get(getContext()) + .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_END)) { + int layoutMarginEnd = (int) PartnerConfigHelper.get(getContext()) .getDimension(getContext(), PartnerConfig.CONFIG_LAYOUT_MARGIN_END); - } 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()); + + 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) { - int layoutMarginStart; - if (shouldApplyPartnerResource() - && PartnerConfigHelper.get(getContext()) - .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) { - layoutMarginStart = + if (PartnerConfigHelper.get(getContext()) + .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) { + int layoutMarginStart = (int) PartnerConfigHelper.get(getContext()) .getDimension(getContext(), PartnerConfig.CONFIG_LAYOUT_MARGIN_START); - } 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()); + + 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()); + } } } } @@ -497,13 +472,14 @@ public class GlifLayout extends PartnerCustomizationLayout { } @TargetApi(VERSION_CODES.JELLY_BEAN_MR1) - protected void tryApplyPartnerCustomizationContentPaddingTopStyle(View view) { + protected static void applyPartnerCustomizationContentPaddingTopStyle(View view) { Context context = view.getContext(); boolean partnerPaddingTopAvailable = PartnerConfigHelper.get(context) .isPartnerConfigAvailable(PartnerConfig.CONFIG_CONTENT_PADDING_TOP); - if (shouldApplyPartnerResource() && partnerPaddingTopAvailable) { + if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view) + && 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 89d0888..60f0343 100644 --- a/main/src/com/google/android/setupdesign/GlifListLayout.java +++ b/main/src/com/google/android/setupdesign/GlifListLayout.java @@ -76,7 +76,7 @@ public class GlifListLayout extends GlifLayout { View view = this.findManagedViewById(R.id.sud_landscape_content_area); if (view != null) { - tryApplyPartnerCustomizationContentPaddingTopStyle(view); + applyPartnerCustomizationContentPaddingTopStyle(view); } updateLandscapeMiddleHorizontalSpacing(); } diff --git a/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java b/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java index 87f871c..5e75436 100644 --- a/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java +++ b/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java @@ -77,7 +77,7 @@ public class GlifRecyclerLayout extends GlifLayout { View view = this.findManagedViewById(R.id.sud_landscape_content_area); if (view != null) { - tryApplyPartnerCustomizationContentPaddingTopStyle(view); + applyPartnerCustomizationContentPaddingTopStyle(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 237cd83..1a55b25 100644 --- a/main/src/com/google/android/setupdesign/accessibility/LinkAccessibilityHelper.java +++ b/main/src/com/google/android/setupdesign/accessibility/LinkAccessibilityHelper.java @@ -19,6 +19,9 @@ package com.google.android.setupdesign.accessibility; 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; @@ -30,9 +33,6 @@ import android.view.accessibility.AccessibilityEvent; 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 c934612..29eaf23 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.graphics.drawable.Drawable; 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 407eacb..fd3f2eb 100644 --- a/main/src/com/google/android/setupdesign/items/Item.java +++ b/main/src/com/google/android/setupdesign/items/Item.java @@ -44,7 +44,6 @@ public class Item extends AbstractItem { 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; @@ -61,12 +60,10 @@ public class Item extends AbstractItem { 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(); } @@ -146,16 +143,6 @@ public class Item extends AbstractItem { 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; @@ -172,10 +159,6 @@ public class Item extends AbstractItem { return visible; } - private boolean hasSummary(CharSequence summary) { - return summary != null && summary.length() > 0; - } - @Override public int getViewId() { return getId(); @@ -188,15 +171,13 @@ public class Item extends AbstractItem { TextView summaryView = (TextView) view.findViewById(R.id.sud_items_summary); CharSequence summary = getSummary(); - if (hasSummary(summary)) { + if (summary != null && summary.length() > 0) { 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) { @@ -227,7 +208,6 @@ public class Item extends AbstractItem { // 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 63e4f41..bbccf82 100644 --- a/main/src/com/google/android/setupdesign/template/DescriptionMixin.java +++ b/main/src/com/google/android/setupdesign/template/DescriptionMixin.java @@ -28,6 +28,7 @@ import androidx.annotation.AttrRes; 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; @@ -78,12 +79,21 @@ public class DescriptionMixin implements Mixin { /** * Applies the partner customizations to the description text (contains text alignment) and - * background. It will apply all partner customizations. + * background, if apply heavy theme resource, it will apply all partner customizations, otherwise, + * only apply alignment style. */ public void tryApplyPartnerCustomizationStyle() { TextView description = templateLayout.findManagedViewById(R.id.sud_layout_subtitle); - if (description != null && PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) { - HeaderAreaStyler.applyPartnerCustomizationDescriptionHeavyStyle(description); + 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); + } } } diff --git a/main/src/com/google/android/setupdesign/template/HeaderMixin.java b/main/src/com/google/android/setupdesign/template/HeaderMixin.java index 814f873..d040c94 100644 --- a/main/src/com/google/android/setupdesign/template/HeaderMixin.java +++ b/main/src/com/google/android/setupdesign/template/HeaderMixin.java @@ -41,7 +41,6 @@ import com.google.android.setupdesign.R; 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. @@ -63,7 +62,6 @@ public class HeaderMixin implements Mixin { * @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; @@ -79,8 +77,8 @@ public class HeaderMixin implements Mixin { a.recycle(); - // Try to update the flag of the uto size config settings - tryUpdateAutoTextSizeFlagWithPartnerConfig(); + // overlay the Auto size config settings + updateAutoTextSizeWithPartnerConfig(); // Set the header text if (headerText != null) { @@ -92,9 +90,10 @@ public class HeaderMixin implements Mixin { } } - private void tryUpdateAutoTextSizeFlagWithPartnerConfig() { + private void updateAutoTextSizeWithPartnerConfig() { Context context = templateLayout.getContext(); - if (!PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) { + if (!PartnerStyleHelper.isPartnerHeavyThemeLayout(templateLayout) + || !PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)) { autoTextSizeEnabled = false; return; } @@ -150,14 +149,18 @@ public class HeaderMixin implements Mixin { */ public void tryApplyPartnerCustomizationStyle() { TextView header = templateLayout.findManagedViewById(R.id.suc_layout_title); - if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) { + boolean partnerLightThemeLayout = PartnerStyleHelper.isPartnerLightThemeLayout(templateLayout); + boolean partnerHeavyThemeLayout = PartnerStyleHelper.isPartnerHeavyThemeLayout(templateLayout); + if (partnerHeavyThemeLayout) { View headerAreaView = templateLayout.findManagedViewById(R.id.sud_layout_header); - LayoutStyler.applyPartnerCustomizationExtraPaddingStyle(headerAreaView); - HeaderAreaStyler.applyPartnerCustomizationHeaderStyle(header); + HeaderAreaStyler.applyPartnerCustomizationHeaderHeavyStyle(header); HeaderAreaStyler.applyPartnerCustomizationHeaderAreaStyle((ViewGroup) headerAreaView); + LayoutStyler.applyPartnerCustomizationExtraPaddingStyle(headerAreaView); + // overlay the Auto size config settings + updateAutoTextSizeWithPartnerConfig(); + } else if (partnerLightThemeLayout) { + HeaderAreaStyler.applyPartnerCustomizationHeaderLightStyle(header); } - // 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 3c2b6d0..75e624a 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 @@ public class IconMixin implements Mixin { context.obtainStyledAttributes( attrs, R.styleable.SudIconMixin, defStyleAttr, /* defStyleRes= */ 0); - @DrawableRes - final int icon = a.getResourceId(R.styleable.SudIconMixin_android_icon, /* defValue= */ 0); + final @DrawableRes int icon = + a.getResourceId(R.styleable.SudIconMixin_android_icon, /* defValue= */ 0); if (icon != 0) { setIcon(icon); } @@ -81,8 +81,8 @@ public class IconMixin implements Mixin { a.getBoolean(R.styleable.SudIconMixin_sudUpscaleIcon, /* defValue= */ false); setUpscaleIcon(upscaleIcon); - @ColorInt - final int iconTint = a.getColor(R.styleable.SudIconMixin_sudIconTint, Color.TRANSPARENT); + final @ColorInt int iconTint = + a.getColor(R.styleable.SudIconMixin_sudIconTint, Color.TRANSPARENT); if (iconTint != Color.TRANSPARENT) { setIconTint(iconTint); } @@ -92,9 +92,12 @@ public class IconMixin implements Mixin { /** Tries to apply the partner customization to the header icon. */ public void tryApplyPartnerCustomizationStyle() { - // apply partner configs for icon - if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) { + if (PartnerStyleHelper.isPartnerHeavyThemeLayout(templateLayout)) { + // apply partner heavy configs HeaderAreaStyler.applyPartnerCustomizationIconStyle(getView(), getContainerView()); + } else if (PartnerStyleHelper.isPartnerLightThemeLayout(templateLayout)) { + // apply partner light configs + HeaderAreaStyler.applyPartnerCustomizationIconStyle(getView()); } } @@ -114,7 +117,6 @@ public class IconMixin implements Mixin { 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 1cd55f2..5963a79 100644 --- a/main/src/com/google/android/setupdesign/template/ListMixin.java +++ b/main/src/com/google/android/setupdesign/template/ListMixin.java @@ -52,6 +52,7 @@ public class ListMixin implements Mixin { 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) { @@ -67,8 +68,8 @@ public class ListMixin implements Mixin { setAdapter(new ItemAdapter(inflated)); } - boolean isDividerDisplay = a.getBoolean(R.styleable.SudListMixin_sudDividerShown, true); - if (isDividerShown(context, isDividerDisplay)) { + boolean isDividerDisplay = isDividerShown(context); + if (isDividerDisplay) { int dividerInset = a.getDimensionPixelSize(R.styleable.SudListMixin_sudDividerInset, -1); if (dividerInset != -1) { setDividerInset(dividerInset); @@ -78,7 +79,7 @@ public class ListMixin implements Mixin { int dividerInsetEnd = a.getDimensionPixelSize(R.styleable.SudListMixin_sudDividerInsetEnd, 0); - if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) { + if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(templateLayout)) { if (PartnerConfigHelper.get(context) .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) { dividerInsetStart = @@ -97,22 +98,23 @@ public class ListMixin implements Mixin { setDividerInsets(dividerInsetStart, dividerInsetEnd); } } - else{ - getListView().setDivider(null); - } a.recycle(); } - private boolean isDividerShown(Context context, boolean isDividerDisplay) { + private boolean isDividerShown(Context context) { if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) { if (PartnerConfigHelper.get(context) .isPartnerConfigAvailable(PartnerConfig.CONFIG_ITEMS_DIVIDER_SHOWN)) { - isDividerDisplay = + boolean isDividerDisplayed = PartnerConfigHelper.get(context) .getBoolean(context, PartnerConfig.CONFIG_ITEMS_DIVIDER_SHOWN, true); + if (!isDividerDisplayed) { + getListView().setDivider(null); + return isDividerDisplayed; + } } } - return isDividerDisplay; + return true; } /** diff --git a/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java b/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java index ac5ac69..da1b997 100644 --- a/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java +++ b/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java @@ -16,14 +16,12 @@ 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; @@ -32,8 +30,6 @@ import androidx.annotation.Nullable; 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 { @@ -182,34 +178,4 @@ public class ProgressBarMixin implements Mixin { 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 46b2faf..b327060 100644 --- a/main/src/com/google/android/setupdesign/template/RecyclerMixin.java +++ b/main/src/com/google/android/setupdesign/template/RecyclerMixin.java @@ -17,7 +17,6 @@ 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; @@ -27,7 +26,6 @@ import androidx.recyclerview.widget.RecyclerView; 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; @@ -92,31 +90,22 @@ public class RecyclerMixin implements Mixin { header = ((HeaderRecyclerView) recyclerView).getHeader(); } - isDividerDisplay = isShowItemsDivider(layout.getContext()); + isDividerDisplay = isShowItemsDivider(); if (isDividerDisplay) { this.recyclerView.addItemDecoration(dividerDecoration); } } - 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); - + private boolean isShowItemsDivider() { // 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, - isShownDivider); + .getBoolean(recyclerView.getContext(), PartnerConfig.CONFIG_ITEMS_DIVIDER_SHOWN, true); } } - return isShownDivider; + return true; } /** @@ -165,7 +154,7 @@ public class RecyclerMixin implements Mixin { int dividerInsetEnd = a.getDimensionPixelSize(R.styleable.SudRecyclerMixin_sudDividerInsetEnd, 0); - if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) { + if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(templateLayout)) { if (PartnerConfigHelper.get(context) .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) { dividerInsetStart = @@ -280,11 +269,6 @@ public class RecyclerMixin implements Mixin { 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) { @@ -311,10 +295,6 @@ public class RecyclerMixin implements Mixin { 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 5fc1d1c..d390780 100644 --- a/main/src/com/google/android/setupdesign/util/ContentStyler.java +++ b/main/src/com/google/android/setupdesign/util/ContentStyler.java @@ -41,7 +41,6 @@ import java.util.Locale; */ public final class ContentStyler { public static void applyBodyPartnerCustomizationStyle(TextView contentText) { - // TODO: Remove the check of applying the heavy theme. if (!PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(contentText)) { return; } @@ -53,7 +52,6 @@ public final class ContentStyler { 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()))); @@ -70,7 +68,6 @@ public final class ContentStyler { */ 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; } @@ -83,9 +80,6 @@ public final class ContentStyler { 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, @@ -94,9 +88,6 @@ public final class ContentStyler { 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)); @@ -137,9 +128,7 @@ public final class ContentStyler { (int) PartnerConfigHelper.get(context) .getDimension(context, PartnerConfig.CONFIG_CONTENT_INFO_ICON_SIZE); - // 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; + lp.width = lp.width * (lp.height / oldHeight); infoIcon.setScaleType(ScaleType.FIT_CENTER); } @@ -194,11 +183,13 @@ public final class ContentStyler { // 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 (PartnerConfigHelper.get(context) - .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_START)) { - result = - PartnerConfigHelper.get(context) - .getDimension(context, PartnerConfig.CONFIG_LAYOUT_MARGIN_START, result); + 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); + } } 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 b779bc6..0a786c6 100644 --- a/main/src/com/google/android/setupdesign/util/DescriptionStyler.java +++ b/main/src/com/google/android/setupdesign/util/DescriptionStyler.java @@ -41,7 +41,6 @@ public final class DescriptionStyler { 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()))); @@ -63,7 +62,6 @@ public final class DescriptionStyler { 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 ad66cb6..2db8c75 100644 --- a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java +++ b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java @@ -19,6 +19,7 @@ package com.google.android.setupdesign.util; import android.content.Context; import androidx.annotation.ColorInt; import androidx.annotation.IntDef; +import androidx.annotation.VisibleForTesting; import com.google.android.setupdesign.R; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -26,6 +27,8 @@ import java.lang.annotation.RetentionPolicy; /** The class to get dynamic colors. */ public final class DynamicColorPalette { + @VisibleForTesting static int colorRes = 0; + private DynamicColorPalette() {} /** Dynamic color category. */ @@ -38,8 +41,7 @@ public final class DynamicColorPalette { ColorType.ERROR_WARNING, ColorType.SUCCESS_DONE, ColorType.FALLBACK_ACCENT, - ColorType.BACKGROUND, - ColorType.SURFACE, + ColorType.BACKGROUND_SURFACE, }) public @interface ColorType { int ACCENT = 0; @@ -49,14 +51,11 @@ public final class DynamicColorPalette { int ERROR_WARNING = 4; int SUCCESS_DONE = 5; int FALLBACK_ACCENT = 6; - int BACKGROUND = 7; - int SURFACE = 8; + int BACKGROUND_SURFACE = 7; } @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; @@ -79,12 +78,9 @@ public final class DynamicColorPalette { case ColorType.FALLBACK_ACCENT: colorRes = R.color.sud_system_fallback_accent; break; - case ColorType.BACKGROUND: + case ColorType.BACKGROUND_SURFACE: 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 e233219..1b3daac 100644 --- a/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java +++ b/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java @@ -19,7 +19,6 @@ package com.google.android.setupdesign.util; 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; @@ -31,14 +30,12 @@ import android.view.ViewTreeObserver; 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; /** @@ -54,11 +51,11 @@ public final class HeaderAreaStyler { "To achieve scaling icon in SetupDesign lib, should use vector drawable icon from "; /** - * Applies the partner style of header text to the given textView {@code header}. + * Applies the partner heavy style of header text to the given textView {@code header}. * - * @param header A header text would apply partner style + * @param header A header text would apply partner heavy style */ - public static void applyPartnerCustomizationHeaderStyle(@Nullable TextView header) { + public static void applyPartnerCustomizationHeaderHeavyStyle(@Nullable TextView header) { if (header == null) { return; @@ -70,7 +67,6 @@ public final class HeaderAreaStyler { 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()))); @@ -94,90 +90,98 @@ public final class HeaderAreaStyler { 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 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 - * enabled. + * Applies the partner light style of header text to the given textView {@code header}. * - * @param headerArea A ViewGroup would apply the partner style of header area + * @param header A header text would apply partner light style */ - public static void applyPartnerCustomizationHeaderAreaStyle(ViewGroup headerArea) { - if (headerArea == null) { + public static void applyPartnerCustomizationHeaderLightStyle(@Nullable TextView header) { + + if (header == null) { return; } - Context context = headerArea.getContext(); - int color = - PartnerConfigHelper.get(context) - .getColor(context, PartnerConfig.CONFIG_HEADER_AREA_BACKGROUND_COLOR); - headerArea.setBackgroundColor(color); + TextViewPartnerStyler.applyPartnerCustomizationLightStyle( + header, + new TextPartnerConfigs( + null, + null, + null, + null, + null, + null, + PartnerStyleHelper.getLayoutGravity(header.getContext()))); + } - 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; + /** + * 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) { - 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 (description == null) { + return; } + + TextViewPartnerStyler.applyPartnerCustomizationLightStyle( + description, + new TextPartnerConfigs( + null, + null, + null, + null, + null, + null, + PartnerStyleHelper.getLayoutGravity(description.getContext()))); } - public static void applyPartnerCustomizationProgressBarStyle(@Nullable ProgressBar progressBar) { - if (progressBar == null) { + /** + * 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 + * enabled. + * + * @param headerArea A ViewGroup would apply the partner style of header area + */ + public static void applyPartnerCustomizationHeaderAreaStyle(ViewGroup headerArea) { + if (headerArea == null) { return; } - Context context = progressBar.getContext(); - final ViewGroup.LayoutParams lp = progressBar.getLayoutParams(); + if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(headerArea)) { + Context context = headerArea.getContext(); + + int color = + PartnerConfigHelper.get(context) + .getColor(context, PartnerConfig.CONFIG_HEADER_AREA_BACKGROUND_COLOR); + headerArea.setBackgroundColor(color); - if (lp instanceof ViewGroup.MarginLayoutParams) { - final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp; - int marginTop = mlp.topMargin; - if (PartnerConfigHelper.get(context) - .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)); - } + .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; - if (marginTop != mlp.topMargin || marginBottom != mlp.bottomMargin) { - mlp.setMargins(mlp.leftMargin, marginTop, mlp.rightMargin, marginBottom); + 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); + } } } } /** - * 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. + * 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. * * @param iconImage A ImageView would apply the partner style of header icon * @param iconContainer The container of the header icon @@ -189,48 +193,46 @@ public final class HeaderAreaStyler { } Context context = iconImage.getContext(); - int reducedIconHeight = 0; int gravity = PartnerStyleHelper.getLayoutGravity(context); if (gravity != 0) { setGravity(iconImage, gravity); } + final ViewGroup.LayoutParams lp = iconContainer.getLayoutParams(); + boolean partnerConfigAvailable = + PartnerConfigHelper.get(context) + .isPartnerConfigAvailable(PartnerConfig.CONFIG_ICON_MARGIN_TOP); + if (partnerConfigAvailable && lp instanceof ViewGroup.MarginLayoutParams) { + final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp; + int topMargin = + (int) + PartnerConfigHelper.get(context) + .getDimension(context, PartnerConfig.CONFIG_ICON_MARGIN_TOP); + 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); - - 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) - .isPartnerConfigAvailable(PartnerConfig.CONFIG_ICON_MARGIN_TOP); - if (partnerConfigAvailable && lp instanceof ViewGroup.MarginLayoutParams) { - final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp; - int topMargin = - (int) - PartnerConfigHelper.get(context) - .getDimension(context, PartnerConfig.CONFIG_ICON_MARGIN_TOP); - topMargin += reducedIconHeight; - mlp.setMargins(mlp.leftMargin, topMargin, mlp.rightMargin, mlp.bottomMargin); + /** 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); } } diff --git a/main/src/com/google/android/setupdesign/util/ItemStyler.java b/main/src/com/google/android/setupdesign/util/ItemStyler.java index 5dbf0a4..ecddfd4 100644 --- a/main/src/com/google/android/setupdesign/util/ItemStyler.java +++ b/main/src/com/google/android/setupdesign/util/ItemStyler.java @@ -95,7 +95,6 @@ public final class ItemStyler { PartnerConfig.CONFIG_ITEMS_TITLE_FONT_FAMILY, null, null, - null, PartnerStyleHelper.getLayoutGravity(titleTextView.getContext()))); } @@ -117,7 +116,6 @@ public final class ItemStyler { 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 9e1d66b..b707521 100644 --- a/main/src/com/google/android/setupdesign/util/LayoutStyler.java +++ b/main/src/com/google/android/setupdesign/util/LayoutStyler.java @@ -21,7 +21,6 @@ import android.content.Context; import android.content.res.TypedArray; import android.os.Build.VERSION_CODES; import android.view.View; -import android.view.ViewGroup; import androidx.annotation.Nullable; import com.google.android.setupcompat.partnerconfig.PartnerConfig; import com.google.android.setupcompat.partnerconfig.PartnerConfigHelper; @@ -53,9 +52,7 @@ public final class LayoutStyler { PartnerConfigHelper.get(context) .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_END); - // TODO: After all users added the check before calling the API, this check can be - // deleted. - if (PartnerStyleHelper.shouldApplyPartnerResource(view) + if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view) && (partnerMarginStartAvailable || partnerMarginEndAvailable)) { int paddingStart; int paddingEnd; @@ -104,9 +101,7 @@ public final class LayoutStyler { PartnerConfigHelper.get(context) .isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_END); - // TODO: After all users added the check before calling the API, this check can be - // deleted. - if (PartnerStyleHelper.shouldApplyPartnerResource(view) + if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view) && (partnerMarginStartAvailable || partnerMarginEndAvailable)) { int extraPaddingStart; int extraPaddingEnd; @@ -133,41 +128,17 @@ public final class LayoutStyler { 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 (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. - ViewGroup.LayoutParams params = view.getLayoutParams(); - ViewGroup.MarginLayoutParams marginLayoutParams; - if (params instanceof ViewGroup.MarginLayoutParams) { - marginLayoutParams = (ViewGroup.MarginLayoutParams) params; - } else { - marginLayoutParams = new ViewGroup.MarginLayoutParams(params); - } - marginLayoutParams.setMargins( - extraPaddingStart, view.getPaddingTop(), extraPaddingEnd, view.getPaddingBottom()); - } else { - view.setPadding( - extraPaddingStart, view.getPaddingTop(), extraPaddingEnd, view.getPaddingBottom()); - } + // 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()); } } } diff --git a/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java b/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java index b56d09a..7b4acea 100644 --- a/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java +++ b/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java @@ -26,7 +26,6 @@ import androidx.annotation.NonNull; 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 { @@ -86,44 +85,8 @@ final class TextViewPartnerStyler { } } - 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(); @@ -154,6 +117,23 @@ final class TextViewPartnerStyler { 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. */ @@ -162,7 +142,6 @@ final class TextViewPartnerStyler { 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; @@ -172,7 +151,6 @@ final class TextViewPartnerStyler { @Nullable PartnerConfig textLinkedColorConfig, @Nullable PartnerConfig textSizeConfig, @Nullable PartnerConfig textFontFamilyConfig, - @Nullable PartnerConfig textLinkFontFamilyConfig, @Nullable PartnerConfig textMarginTopConfig, @Nullable PartnerConfig textMarginBottomConfig, int textGravity) { @@ -180,7 +158,6 @@ final class TextViewPartnerStyler { this.textLinkedColorConfig = textLinkedColorConfig; this.textSizeConfig = textSizeConfig; this.textFontFamilyConfig = textFontFamilyConfig; - this.textLinkFontFamilyConfig = textLinkFontFamilyConfig; this.textMarginTopConfig = textMarginTopConfig; this.textMarginBottomConfig = textMarginBottomConfig; this.textGravity = textGravity; @@ -202,10 +179,6 @@ final class TextViewPartnerStyler { 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 eeee7dd..0b750c9 100644 --- a/main/src/com/google/android/setupdesign/util/ThemeHelper.java +++ b/main/src/com/google/android/setupdesign/util/ThemeHelper.java @@ -71,14 +71,12 @@ public final class ThemeHelper { public static final String THEME_GLIF_V3_LIGHT = "glif_v3_light"; /** - * 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. + * Placeholder, not avirailed yet. */ public static final String THEME_GLIF_V4 = "glif_v4"; /** - * Passed in a setup wizard intent as {@link WizardManagerHelper#EXTRA_THEME}. This is the default - * theme used in setup wizard for T. + * Placeholder, not avirailed yet. */ public static final String THEME_GLIF_V4_LIGHT = "glif_v4_light"; @@ -168,14 +166,16 @@ public final class ThemeHelper { return PartnerConfigHelper.shouldApplyExtendedPartnerConfig(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 the partner provider of SetupWizard is ready to support dynamic color. + */ + public static boolean isSetupWizardDynamicColorEnabled(@NonNull Context context) { + return PartnerConfigHelper.isSetupWizardDynamicColorEnabled(context); } /** Returns {@code true} if this {@code context} should apply dynamic color. */ public static boolean shouldApplyDynamicColor(@NonNull Context context) { - return PartnerConfigHelper.isSetupWizardDynamicColorEnabled(context); + return shouldApplyExtendedPartnerConfig(context) && isSetupWizardDynamicColorEnabled(context); } /** @@ -203,19 +203,19 @@ public final class ThemeHelper { // return theme for inside setup flow resId = isDayNightEnabled - ? R.style.SudDynamicColorTheme_DayNight - : R.style.SudDynamicColorTheme_Light; + ? R.style.SudDynamicColorThemeGlifV3_DayNight + : R.style.SudDynamicColorThemeGlifV3_Light; } else { // return theme for outside setup flow resId = isDayNightEnabled - ? R.style.SudFullDynamicColorTheme_DayNight - : R.style.SudFullDynamicColorTheme_Light; + ? R.style.SudFullDynamicColorThemeGlifV3_DayNight + : R.style.SudFullDynamicColorThemeGlifV3_Light; LOG.atInfo( "Return " + (isDayNightEnabled - ? "SudFullDynamicColorTheme_DayNight" - : "SudFullDynamicColorTheme_Light")); + ? "SudFullDynamicColorThemeGlifV3_DayNight" + : "SudFullDynamicColorThemeGlifV3_Light")); } LOG.atDebug( @@ -237,12 +237,12 @@ public final class ThemeHelper { /** Returns {@code true} if the dynamic color is set. */ public static boolean trySetDynamicColor(@NonNull Context context) { - if (!BuildCompatUtils.isAtLeastS()) { - LOG.w("Dynamic color require platform version at least S."); + if (!shouldApplyExtendedPartnerConfig(context)) { + LOG.w("SetupWizard does not supports the extended partner configs."); return false; } - if (!shouldApplyDynamicColor(context)) { + if (!isSetupWizardDynamicColorEnabled(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 d90b104..c7a28b1 100644 --- a/main/src/com/google/android/setupdesign/util/ThemeResolver.java +++ b/main/src/com/google/android/setupdesign/util/ThemeResolver.java @@ -156,9 +156,6 @@ public class ThemeResolver { 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; @@ -186,10 +183,6 @@ public class ThemeResolver { 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: @@ -225,9 +218,6 @@ public class ThemeResolver { 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 d4e6ad8..9f0e21d 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.Outline; 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 ffb3d70..d02839b 100644 --- a/main/src/com/google/android/setupdesign/view/IntrinsicSizeFrameLayout.java +++ b/main/src/com/google/android/setupdesign/view/IntrinsicSizeFrameLayout.java @@ -16,23 +16,13 @@ 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; @@ -50,10 +40,6 @@ public class IntrinsicSizeFrameLayout extends FrameLayout { 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); @@ -119,47 +105,9 @@ public class IntrinsicSizeFrameLayout extends FrameLayout { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - 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; + super.onMeasure( + getIntrinsicMeasureSpec(widthMeasureSpec, intrinsicWidth), + getIntrinsicMeasureSpec(heightMeasureSpec, intrinsicHeight)); } private int getIntrinsicMeasureSpec(int measureSpec, int intrinsicSize) { @@ -175,25 +123,9 @@ public class IntrinsicSizeFrameLayout extends FrameLayout { } 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(min(size, intrinsicHeight), MeasureSpec.EXACTLY); + return MeasureSpec.makeMeasureSpec(Math.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 182981f..f3348b4 100644 --- a/main/src/com/google/android/setupdesign/view/RichTextView.java +++ b/main/src/com/google/android/setupdesign/view/RichTextView.java @@ -16,13 +16,11 @@ 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; @@ -34,8 +32,6 @@ import android.text.style.TypefaceSpan; 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; @@ -55,8 +51,6 @@ public class RichTextView extends AppCompatTextView implements OnLinkClickListen 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: @@ -68,8 +62,6 @@ public class RichTextView extends AppCompatTextView implements OnLinkClickListen * 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); @@ -89,10 +81,7 @@ public class RichTextView extends AppCompatTextView implements OnLinkClickListen SpanHelper.replaceSpan(spannable, span, textAppearanceSpan); } else if (ANNOTATION_LINK.equals(key)) { LinkSpan link = new LinkSpan(span.getValue()); - TypefaceSpan typefaceSpan = - (spanTypeface != null) - ? new TypefaceSpan(spanTypeface) - : new TypefaceSpan("sans-serif-medium"); + TypefaceSpan typefaceSpan = new TypefaceSpan("sans-serif-medium"); SpanHelper.replaceSpan(spannable, span, link, typefaceSpan); } } @@ -125,17 +114,6 @@ public class RichTextView extends AppCompatTextView implements OnLinkClickListen 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 7461fc6..e8316f3 100644 --- a/strings/AndroidManifest.xml +++ b/strings/AndroidManifest.xml @@ -20,6 +20,6 @@ <uses-sdk android:minSdkVersion="14" - android:targetSdkVersion="32" /> + android:targetSdkVersion="28" /> </manifest> |