diff options
author | Xin Li <delphij@google.com> | 2023-10-05 15:39:39 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2023-10-05 15:39:39 -0700 |
commit | fb7798afcb8b495a673400fe3730b6c02c00d545 (patch) | |
tree | da3b4d7cdcf184f41fb9d883cfc792f3d1919b68 | |
parent | ad88e339ded9fe704368ef512c8e5e013b3e8659 (diff) | |
parent | ecc2f29c9659de84ecba2f684c0894efa47819ef (diff) | |
download | setupdesign-fb7798afcb8b495a673400fe3730b6c02c00d545.tar.gz |
Merge Android 14
Bug: 298295554
Merged-In: I7e5b5f41e42f19eb3afa31e80f6bea1fc72f1e93
Change-Id: Ibd889b66d9c30dc44444e7efaff370375ca5e0a7
55 files changed, 1799 insertions, 138 deletions
@@ -29,10 +29,11 @@ android_library { name: "setupdesign", static_libs: [ "androidx.annotation_annotation", + "androidx.appcompat_appcompat", "androidx.core_core", "androidx.legacy_legacy-support-core-ui", - "androidx.appcompat_appcompat", "androidx.recyclerview_recyclerview", + "androidx.window_window", "com.google.android.material_material", "error_prone_annotations", "setupcompat", @@ -47,6 +48,9 @@ android_library { "main/src/**/*.java", ], min_sdk_version: "14", + optimize: { + proguard_flags_files: ["proguard.flags"], + } } // diff --git a/lint-baseline.xml b/lint-baseline.xml index c369cea..6177906 100644 --- a/lint-baseline.xml +++ b/lint-baseline.xml @@ -3,101 +3,64 @@ <issue id="NewApi" - message="`android:datePickerDialogTheme` requires API level 21 (current min is 14)" - errorLine1=" <item name="android:datePickerDialogTheme">@style/SudDateTimePickerDialogTheme</item>" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + message="`@android:interpolator/linear_out_slow_in` requires API level 21 (current min is 14)" + errorLine1=' android:interpolator="@android:interpolator/linear_out_slow_in"' + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> <location - file="external/setupdesign/main/res/values/styles.xml" - line="291" - column="15"/> + file="external/setupdesign/main/res/anim/sud_pre_p_activity_close_enter.xml" + line="21" + column="9"/> </issue> <issue id="NewApi" - message="`android:timePickerDialogTheme` requires API level 21 (current min is 14)" - errorLine1=" <item name="android:timePickerDialogTheme">@style/SudDateTimePickerDialogTheme</item>" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + message="`@android:interpolator/fast_out_slow_in` requires API level 21 (current min is 14)" + errorLine1=' android:interpolator="@android:interpolator/fast_out_slow_in"' + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> <location - file="external/setupdesign/main/res/values/styles.xml" - line="292" - column="15"/> + file="external/setupdesign/main/res/anim/sud_pre_p_activity_open_exit.xml" + line="22" + column="9"/> </issue> <issue id="NewApi" - message="`android:datePickerDialogTheme` requires API level 21 (current min is 14)" - errorLine1=" <item name="android:datePickerDialogTheme">@style/SudDateTimePickerDialogTheme.Light</item>" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + message="`android:datePickerDialogTheme` requires API level 21 (current min is 14)"> <location file="external/setupdesign/main/res/values/styles.xml" - line="302" - column="15"/> + line="371"/> </issue> <issue id="NewApi" - message="`android:timePickerDialogTheme` requires API level 21 (current min is 14)" - errorLine1=" <item name="android:timePickerDialogTheme">@style/SudDateTimePickerDialogTheme.Light</item>" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + message="`android:datePickerDialogTheme` requires API level 21 (current min is 14)"> <location file="external/setupdesign/main/res/values/styles.xml" - line="303" - column="15"/> + line="385"/> </issue> <issue id="NewApi" - message="`android:stateListAnimator` requires API level 21 (current min is 14)" - errorLine1=" <item name="android:stateListAnimator">@null</item>" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + message="`android:stateListAnimator` requires API level 21 (current min is 14)"> <location file="external/setupdesign/main/res/values/styles.xml" - line="523" - column="15"/> + line="718"/> </issue> <issue id="NewApi" - message="`android:fontFamily` requires API level 16 (current min is 14)" - errorLine1=" <item name="android:fontFamily">@string/sudFontSecondaryMedium</item>" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~"> + message="`android:timePickerDialogTheme` requires API level 21 (current min is 14)"> <location file="external/setupdesign/main/res/values/styles.xml" - line="619" - column="15"/> - </issue> - - <issue - id="NewApi" - message="Attribute `paddingStart` referenced here can result in a crash on some specific devices older than API 17 (current min is 14)" - errorLine1=" android:paddingStart="?attr/listPreferredItemPaddingLeft">" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> - <location - file="external/setupdesign/main/res/layout/sud_items_expandable_switch.xml" - line="38" - column="9"/> + line="372"/> </issue> <issue id="NewApi" - message="`@android:interpolator/linear_out_slow_in` requires API level 21 (current min is 14)" - errorLine1=" android:interpolator="@android:interpolator/linear_out_slow_in"" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + message="`android:timePickerDialogTheme` requires API level 21 (current min is 14)"> <location - file="external/setupdesign/main/res/anim/sud_pre_p_activity_close_enter.xml" - line="21" - column="9"/> - </issue> - - <issue - id="NewApi" - message="`@android:interpolator/fast_out_slow_in` requires API level 21 (current min is 14)" - errorLine1=" android:interpolator="@android:interpolator/fast_out_slow_in"" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> - <location - file="external/setupdesign/main/res/anim/sud_pre_p_activity_open_exit.xml" - line="22" - column="9"/> + file="external/setupdesign/main/res/values/styles.xml" + line="386"/> </issue> -</issues> +</issues>
\ No newline at end of file diff --git a/lottie_loading_layout/res/layout/sud_glif_fullscreen_loading_embedded_template_card.xml b/lottie_loading_layout/res/layout/sud_glif_fullscreen_loading_embedded_template_card.xml new file mode 100644 index 0000000..b24fda4 --- /dev/null +++ b/lottie_loading_layout/res/layout/sud_glif_fullscreen_loading_embedded_template_card.xml @@ -0,0 +1,49 @@ +<?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. +--> + +<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_embedded_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/sud_glif_fullscreen_loading_embedded_template_content.xml b/lottie_loading_layout/res/layout/sud_glif_fullscreen_loading_embedded_template_content.xml new file mode 100644 index 0000000..e1dc7c4 --- /dev/null +++ b/lottie_loading_layout/res/layout/sud_glif_fullscreen_loading_embedded_template_content.xml @@ -0,0 +1,96 @@ +<?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. +--> +<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/sud_glif_loading_embedded_template_card.xml b/lottie_loading_layout/res/layout/sud_glif_loading_embedded_template_card.xml new file mode 100644 index 0000000..9092e1a --- /dev/null +++ b/lottie_loading_layout/res/layout/sud_glif_loading_embedded_template_card.xml @@ -0,0 +1,49 @@ +<?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. +--> + +<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_loading_embedded_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/sud_glif_loading_embedded_template_compat.xml b/lottie_loading_layout/res/layout/sud_glif_loading_embedded_template_compat.xml new file mode 100644 index 0000000..b79851a --- /dev/null +++ b/lottie_loading_layout/res/layout/sud_glif_loading_embedded_template_compat.xml @@ -0,0 +1,26 @@ +<?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. +--> + +<com.google.android.setupcompat.view.StatusBarBackgroundLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/suc_layout_status" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <include layout="@layout/sud_glif_loading_embedded_template_content" /> + +</com.google.android.setupcompat.view.StatusBarBackgroundLayout> diff --git a/lottie_loading_layout/res/layout/sud_glif_loading_embedded_template_content.xml b/lottie_loading_layout/res/layout/sud_glif_loading_embedded_template_content.xml new file mode 100644 index 0000000..a49aead --- /dev/null +++ b/lottie_loading_layout/res/layout/sud_glif_loading_embedded_template_content.xml @@ -0,0 +1,80 @@ +<?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. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + 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" /> + + <!-- Ignore UnusedAttribute: scrollIndicators is new in M. Default to no indicators in older + versions. --> + <com.google.android.setupdesign.view.BottomScrollView + android:id="@+id/sud_scroll_view" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:fillViewport="true" + android:scrollIndicators="?attr/sudScrollIndicators" + tools:ignore="UnusedAttribute"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <include layout="@layout/sud_glif_header" /> + + <ViewStub + android:id="@+id/sud_loading_layout_illustration_stub" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:inflatedId="@+id/sud_layout_progress_illustration" + android:layout="@layout/sud_loading_illustration_layout" /> + + <ViewStub + android:id="@+id/sud_loading_layout_lottie_stub" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:inflatedId="@+id/sud_layout_lottie_illustration" + android:layout="@layout/sud_loading_lottie_layout" /> + + <FrameLayout + android:id="@+id/sud_layout_content" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:visibility="gone" /> + + </LinearLayout> + + </com.google.android.setupdesign.view.BottomScrollView> + + <ViewStub + android:id="@+id/suc_layout_footer" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + +</LinearLayout> diff --git a/lottie_loading_layout/res/values-sw600dp-v31/layouts.xml b/lottie_loading_layout/res/values-sw600dp-v31/layouts.xml index f627c06..534b956 100644 --- a/lottie_loading_layout/res/values-sw600dp-v31/layouts.xml +++ b/lottie_loading_layout/res/values-sw600dp-v31/layouts.xml @@ -17,5 +17,7 @@ <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_loading_embedded_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_embedded_template_card</item> <item name="sud_glif_fullscreen_loading_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_fullscreen_loading_template_card</item> + <item name="sud_glif_fullscreen_loading_embedded_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_fullscreen_loading_embedded_template_card</item> </resources> diff --git a/lottie_loading_layout/res/values-sw600dp/layouts.xml b/lottie_loading_layout/res/values-sw600dp/layouts.xml index 9fe5404..3afbee7 100644 --- a/lottie_loading_layout/res/values-sw600dp/layouts.xml +++ b/lottie_loading_layout/res/values-sw600dp/layouts.xml @@ -17,4 +17,5 @@ <resources xmlns:tools="http://schemas.android.com/tools"> <item name="sud_glif_loading_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_card</item> + <item name="sud_glif_loading_embedded_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_embedded_template_card</item> </resources> diff --git a/lottie_loading_layout/res/values/layouts.xml b/lottie_loading_layout/res/values/layouts.xml index 9ea5e67..8298bb1 100644 --- a/lottie_loading_layout/res/values/layouts.xml +++ b/lottie_loading_layout/res/values/layouts.xml @@ -17,5 +17,7 @@ <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_loading_embedded_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_embedded_template_compat</item> <item name="sud_glif_fullscreen_loading_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_compat</item> + <item name="sud_glif_fullscreen_loading_embedded_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_embedded_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 4983c03..00be9ea 100644 --- a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java +++ b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java @@ -17,26 +17,28 @@ package com.google.android.setupdesign; import static com.google.android.setupcompat.partnerconfig.Util.isNightMode; +import static java.lang.Math.min; import android.animation.Animator; import android.animation.Animator.AnimatorListener; -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; import android.os.Build.VERSION_CODES; import android.os.Bundle; +import android.os.PersistableBundle; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; +import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.view.ViewStub; import android.widget.LinearLayout; @@ -50,7 +52,6 @@ import androidx.annotation.VisibleForTesting; import com.airbnb.lottie.LottieAnimationView; import com.airbnb.lottie.LottieDrawable; import com.airbnb.lottie.LottieProperty; -import com.airbnb.lottie.SimpleColorFilter; import com.airbnb.lottie.model.KeyPath; import com.airbnb.lottie.value.LottieValueCallback; import com.airbnb.lottie.value.SimpleLottieValueCallback; @@ -62,14 +63,13 @@ 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.util.LottieAnimationHelper; import com.google.android.setupdesign.view.IllustrationVideoView; import java.io.InputStream; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * A GLIF themed layout with a {@link com.airbnb.lottie.LottieAnimationView} to showing lottie @@ -88,11 +88,11 @@ public class GlifLoadingLayout extends GlifLayout { @VisibleForTesting @RawRes int customLottieResource = 0; - @VisibleForTesting Map<KeyPath, SimpleColorFilter> customizationMap = new HashMap<>(); - private AnimatorListener animatorListener; private Runnable nextActionRunnable; private boolean workFinished; + protected static final String GLIF_LAYOUT_TYPE = "GlifLayoutType"; + protected static final String LOADING_LAYOUT = "LoadingLayout"; @VisibleForTesting public boolean runRunnable; @VisibleForTesting @@ -116,7 +116,6 @@ public class GlifLoadingLayout extends GlifLayout { init(attrs, com.google.android.setupdesign.R.attr.sudLayoutTheme); } - @TargetApi(VERSION_CODES.HONEYCOMB) public GlifLoadingLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(attrs, defStyleAttr); @@ -230,7 +229,6 @@ public class GlifLoadingLayout extends GlifLayout { if (!illustrationType.equals(type)) { illustrationType = type; - customizationMap.clear(); } switch (type) { @@ -453,7 +451,7 @@ public class GlifLoadingLayout extends GlifLayout { paddingBottom = (int) configPaddingBottom - (int) - Math.min( + min( configPaddingBottom, getButtonContainerHeight(footerBarMixin.getButtonContainer())); } @@ -521,7 +519,13 @@ public class GlifLoadingLayout extends GlifLayout { lottieView.playAnimation(); setLottieLayoutVisibility(View.VISIBLE); setIllustrationLayoutVisibility(View.GONE); - applyThemeCustomization(); + LottieAnimationHelper.get() + .applyColor( + getContext(), + findLottieAnimationView(), + isNightMode(getResources().getConfiguration()) + ? animationConfig.getDarkThemeCustomization() + : animationConfig.getLightThemeCustomization()); } else { setLottieLayoutVisibility(View.GONE); setIllustrationLayoutVisibility(View.VISIBLE); @@ -654,43 +658,6 @@ public class GlifLoadingLayout extends GlifLayout { } } - @VisibleForTesting - protected void loadCustomization() { - if (customizationMap.isEmpty()) { - PartnerConfigHelper helper = PartnerConfigHelper.get(getContext()); - List<String> lists = - helper.getStringArray( - getContext(), - isNightMode(getResources().getConfiguration()) - ? animationConfig.getDarkThemeCustomization() - : animationConfig.getLightThemeCustomization()); - for (String item : lists) { - String[] splitItem = item.split(":"); - if (splitItem.length == 2) { - customizationMap.put( - new KeyPath("**", splitItem[0], "**"), - new SimpleColorFilter(Color.parseColor(splitItem[1]))); - } else { - Log.w(TAG, "incorrect format customization, value=" + item); - } - } - } - } - - @VisibleForTesting - protected void applyThemeCustomization() { - LottieAnimationView animationView = findLottieAnimationView(); - if (animationView != null) { - loadCustomization(); - for (KeyPath keyPath : customizationMap.keySet()) { - animationView.addValueCallback( - keyPath, - LottieProperty.COLOR_FILTER, - new LottieValueCallback<>(customizationMap.get(keyPath))); - } - } - } - @Nullable private View peekLottieLayout() { return findViewById(R.id.sud_layout_lottie_illustration); @@ -703,17 +670,28 @@ public class GlifLoadingLayout extends GlifLayout { @Override protected View onInflateTemplate(LayoutInflater inflater, int template) { + Context context = getContext(); if (template == 0) { boolean useFullScreenIllustration = - PartnerConfigHelper.get(getContext()) + PartnerConfigHelper.get(context) .getBoolean( - getContext(), + context, PartnerConfig.CONFIG_LOADING_LAYOUT_FULL_SCREEN_ILLUSTRATION_ENABLED, false); if (useFullScreenIllustration) { template = R.layout.sud_glif_fullscreen_loading_template; + + // if the activity is embedded should apply an embedded layout. + if (isEmbeddedActivityOnePaneEnabled(context)) { + template = R.layout.sud_glif_fullscreen_loading_embedded_template; + } } else { template = R.layout.sud_glif_loading_template; + + // if the activity is embedded should apply an embedded layout. + if (isEmbeddedActivityOnePaneEnabled(context)) { + template = R.layout.sud_glif_loading_embedded_template; + } } } return inflateTemplate( @@ -730,6 +708,16 @@ public class GlifLoadingLayout extends GlifLayout { return super.findContainer(containerId); } + @Override + protected void onDetachedFromWindow() { + if (VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + PersistableBundle bundle = new PersistableBundle(); + bundle.putString(GLIF_LAYOUT_TYPE, LOADING_LAYOUT); + setLayoutTypeMetrics(bundle); + super.onDetachedFromWindow(); + } + } + /** The progress config used to maps to different animation */ public enum LottieAnimationConfig { CONFIG_DEFAULT( diff --git a/lottie_loading_layout/src/com/google/android/setupdesign/util/LottieAnimationHelper.java b/lottie_loading_layout/src/com/google/android/setupdesign/util/LottieAnimationHelper.java new file mode 100644 index 0000000..e6cdc11 --- /dev/null +++ b/lottie_loading_layout/src/com/google/android/setupdesign/util/LottieAnimationHelper.java @@ -0,0 +1,134 @@ +/* + * 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. + */ + +package com.google.android.setupdesign.util; + +import android.content.Context; +import android.content.res.Resources; +import android.graphics.Color; +import android.util.Log; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; +import com.airbnb.lottie.LottieAnimationView; +import com.airbnb.lottie.LottieProperty; +import com.airbnb.lottie.SimpleColorFilter; +import com.airbnb.lottie.model.KeyPath; +import com.airbnb.lottie.value.LottieValueCallback; +import com.google.android.setupcompat.partnerconfig.PartnerConfig; +import com.google.android.setupcompat.partnerconfig.PartnerConfigHelper; +import com.google.android.setupcompat.util.BuildCompatUtils; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** A helper to help apply color on lottie animation */ +public class LottieAnimationHelper { + + private static final String TAG = "LottieAnimationHelper"; + + private static LottieAnimationHelper instance = null; + + @VisibleForTesting public final Map<String, Integer> colorResourceMapping; + + public static LottieAnimationHelper get() { + if (instance == null) { + instance = new LottieAnimationHelper(); + } + return instance; + } + + private LottieAnimationHelper() { + colorResourceMapping = new HashMap<>(); + } + + /** + * The color resource is from PartnerConfig, which is a string array and each string will be + * {key_path_name}:@{color_reference} or {key_path_name}:{color code} + */ + public void applyColor( + @NonNull Context context, LottieAnimationView lottieView, PartnerConfig partnerConfig) { + applyColor( + context, + lottieView, + PartnerConfigHelper.get(context).getStringArray(context, partnerConfig)); + } + + /** + * The color resource is from list of string and each string will be + * {key_path_name}:@{color_reference} or {key_path_name}:#{color code} + */ + public void applyColor( + @NonNull Context context, LottieAnimationView lottieView, List<String> colorMappings) { + applyColor(context, lottieView, parseColorMapping(context, colorMappings)); + } + + /** + * The color resource is from a color mapping table and the key is the keypath, and value is color + * Integer. + */ + public void applyColor( + @NonNull Context context, + LottieAnimationView lottieView, + Map<KeyPath, Integer> colorMappings) { + for (KeyPath keyPath : colorMappings.keySet()) { + lottieView.addValueCallback( + keyPath, + LottieProperty.COLOR_FILTER, + new LottieValueCallback<>(new SimpleColorFilter(colorMappings.get(keyPath)))); + } + } + + private Map<KeyPath, Integer> parseColorMapping( + @NonNull Context context, List<String> colorMappings) { + Map<KeyPath, Integer> customizationMap = new HashMap<>(); + for (String colorMapping : colorMappings) { + String[] splitItem = colorMapping.split(":"); + if (splitItem.length == 2) { + if (splitItem[1].charAt(0) == '#') { // color code + try { + customizationMap.put( + new KeyPath("**", splitItem[0], "**"), Color.parseColor(splitItem[1])); + } catch (IllegalArgumentException exception) { + Log.e(TAG, "Unknown color, value=" + colorMapping); + } + } else if (splitItem[1].charAt(0) == '@') { // color resource + int colorResourceId; + if (colorResourceMapping.containsKey(splitItem[1])) { + colorResourceId = colorResourceMapping.get(splitItem[1]); + } else { + colorResourceId = + context + .getResources() + .getIdentifier(splitItem[1].substring(1), "color", context.getPackageName()); + colorResourceMapping.put(splitItem[1], colorResourceId); + } + try { + customizationMap.put( + new KeyPath("**", splitItem[0], "**"), + context.getResources().getColor(colorResourceId)); + } catch (Resources.NotFoundException exception) { + Log.e(TAG, "Resource Not found, resource value=" + colorMapping); + } + } else { + Log.w(TAG, "incorrect format customization, value=" + colorMapping); + } + } else { + Log.w(TAG, "incorrect format customization, value=" + colorMapping); + } + } + return customizationMap; + } +} diff --git a/main/res/anim-night-v34/shared_x_axis_activity_close_enter.xml b/main/res/anim-night-v34/shared_x_axis_activity_close_enter.xml new file mode 100644 index 0000000..2496f2d --- /dev/null +++ b/main/res/anim-night-v34/shared_x_axis_activity_close_enter.xml @@ -0,0 +1,43 @@ +<?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. + --> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false" + android:showBackdrop="true" + android:backdropColor="@color/sud_glif_background_color_dark"> + + <alpha + android:fromAlpha="0.0" + android:toAlpha="1.0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/standard_decelerate" + android:startOffset="100" + android:duration="350" /> + + <translate + android:fromXDelta="-25%" + android:toXDelta="0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/fast_out_extra_slow_in" + android:startOffset="0" + android:duration="450" /> + +</set>
\ No newline at end of file diff --git a/main/res/anim-night-v34/shared_x_axis_activity_open_enter.xml b/main/res/anim-night-v34/shared_x_axis_activity_open_enter.xml new file mode 100644 index 0000000..a26b3e9 --- /dev/null +++ b/main/res/anim-night-v34/shared_x_axis_activity_open_enter.xml @@ -0,0 +1,43 @@ +<?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. + --> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false" + android:showBackdrop="true" + android:backdropColor="@color/sud_glif_background_color_dark"> + + <alpha + android:fromAlpha="0.0" + android:toAlpha="1.0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/standard_decelerate" + android:startOffset="100" + android:duration="350" /> + + <translate + android:fromXDelta="25%" + android:toXDelta="0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/fast_out_extra_slow_in" + android:startOffset="0" + android:duration="450" /> + +</set>
\ No newline at end of file diff --git a/main/res/anim-v34/shared_x_axis_activity_close_enter.xml b/main/res/anim-v34/shared_x_axis_activity_close_enter.xml new file mode 100644 index 0000000..54cfc89 --- /dev/null +++ b/main/res/anim-v34/shared_x_axis_activity_close_enter.xml @@ -0,0 +1,43 @@ +<?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. + --> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false" + android:showBackdrop="true" + android:backdropColor="@color/sud_glif_background_color_light"> + + <alpha + android:fromAlpha="0.0" + android:toAlpha="1.0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/standard_decelerate" + android:startOffset="100" + android:duration="350" /> + + <translate + android:fromXDelta="-25%" + android:toXDelta="0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/fast_out_extra_slow_in" + android:startOffset="0" + android:duration="450" /> + +</set>
\ No newline at end of file diff --git a/main/res/anim-v34/shared_x_axis_activity_close_enter_dynamic_color.xml b/main/res/anim-v34/shared_x_axis_activity_close_enter_dynamic_color.xml new file mode 100644 index 0000000..a9d0a82 --- /dev/null +++ b/main/res/anim-v34/shared_x_axis_activity_close_enter_dynamic_color.xml @@ -0,0 +1,43 @@ +<?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. + --> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false" + android:showBackdrop="true" + android:backdropColor="@color/sud_system_background_surface"> + + <alpha + android:fromAlpha="0.0" + android:toAlpha="1.0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/standard_decelerate" + android:startOffset="100" + android:duration="350" /> + + <translate + android:fromXDelta="-25%" + android:toXDelta="0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/fast_out_extra_slow_in" + android:startOffset="0" + android:duration="450" /> + +</set>
\ No newline at end of file diff --git a/main/res/anim-v34/shared_x_axis_activity_close_exit.xml b/main/res/anim-v34/shared_x_axis_activity_close_exit.xml new file mode 100644 index 0000000..e2a79e0 --- /dev/null +++ b/main/res/anim-v34/shared_x_axis_activity_close_exit.xml @@ -0,0 +1,41 @@ +<?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. + --> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false"> + + <alpha + android:fromAlpha="1.0" + android:toAlpha="0.0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/standard_accelerate" + android:startOffset="0" + android:duration="100" /> + + <translate + android:fromXDelta="0" + android:toXDelta="25%" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/fast_out_extra_slow_in" + android:startOffset="0" + android:duration="450" /> + +</set>
\ No newline at end of file diff --git a/main/res/anim-v34/shared_x_axis_activity_open_enter.xml b/main/res/anim-v34/shared_x_axis_activity_open_enter.xml new file mode 100644 index 0000000..b0a5ca6 --- /dev/null +++ b/main/res/anim-v34/shared_x_axis_activity_open_enter.xml @@ -0,0 +1,43 @@ +<?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. + --> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false" + android:showBackdrop="true" + android:backdropColor="@color/sud_glif_background_color_light"> + + <alpha + android:fromAlpha="0.0" + android:toAlpha="1.0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/standard_decelerate" + android:startOffset="100" + android:duration="350" /> + + <translate + android:fromXDelta="25%" + android:toXDelta="0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/fast_out_extra_slow_in" + android:startOffset="0" + android:duration="450" /> + +</set>
\ No newline at end of file diff --git a/main/res/anim-v34/shared_x_axis_activity_open_enter_dynamic_color.xml b/main/res/anim-v34/shared_x_axis_activity_open_enter_dynamic_color.xml new file mode 100644 index 0000000..3d797cf --- /dev/null +++ b/main/res/anim-v34/shared_x_axis_activity_open_enter_dynamic_color.xml @@ -0,0 +1,43 @@ +<?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. + --> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false" + android:showBackdrop="true" + android:backdropColor="@color/sud_system_background_surface"> + + <alpha + android:fromAlpha="0.0" + android:toAlpha="1.0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/standard_decelerate" + android:startOffset="100" + android:duration="350" /> + + <translate + android:fromXDelta="25%" + android:toXDelta="0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/fast_out_extra_slow_in" + android:startOffset="0" + android:duration="450" /> + +</set>
\ No newline at end of file diff --git a/main/res/anim-v34/shared_x_axis_activity_open_exit.xml b/main/res/anim-v34/shared_x_axis_activity_open_exit.xml new file mode 100644 index 0000000..f55baeb --- /dev/null +++ b/main/res/anim-v34/shared_x_axis_activity_open_exit.xml @@ -0,0 +1,41 @@ +<?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. + --> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false"> + + <alpha + android:fromAlpha="1.0" + android:toAlpha="0.0" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/standard_accelerate" + android:startOffset="0" + android:duration="100" /> + + <translate + android:fromXDelta="0" + android:toXDelta="-25%" + android:fillEnabled="true" + android:fillBefore="true" + android:fillAfter="true" + android:interpolator="@interpolator/fast_out_extra_slow_in" + android:startOffset="0" + android:duration="450" /> + +</set>
\ No newline at end of file diff --git a/main/res/interpolator-v21/fast_out_extra_slow_in.xml b/main/res/interpolator-v21/fast_out_extra_slow_in.xml new file mode 100644 index 0000000..f296a82 --- /dev/null +++ b/main/res/interpolator-v21/fast_out_extra_slow_in.xml @@ -0,0 +1,19 @@ +<?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 + --> + +<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android" + android:pathData="M 0,0 C 0.05, 0, 0.133333, 0.06, 0.166666, 0.4 C 0.208333, 0.82, 0.25, 1, 1, 1"/>
\ No newline at end of file diff --git a/main/res/interpolator-v21/standard_accelerate.xml b/main/res/interpolator-v21/standard_accelerate.xml new file mode 100644 index 0000000..394393d --- /dev/null +++ b/main/res/interpolator-v21/standard_accelerate.xml @@ -0,0 +1,22 @@ +<?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. + --> + +<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android" + android:controlX1="0.3" + android:controlY1="0" + android:controlX2="1" + android:controlY2="1"/>
\ No newline at end of file diff --git a/main/res/interpolator-v21/standard_decelerate.xml b/main/res/interpolator-v21/standard_decelerate.xml new file mode 100644 index 0000000..579f4f5 --- /dev/null +++ b/main/res/interpolator-v21/standard_decelerate.xml @@ -0,0 +1,22 @@ +<?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. + --> + +<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android" + android:controlX1="0" + android:controlY1="0" + android:controlX2="0" + android:controlY2="1"/>
\ No newline at end of file diff --git a/main/res/layout/sud_glif_blank_embedded_template_card.xml b/main/res/layout/sud_glif_blank_embedded_template_card.xml new file mode 100644 index 0000000..89badcd --- /dev/null +++ b/main/res/layout/sud_glif_blank_embedded_template_card.xml @@ -0,0 +1,49 @@ +<?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. +--> + +<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_blank_embedded_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_blank_embedded_template_compact.xml b/main/res/layout/sud_glif_blank_embedded_template_compact.xml new file mode 100644 index 0000000..5b26190 --- /dev/null +++ b/main/res/layout/sud_glif_blank_embedded_template_compact.xml @@ -0,0 +1,26 @@ +<?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. +--> + +<com.google.android.setupcompat.view.StatusBarBackgroundLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/suc_layout_status" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <include layout="@layout/sud_glif_blank_embedded_template_content" /> + +</com.google.android.setupcompat.view.StatusBarBackgroundLayout> diff --git a/main/res/layout/sud_glif_blank_embedded_template_content.xml b/main/res/layout/sud_glif_blank_embedded_template_content.xml new file mode 100644 index 0000000..359c3a8 --- /dev/null +++ b/main/res/layout/sud_glif_blank_embedded_template_content.xml @@ -0,0 +1,41 @@ +<?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. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + 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" /> + + <FrameLayout + android:id="@+id/sud_layout_content" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" /> + + <ViewStub + android:id="@+id/suc_layout_footer" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + +</LinearLayout> diff --git a/main/res/layout/sud_glif_embedded_template_card.xml b/main/res/layout/sud_glif_embedded_template_card.xml new file mode 100644 index 0000000..381cfcb --- /dev/null +++ b/main/res/layout/sud_glif_embedded_template_card.xml @@ -0,0 +1,49 @@ +<?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. +--> + +<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_embedded_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_embedded_template_compact.xml b/main/res/layout/sud_glif_embedded_template_compact.xml new file mode 100644 index 0000000..952c012 --- /dev/null +++ b/main/res/layout/sud_glif_embedded_template_compact.xml @@ -0,0 +1,26 @@ +<?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. +--> + +<com.google.android.setupcompat.view.StatusBarBackgroundLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/suc_layout_status" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <include layout="@layout/sud_glif_embedded_template_content" /> + +</com.google.android.setupcompat.view.StatusBarBackgroundLayout> diff --git a/main/res/layout/sud_glif_embedded_template_content.xml b/main/res/layout/sud_glif_embedded_template_content.xml new file mode 100644 index 0000000..c535723 --- /dev/null +++ b/main/res/layout/sud_glif_embedded_template_content.xml @@ -0,0 +1,71 @@ +<?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. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + 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" /> + + <!-- Ignore UnusedAttribute: scrollIndicators is new in M. Default to no indicators in older + versions. --> + <com.google.android.setupdesign.view.BottomScrollView + android:id="@+id/sud_scroll_view" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:fillViewport="true" + android:scrollIndicators="?attr/sudScrollIndicators" + tools:ignore="UnusedAttribute"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <include layout="@layout/sud_glif_header" /> + + <ViewStub + android:id="@+id/sud_layout_illustration_progress_stub" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inflatedId="@+id/sud_layout_progress_illustration" + android:layout="@layout/sud_progress_illustration_layout" /> + + <FrameLayout + android:id="@+id/sud_layout_content" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" /> + + </LinearLayout> + + </com.google.android.setupdesign.view.BottomScrollView> + + <ViewStub + android:id="@+id/suc_layout_footer" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + +</LinearLayout> diff --git a/main/res/layout/sud_glif_list_embedded_template_card.xml b/main/res/layout/sud_glif_list_embedded_template_card.xml new file mode 100644 index 0000000..45e35b3 --- /dev/null +++ b/main/res/layout/sud_glif_list_embedded_template_card.xml @@ -0,0 +1,49 @@ +<?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. +--> + +<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_list_embedded_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_list_embedded_template_compact.xml b/main/res/layout/sud_glif_list_embedded_template_compact.xml new file mode 100644 index 0000000..a72a33b --- /dev/null +++ b/main/res/layout/sud_glif_list_embedded_template_compact.xml @@ -0,0 +1,26 @@ +<?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. +--> + +<com.google.android.setupcompat.view.StatusBarBackgroundLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/suc_layout_status" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <include layout="@layout/sud_glif_list_embedded_template_content" /> + +</com.google.android.setupcompat.view.StatusBarBackgroundLayout> diff --git a/main/res/layout/sud_glif_list_embedded_template_content.xml b/main/res/layout/sud_glif_list_embedded_template_content.xml new file mode 100644 index 0000000..4644c80 --- /dev/null +++ b/main/res/layout/sud_glif_list_embedded_template_content.xml @@ -0,0 +1,48 @@ +<?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. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + 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" /> + + <!-- Ignore UnusedAttribute: scrollIndicators is new in M. Default to no indicators in older + versions. --> + <com.google.android.setupdesign.view.StickyHeaderListView + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@android:id/list" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:scrollIndicators="?attr/sudScrollIndicators" + app:sudHeader="@layout/sud_glif_header" + tools:ignore="UnusedAttribute" /> + + <ViewStub + android:id="@+id/suc_layout_footer" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + +</LinearLayout> diff --git a/main/res/layout/sud_glif_recycler_embedded_template_card.xml b/main/res/layout/sud_glif_recycler_embedded_template_card.xml new file mode 100644 index 0000000..316abb2 --- /dev/null +++ b/main/res/layout/sud_glif_recycler_embedded_template_card.xml @@ -0,0 +1,49 @@ +<?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. +--> + +<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_recycler_embedded_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_recycler_embedded_template_compact.xml b/main/res/layout/sud_glif_recycler_embedded_template_compact.xml new file mode 100644 index 0000000..4280d05 --- /dev/null +++ b/main/res/layout/sud_glif_recycler_embedded_template_compact.xml @@ -0,0 +1,26 @@ +<?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. +--> + +<com.google.android.setupcompat.view.StatusBarBackgroundLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/suc_layout_status" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <include layout="@layout/sud_glif_recycler_embedded_template_content" /> + +</com.google.android.setupcompat.view.StatusBarBackgroundLayout> diff --git a/main/res/layout/sud_glif_recycler_embedded_template_content.xml b/main/res/layout/sud_glif_recycler_embedded_template_content.xml new file mode 100644 index 0000000..dafd3c8 --- /dev/null +++ b/main/res/layout/sud_glif_recycler_embedded_template_content.xml @@ -0,0 +1,49 @@ +<?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. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + 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" /> + + <!-- Ignore UnusedAttribute: scrollIndicators is new in M. Default to no indicators in older + versions. --> + <com.google.android.setupdesign.view.HeaderRecyclerView + android:id="@+id/sud_recycler_view" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:scrollbars="vertical" + android:scrollIndicators="?attr/sudScrollIndicators" + app:sudHeader="@layout/sud_glif_header" + tools:ignore="UnusedAttribute" /> + + <ViewStub + android:id="@+id/suc_layout_footer" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + +</LinearLayout> diff --git a/main/res/values-sw600dp-land-v33/config.xml b/main/res/values-sw600dp-land-v33/config.xml new file mode 100644 index 0000000..2d2238c --- /dev/null +++ b/main/res/values-sw600dp-land-v33/config.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2023 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> + <bool name="suc_footer_bar_button_align_end">true</bool> +</resources>
\ No newline at end of file diff --git a/main/res/values-sw600dp-land-v33/dimens.xml b/main/res/values-sw600dp-land-v33/dimens.xml new file mode 100644 index 0000000..d672ce6 --- /dev/null +++ b/main/res/values-sw600dp-land-v33/dimens.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2022 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + + <!-- General --> + <dimen name="sud_glif_land_middle_horizontal_spacing">76dp</dimen> + +</resources>
\ No newline at end of file diff --git a/main/res/values-sw600dp/layouts.xml b/main/res/values-sw600dp/layouts.xml index 3c27d25..41bc74e 100644 --- a/main/res/values-sw600dp/layouts.xml +++ b/main/res/values-sw600dp/layouts.xml @@ -25,7 +25,9 @@ <item name="sud_no_scroll_template_short" type="layout">@layout/sud_no_scroll_template_card</item> <item name="sud_glif_template" type="layout">@layout/sud_glif_template_card</item> + <item name="sud_glif_embedded_template" type="layout">@layout/sud_glif_embedded_template_card</item> <item name="sud_glif_list_template" type="layout">@layout/sud_glif_list_template_card</item> + <item name="sud_glif_list_embedded_template" type="layout">@layout/sud_glif_list_embedded_template_card</item> <item name="sud_glif_blank_template" type="layout">@layout/sud_glif_blank_template_card</item> <item name="sud_preference_recycler_view" type="layout">@layout/sud_preference_recycler_view_normal</item> @@ -34,7 +36,9 @@ <item name="sud_recycler_template_short" type="layout">@layout/sud_recycler_template_card</item> <item name="sud_glif_preference_template" type="layout">@layout/sud_glif_blank_template_card</item> + <item name="sud_glif_preference_embedded_template" type="layout">@layout/sud_glif_blank_embedded_template_card</item> <item name="sud_glif_recycler_template" type="layout">@layout/sud_glif_recycler_template_card</item> + <item name="sud_glif_recycler_embedded_template" type="layout">@layout/sud_glif_recycler_embedded_template_card</item> </resources> diff --git a/main/res/values-v31/colors.xml b/main/res/values-v31/colors.xml index 1ed67df..12b13eb 100644 --- a/main/res/values-v31/colors.xml +++ b/main/res/values-v31/colors.xml @@ -15,7 +15,8 @@ limitations under the License. --> -<resources> +<resources xmlns:tools="http://schemas.android.com/tools" + tools:keep="@color/sud_system_accent*,@color/sud_system_neutral*"> <!-- Default color for BC --> <color name="sud_color_accent_glif_v3_dark">#ff669df6</color> @@ -46,6 +47,19 @@ <color name="sud_system_accent2_100">@android:color/system_accent2_100</color> + <color name="sud_system_accent2_200">@android:color/system_accent2_200</color> + + <color name="sud_system_accent2_600">@android:color/system_accent2_600</color> + + + + <color name="sud_system_accent3_100">@android:color/system_accent3_100</color> + + <color name="sud_system_accent3_200">@android:color/system_accent3_200</color> + + <color name="sud_system_accent3_600">@android:color/system_accent3_600</color> + + <color name="sud_system_neutral1_0">@android:color/system_neutral1_0</color> diff --git a/main/res/values-v31/styles.xml b/main/res/values-v31/styles.xml index 5fab1c1..7216905 100644 --- a/main/res/values-v31/styles.xml +++ b/main/res/values-v31/styles.xml @@ -22,6 +22,7 @@ <item name="android:colorAccent">?attr/colorAccent</item> <item name="android:textColorLink">@color/sud_system_hyperlink_text</item> <item name="alertDialogTheme">@style/SudDynamicColorAlertDialogThemeCompat</item> + <item name="android:alertDialogTheme">@style/SudDynamicColorAlertDialogTheme</item> <item name="android:datePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme</item> <item name="android:timePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme</item> <item name="sucFullDynamicColor">false</item> @@ -37,6 +38,7 @@ <item name="android:colorAccent">?attr/colorAccent</item> <item name="android:textColorLink">@color/sud_system_hyperlink_text</item> <item name="alertDialogTheme">@style/SudDynamicColorAlertDialogThemeCompat.Light</item> + <item name="android:alertDialogTheme">@style/SudDynamicColorAlertDialogTheme.Light</item> <item name="android:datePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme.Light</item> <item name="android:timePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme.Light</item> <item name="sucFullDynamicColor">false</item> @@ -71,8 +73,11 @@ <item name="colorSwitchThumbNormal">@color/switch_thumb_material_dark</item> <item name="alertDialogTheme">@style/SudFullDynamicColorAlertDialogThemeCompat</item> + <item name="android:alertDialogTheme">@style/SudFullDynamicColorAlertDialogTheme</item> <item name="sucFullDynamicColor">true</item> + + <item name="android:windowAnimationStyle">@style/Animation.SudWindowAnimation.DynamicColor</item> </style> <style name="SudFullDynamicColorTheme.Light" parent="SudDynamicColorTheme.Light"> @@ -95,8 +100,11 @@ <item name="colorSwitchThumbNormal">@color/switch_thumb_material_light</item> <item name="alertDialogTheme">@style/SudFullDynamicColorAlertDialogThemeCompat.Light</item> + <item name="android:alertDialogTheme">@style/SudFullDynamicColorAlertDialogTheme.Light</item> <item name="sucFullDynamicColor">true</item> + + <item name="android:windowAnimationStyle">@style/Animation.SudWindowAnimation.DynamicColor</item> </style> <!-- Main theme for dynamic color --> @@ -188,6 +196,15 @@ <item name="android:windowTitleStyle">@style/SudMaterialYouWindowTitleStyle</item> </style> + <style name="SudDynamicColorAlertDialogTheme" parent="android:Theme.DeviceDefault.Dialog.Alert"> + <item name="android:textAllCaps">false</item> + <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"> <item name="android:textAllCaps">false</item> <item name="android:colorBackground">@color/sud_glif_v3_dialog_background_color_light</item> @@ -197,6 +214,16 @@ <item name="android:windowTitleStyle">@style/SudMaterialYouWindowTitleStyle</item> </style> + <style name="SudDynamicColorAlertDialogTheme.Light" parent="android:Theme.DeviceDefault.Light.Dialog.Alert"> + <item name="android:textAllCaps">false</item> + <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:layout_marginStart">@dimen/sud_glif_alert_dialog_footer_bar_padding_start</item> <item name="android:layout_marginLeft">@dimen/sud_glif_alert_dialog_footer_bar_padding_start</item> @@ -233,6 +260,14 @@ <item name="android:colorBackground">@color/sud_system_neutral1_50</item> </style> + <style name="SudFullDynamicColorAlertDialogTheme" parent="SudDynamicColorAlertDialogTheme"> + <item name="android:colorBackground">@color/sud_system_neutral1_900</item> + </style> + <style name="SudFullDynamicColorAlertDialogTheme.Light" parent="SudDynamicColorAlertDialogTheme.Light"> + <item name="android:colorBackground">@color/sud_system_neutral1_50</item> + </style> + + <!-- Dynamic color theme for date time dialog --> <style name="SudDynamicColorDateTimePickerDialogTheme" parent="SudDateTimePickerDialogTheme"> <item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_dark</item> diff --git a/main/res/values-v34/colors.xml b/main/res/values-v34/colors.xml new file mode 100644 index 0000000..9460e6e --- /dev/null +++ b/main/res/values-v34/colors.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2022 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <!-- Accent color --> + <color name="sud_dynamic_color_accent_glif_v3_dark">@color/sud_system_accent1_300</color> +</resources>
\ No newline at end of file diff --git a/main/res/values-v34/dimens.xml b/main/res/values-v34/dimens.xml new file mode 100644 index 0000000..84b245c --- /dev/null +++ b/main/res/values-v34/dimens.xml @@ -0,0 +1,22 @@ +<?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> + <dimen name="sud_glif_margin_start_material_you">24dp</dimen> + <dimen name="sud_glif_description_text_size_material_you">14sp</dimen> + <dimen name="sud_description_text_size">14sp</dimen> +</resources>
\ No newline at end of file diff --git a/main/res/values-v34/styles.xml b/main/res/values-v34/styles.xml new file mode 100644 index 0000000..24411e2 --- /dev/null +++ b/main/res/values-v34/styles.xml @@ -0,0 +1,32 @@ +<?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"> + <style name="Animation.SudWindowAnimation" parent="@android:style/Animation.Activity"> + <item name="android:activityOpenEnterAnimation">@anim/shared_x_axis_activity_open_enter</item> + <item name="android:activityOpenExitAnimation">@anim/shared_x_axis_activity_open_exit</item> + <item name="android:activityCloseEnterAnimation">@anim/shared_x_axis_activity_close_enter</item> + <item name="android:activityCloseExitAnimation">@anim/shared_x_axis_activity_close_exit</item> + </style> + + <style name="Animation.SudWindowAnimation.DynamicColor" parent="@android:style/Animation.Activity"> + <item name="android:activityOpenEnterAnimation">@anim/shared_x_axis_activity_open_enter_dynamic_color</item> + <item name="android:activityOpenExitAnimation">@anim/shared_x_axis_activity_open_exit</item> + <item name="android:activityCloseEnterAnimation">@anim/shared_x_axis_activity_close_enter_dynamic_color</item> + <item name="android:activityCloseExitAnimation">@anim/shared_x_axis_activity_close_exit</item> + </style> +</resources>
\ No newline at end of file diff --git a/main/res/values/colors.xml b/main/res/values/colors.xml index 75fd097..5cbcf07 100644 --- a/main/res/values/colors.xml +++ b/main/res/values/colors.xml @@ -15,7 +15,8 @@ limitations under the License. --> -<resources> +<resources xmlns:tools="http://schemas.android.com/tools" + tools:keep="@color/sud_system_accent*,@color/sud_system_neutral*"> <!-- General colors --> <color name="sud_color_accent_dark">#ff448aff</color> @@ -81,6 +82,19 @@ <color name="sud_system_accent2_100">#FFE8DEF8</color> + <color name="sud_system_accent2_200">#A4CFC7</color> + + <color name="sud_system_accent2_600">#3D665F</color> + + + + <color name="sud_system_accent3_100">#ECDBFF</color> + + <color name="sud_system_accent3_200">#CFBFEB</color> + + <color name="sud_system_accent3_600">#64587F</color> + + <color name="sud_system_neutral1_0">#ffffff</color> diff --git a/main/res/values/config.xml b/main/res/values/config.xml index de724a3..79a2779 100644 --- a/main/res/values/config.xml +++ b/main/res/values/config.xml @@ -23,6 +23,9 @@ <!-- Whether to use tablet layout --> <bool name="sudUseTabletLayout">false</bool> + <!-- Whether to make the footer button in footer bar align end --> + <bool name="suc_footer_bar_button_align_end">false</bool> + <!-- 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> diff --git a/main/res/values/dimens.xml b/main/res/values/dimens.xml index d3f0d02..8626945 100644 --- a/main/res/values/dimens.xml +++ b/main/res/values/dimens.xml @@ -167,7 +167,7 @@ <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_footer_button_text_size">14sp</dimen> <dimen name="sud_glif_primary_button_button_margin_start">0dp</dimen> <dimen name="sud_glif_secondary_button_button_margin_start">0dp</dimen> @@ -209,7 +209,7 @@ <!-- 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_footer_button_text_size_material_you">14sp</dimen> <dimen name="sud_glif_primary_button_button_margin_start_material_you">0dp</dimen> @@ -310,4 +310,11 @@ <!-- Set 0dp since we don't want shadow. --> <dimen name="sud_icon_uniformity_elevation">0dp</dimen> + <!-- Embedded Activity --> + <dimen name="sud_glif_footer_padding_start_embedded_activity">24dp</dimen> + <dimen name="sud_glif_footer_padding_end_embedded_activity">24dp</dimen> + <dimen name="sud_glif_margin_start_embedded_activity">24dp</dimen> + <dimen name="sud_glif_margin_end_embedded_activity">24dp</dimen> + <dimen name="sud_glif_header_title_margin_top_embedded_activity">24dp</dimen> + <dimen name="sud_header_title_size_embedded_activity">44sp</dimen> </resources> diff --git a/main/res/values/layouts.xml b/main/res/values/layouts.xml index 910965f..56f227d 100644 --- a/main/res/values/layouts.xml +++ b/main/res/values/layouts.xml @@ -35,8 +35,12 @@ <item name="sud_glif_template" type="layout">@layout/sud_glif_template_compact</item> + <item name="sud_glif_embedded_template" type="layout">@layout/sud_glif_embedded_template_compact</item> + <item name="sud_glif_list_template" type="layout">@layout/sud_glif_list_template_compact</item> + <item name="sud_glif_list_embedded_template" type="layout">@layout/sud_glif_list_embedded_template_compact</item> + <!-- Ignore UnusedResources: can be used by clients --> <item name="sud_glif_blank_template" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_blank_template_compact</item> @@ -51,5 +55,7 @@ <!-- Ignore UnusedResources: can be used by clients --> <item name="sud_glif_preference_template" type="layout">@layout/sud_glif_blank_template_compact</item> + <item name="sud_glif_preference_embedded_template" type="layout">@layout/sud_glif_blank_embedded_template_compact</item> <item name="sud_glif_recycler_template" type="layout">@layout/sud_glif_recycler_template_compact</item> + <item name="sud_glif_recycler_embedded_template" type="layout">@layout/sud_glif_recycler_embedded_template_compact</item> </resources> diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml index e3b3489..6fe9550 100644 --- a/main/res/values/styles.xml +++ b/main/res/values/styles.xml @@ -196,6 +196,7 @@ <item name="textAppearanceListItemSmall">@style/TextAppearance.SudGlifItemSummary</item> <item name="sucFooterBarButtonFontFamily">?attr/sudButtonFontFamily</item> <item name="sucFooterBarButtonCornerRadius">?attr/sudButtonCornerRadius</item> + <item name="sucFooterBarButtonAlignEnd">false</item> <item name="sucFooterBarButtonAllCaps">?attr/sudButtonAllCaps</item> <item name="sucFooterBarButtonColorControlHighlightRipple">?attr/colorAccent</item> <item name="sucFooterBarButtonHighlightAlpha">?attr/sudButtonHighlightAlpha</item> @@ -294,6 +295,7 @@ <item name="textAppearanceListItemSmall">@style/TextAppearance.SudGlifItemSummary</item> <item name="sucFooterBarButtonFontFamily">?attr/sudButtonFontFamily</item> <item name="sucFooterBarButtonCornerRadius">?attr/sudButtonCornerRadius</item> + <item name="sucFooterBarButtonAlignEnd">false</item> <item name="sucFooterBarButtonAllCaps">?attr/sudButtonAllCaps</item> <item name="sucFooterBarButtonColorControlHighlightRipple">?attr/colorAccent</item> <item name="sucFooterBarButtonHighlightAlpha">?attr/sudButtonHighlightAlpha</item> @@ -402,6 +404,7 @@ <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="sucFooterBarButtonAlignEnd">@bool/suc_footer_bar_button_align_end</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> @@ -433,6 +436,7 @@ <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="sucFooterBarButtonAlignEnd">@bool/suc_footer_bar_button_align_end</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> diff --git a/main/src/com/google/android/setupdesign/GlifLayout.java b/main/src/com/google/android/setupdesign/GlifLayout.java index 3f0d243..61d8329 100644 --- a/main/src/com/google/android/setupdesign/GlifLayout.java +++ b/main/src/com/google/android/setupdesign/GlifLayout.java @@ -37,6 +37,7 @@ import androidx.annotation.LayoutRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StringRes; +import androidx.window.embedding.ActivityEmbeddingController; import com.google.android.setupcompat.PartnerCustomizationLayout; import com.google.android.setupcompat.partnerconfig.PartnerConfig; import com.google.android.setupcompat.partnerconfig.PartnerConfigHelper; @@ -285,7 +286,12 @@ public class GlifLayout extends PartnerCustomizationLayout { protected View onInflateTemplate(LayoutInflater inflater, @LayoutRes int template) { if (template == 0) { template = R.layout.sud_glif_template; + // if the activity is embedded should apply an embedded layout. + if (isEmbeddedActivityOnePaneEnabled(getContext())) { + template = R.layout.sud_glif_embedded_template; + } } + return inflateTemplate(inflater, R.style.SudThemeGlif_Light, template); } @@ -440,7 +446,7 @@ public class GlifLayout extends PartnerCustomizationLayout { updateBackground(); } - /** @return True if this view uses {@link GlifPatternDrawable} as background. */ + /** Returns true if this view uses {@link GlifPatternDrawable} as background. */ public boolean isBackgroundPatterned() { return backgroundPatterned; } @@ -484,6 +490,13 @@ public class GlifLayout extends PartnerCustomizationLayout { && PartnerConfigHelper.shouldApplyExtendedPartnerConfig(getContext())); } + /** Check if the one pane layout is enabled in embedded activity */ + protected boolean isEmbeddedActivityOnePaneEnabled(Context context) { + return PartnerConfigHelper.isEmbeddedActivityOnePaneEnabled(context) + && ActivityEmbeddingController.getInstance(context) + .isActivityEmbedded(PartnerCustomizationLayout.lookupActivityFromContext(context)); + } + /** Updates the background color of this layout with the partner-customizable background color. */ private void updateContentBackgroundColorWithPartnerConfig() { // If full dynamic color enabled which means this activity is running outside of setup diff --git a/main/src/com/google/android/setupdesign/GlifListLayout.java b/main/src/com/google/android/setupdesign/GlifListLayout.java index 89d0888..79b905c 100644 --- a/main/src/com/google/android/setupdesign/GlifListLayout.java +++ b/main/src/com/google/android/setupdesign/GlifListLayout.java @@ -91,6 +91,10 @@ public class GlifListLayout extends GlifLayout { protected View onInflateTemplate(LayoutInflater inflater, int template) { if (template == 0) { template = R.layout.sud_glif_list_template; + // if the activity is embedded should apply an embedded layout. + if (isEmbeddedActivityOnePaneEnabled(getContext())) { + template = R.layout.sud_glif_list_embedded_template; + } } return super.onInflateTemplate(inflater, template); } diff --git a/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java b/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java index f235442..fb10515 100644 --- a/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java +++ b/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java @@ -99,6 +99,10 @@ public class GlifPreferenceLayout extends GlifRecyclerLayout { protected View onInflateTemplate(LayoutInflater inflater, int template) { if (template == 0) { template = R.layout.sud_glif_preference_template; + // if the activity is embedded should apply an embedded layout. + if (isEmbeddedActivityOnePaneEnabled(getContext())) { + template = R.layout.sud_glif_preference_embedded_template; + } } return super.onInflateTemplate(inflater, template); } diff --git a/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java b/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java index 87f871c..484ad50 100644 --- a/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java +++ b/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java @@ -92,6 +92,10 @@ public class GlifRecyclerLayout extends GlifLayout { protected View onInflateTemplate(LayoutInflater inflater, int template) { if (template == 0) { template = R.layout.sud_glif_recycler_template; + // if the activity is embedded should apply an embedded layout. + if (isEmbeddedActivityOnePaneEnabled(getContext())) { + template = R.layout.sud_glif_recycler_embedded_template; + } } return super.onInflateTemplate(inflater, template); } diff --git a/main/src/com/google/android/setupdesign/transition/TransitionHelper.java b/main/src/com/google/android/setupdesign/transition/TransitionHelper.java index ec2c480..5dd5f3d 100644 --- a/main/src/com/google/android/setupdesign/transition/TransitionHelper.java +++ b/main/src/com/google/android/setupdesign/transition/TransitionHelper.java @@ -127,6 +127,9 @@ public class TransitionHelper { // TODO: Add new partner resource to determine which transition type would be apply. public static final int TRANSITION_CAPTIVE = 5; + /** Override the transition to a fade-through-from-right (or from-left for RTL locales). */ + public static final int TRANSITION_FADE_THROUGH = 6; + /** * No override. If this is specified as the transition, the enter/exit transition of the window * will not be set and keep original behavior. @@ -154,11 +157,17 @@ public class TransitionHelper { private TransitionHelper() {} /** - * Apply the transition for going forward which is decided by partner resource {@link - * PartnerConfig#CONFIG_TRANSITION_TYPE} and system property {@code setupwizard.transition_type}. - * The default transition that will be applied is {@link #TRANSITION_SLIDE}. The timing to apply - * the transition is going forward from the previous activity to this, or going forward from this - * activity to the next. + * Apply the transition for going forward which is decided by {@code Animation.SudWindowAnimation} + * theme if the API level is equal or higher than {@link android.os.Build.VERSION_CODES#U}. + * + * <p>Otherwise, apply the transition for going forward which is decided by partner resource + * {@link PartnerConfig#CONFIG_TRANSITION_TYPE} and system property {@code + * setupwizard.transition_type} if the API level is equal or lower than {@link + * android.os.Build.VERSION_CODES#T}. The default transition that will be applied is {@link + * #TRANSITION_SLIDE}. + * + * <p>The timing to apply the transition is going forward from the previous activity to this, or + * going forward from this activity to the next. * * <p>For example, in the flow below, the forward transitions will be applied to all arrows * pointing to the right. Previous screen --> This screen --> Next screen @@ -199,15 +208,63 @@ public class TransitionHelper { } /** - * Apply the transition for going forward. This is applied when going forward from the previous - * activity to this, or going forward from this activity to the next. + * Apply the transition for going forward which is decided by {@code Animation.SudWindowAnimation} + * theme if the API level is equal or higher than {@link android.os.Build.VERSION_CODES#U}. + * + * <p>Otherwise, apply the transition for going forward which is decided by the argument {@code + * transitionId} if the API level is equal or lower than {@link android.os.Build.VERSION_CODES#T}. + * + * <p>The timing to apply the transition is going forward from the previous activity to this, or + * going forward from this activity to the next. + */ + @TargetApi(VERSION_CODES.LOLLIPOP) + public static void applyForwardTransition(Activity activity, @TransitionType int transitionId) { + applyForwardTransition(activity, transitionId, /* useClientTransitionSettings= */ false); + } + + /** + * Apply the transition for going forward which is decided by {@code Animation.SudWindowAnimation} + * theme if the API level is equal or higher than {@link android.os.Build.VERSION_CODES#U}, and + * argument {@code useClientTransitionSettings} is false, and System property {@code + * suw_apply_glif_theme_controlled_transition} is true, and {@code TRANSITION_FADE_THOUGH} + * transition is not specified. + * + * <p>Otherwise, apply the transition for going forward which is decided by the argument {@code + * transitionId}, {@code shared_x_axis_activity} transition is used only when {@code + * TRANSITION_FADE_TROUGH} transition is specified, and System property {@code * + * suw_apply_glif_theme_controlled_transition} is true, and the API level is equal or more than + * {@link android.os.Build.VERSION_CODES#U}, other {@code transitionId} can be specified if the + * API level is equal or lower than {@link android.os.Build.VERSION_CODES#T}, or argument {@code + * useClientTransitionSettings} is true, or System property {@code + * suw_apply_glif_theme_controlled_transition} is false. The default transition that will be + * applied is {@link #TRANSITION_SLIDE}. + * + * <p>The timing to apply the transition is going forward from the previous activity to this, or + * going forward from this activity to the next. * * <p>For example, in the flow below, the forward transitions will be applied to all arrows * pointing to the right. Previous screen --> This screen --> Next screen */ @TargetApi(VERSION_CODES.LOLLIPOP) - public static void applyForwardTransition(Activity activity, @TransitionType int transitionId) { - if (transitionId == TRANSITION_SLIDE) { + public static void applyForwardTransition( + Activity activity, @TransitionType int transitionId, boolean useClientTransitionSettings) { + if (BuildCompatUtils.isAtLeastU() + && !useClientTransitionSettings + && PartnerConfigHelper.isGlifThemeControlledTransitionApplied(activity) + && transitionId != TRANSITION_FADE_THROUGH) { + // Do nothing + } else if (BuildCompatUtils.isAtLeastU() && transitionId == TRANSITION_FADE_THROUGH) { + int openEnterTransition = R.anim.shared_x_axis_activity_open_enter; + if (PartnerConfigHelper.isGlifThemeControlledTransitionApplied(activity)) { + if (ThemeHelper.shouldApplyDynamicColor(activity)) { + openEnterTransition = R.anim.shared_x_axis_activity_open_enter_dynamic_color; + } + activity.overridePendingTransition( + openEnterTransition, R.anim.shared_x_axis_activity_open_exit); + } else { + activity.overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out); + } + } else if (transitionId == TRANSITION_SLIDE) { activity.overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out); } else if (transitionId == TRANSITION_FADE) { activity.overridePendingTransition(android.R.anim.fade_in, R.anim.sud_stay); @@ -256,14 +313,21 @@ public class TransitionHelper { } /** - * Apply the transition for going backward which is decided by partner resource {@link - * PartnerConfig#CONFIG_TRANSITION_TYPE} and system property {@code setupwizard.transition_type}. - * The default transition that will be applied is {@link #TRANSITION_SLIDE}. The timing to apply - * the transition is going backward from the next activity to this, or going backward from this - * activity to the previous. + * Apply the transition for going backward which is decided by {@code + * Animation.SudWindowAnimation} theme if the API level is equal or higher than {@link + * android.os.Build.VERSION_CODES#U}. + * + * <p>Otherwise, apply the transition for going backward which is decided by partner resource + * {@link PartnerConfig#CONFIG_TRANSITION_TYPE} and system property {@code + * setupwizard.transition_type} if the API level is equal or lower than {@link + * android.os.Build.VERSION_CODES#T}. The default transition that will be applied is {@link + * #TRANSITION_SLIDE}. + * + * <p>The timing to apply the transition is going backward from the next activity to this, or + * going backward from this activity to the previous. * * <p>For example, in the flow below, the backward transitions will be applied to all arrows - * pointing to the left. Previous screen <-- This screen <-- Next screen + * pointing to the left. Previous screen <-- This screen <-- Next screen. */ @TargetApi(VERSION_CODES.LOLLIPOP) public static void applyBackwardTransition(Activity activity) { @@ -301,15 +365,64 @@ public class TransitionHelper { } /** - * Apply the transition for going backward. This is applied when going backward from the next - * activity to this, or going backward from this activity to the previous. + * Apply the transition for going backward which is decided by {@code + * Animation.SudWindowAnimation} theme if the API level is equal or higher than {@link + * android.os.Build.VERSION_CODES#U}. + * + * <p>Otherwise, apply the transition for going backward which is decided by the argument {@code + * transitionId} if the API level is equal or lower than {@link android.os.Build.VERSION_CODES#T}. + * + * <p>The timing to apply the transition is going backward from the next activity to this, or + * going backward from this activity to the previous. + */ + @TargetApi(VERSION_CODES.LOLLIPOP) + public static void applyBackwardTransition(Activity activity, @TransitionType int transitionId) { + applyBackwardTransition(activity, transitionId, /* useClientTransitionSettings= */ false); + } + + /** + * Apply the transition for going backward which is decided by {@code + * Animation.SudWindowAnimation} theme if the API level is equal or higher than {@link + * android.os.Build.VERSION_CODES#U}, and argument {@code useClientTransitionSettings} is false, + * and System property {@code suw_apply_glif_theme_controlled_transition} is true, and {@code + * TRANSITION_FADE_THOUGH} transition is not specified. + * + * <p>Otherwise, apply the transition for going backward which is decided by the argument {@code + * transitionId}, {@code shared_x_axis_activity} transition is used only when {@code + * TRANSITION_FADE_TROUGH} transition is specified, and System property {@code * + * suw_apply_glif_theme_controlled_transition} is true, and the API level is equal or more than + * {@link android.os.Build.VERSION_CODES#U}, other {@code transitionId} can be specified if the + * API level is equal or lower than {@link android.os.Build.VERSION_CODES#T}, or argument {@code + * useClientTransitionSettings} is true, or System property {@code + * suw_apply_glif_theme_controlled_transition} is false. The default transition that will be + * applied is {@link #TRANSITION_SLIDE}. + * + * <p>The timing to apply the transition is going backward from the next activity to this, or + * going backward from this activity to the previous. * * <p>For example, in the flow below, the backward transitions will be applied to all arrows * pointing to the left. Previous screen <-- This screen <-- Next screen */ @TargetApi(VERSION_CODES.LOLLIPOP) - public static void applyBackwardTransition(Activity activity, @TransitionType int transitionId) { - if (transitionId == TRANSITION_SLIDE) { + public static void applyBackwardTransition( + Activity activity, @TransitionType int transitionId, boolean useClientTransitionSettings) { + if (BuildCompatUtils.isAtLeastU() + && !useClientTransitionSettings + && PartnerConfigHelper.isGlifThemeControlledTransitionApplied(activity) + && transitionId != TRANSITION_FADE_THROUGH) { + // Do nothing + } else if (BuildCompatUtils.isAtLeastU() && transitionId == TRANSITION_FADE_THROUGH) { + if (PartnerConfigHelper.isGlifThemeControlledTransitionApplied(activity)) { + int closeEnterTransition = R.anim.shared_x_axis_activity_close_enter; + if (ThemeHelper.shouldApplyDynamicColor(activity)) { + closeEnterTransition = R.anim.shared_x_axis_activity_close_enter_dynamic_color; + } + activity.overridePendingTransition( + closeEnterTransition, R.anim.shared_x_axis_activity_close_exit); + } else { + activity.overridePendingTransition(R.anim.sud_slide_back_in, R.anim.sud_slide_back_out); + } + } else if (transitionId == TRANSITION_SLIDE) { activity.overridePendingTransition(R.anim.sud_slide_back_in, R.anim.sud_slide_back_out); } else if (transitionId == TRANSITION_FADE) { activity.overridePendingTransition(R.anim.sud_stay, android.R.anim.fade_out); @@ -352,8 +465,8 @@ public class TransitionHelper { } else { Log.w(TAG, "This API is supported from Android Sdk " + VERSION_CODES.LOLLIPOP); } + // For TRANSITION_NO_OVERRIDE or other values, do not override the transition } - // For TRANSITION_NO_OVERRIDE or other values, do not override the transition } /** diff --git a/main/src/com/google/android/setupdesign/util/Partner.java b/main/src/com/google/android/setupdesign/util/Partner.java index 2052afb..ce0c0d2 100644 --- a/main/src/com/google/android/setupdesign/util/Partner.java +++ b/main/src/com/google/android/setupdesign/util/Partner.java @@ -36,9 +36,11 @@ import androidx.annotation.ColorRes; import androidx.annotation.DimenRes; import androidx.annotation.DrawableRes; import androidx.annotation.Nullable; +import androidx.annotation.RawRes; import androidx.annotation.RequiresApi; import androidx.annotation.StringRes; import androidx.annotation.VisibleForTesting; +import java.io.InputStream; import java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -183,6 +185,17 @@ public class Partner { return new ResourceEntry(context.getPackageName(), context.getResources(), id, false); } + /** + * Returns input stream for raw resources from overlay package provided by partners. + * + * @return an InputStream in the partner overlay's resources, if one is defined. Otherwise the + * InputStream in resources from the original context is returned. + */ + public static InputStream getRawResources(Context context, @RawRes int id) { + final ResourceEntry entry = getResourceEntry(context, id); + return entry.resources.openRawResource(entry.id); + } + public static class ResourceEntry { public String packageName; public Resources resources; diff --git a/main/src/com/google/android/setupdesign/util/ThemeHelper.java b/main/src/com/google/android/setupdesign/util/ThemeHelper.java index 57a8278..4c349e4 100644 --- a/main/src/com/google/android/setupdesign/util/ThemeHelper.java +++ b/main/src/com/google/android/setupdesign/util/ThemeHelper.java @@ -201,7 +201,7 @@ public final class ThemeHelper { boolean isSetupFlow = WizardManagerHelper.isAnySetupWizard(activity.getIntent()); boolean isDayNightEnabled = isSetupWizardDayNightEnabled(context); - if (isSetupFlow) { + if (isSetupFlow && !BuildCompatUtils.isAtLeastU()) { // return theme for inside setup flow resId = isDayNightEnabled |