diff options
author | Pihuei Wang <pihuei@google.com> | 2023-03-21 03:16:44 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-03-21 03:16:44 +0000 |
commit | fcee329ce19bbd257d3013529e8e2fe2cb03803f (patch) | |
tree | 12c39afe8adc8077a36cfb45f950c690d126ad76 | |
parent | b74df68b41658104f1755ef82a7a752e7f819923 (diff) | |
parent | 8cd49bc14840ddaad98d8a7bc3d14934675b6541 (diff) | |
download | setupdesign-fcee329ce19bbd257d3013529e8e2fe2cb03803f.tar.gz |
Merge "Import updated Android Setupdesign Library 515501800" into udc-dev am: f3721dabf7 am: 8cd49bc148
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/setupdesign/+/21943005
Change-Id: I82e0be831e007cb4d86dbd8f855e8a3bb135534d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java | 8 | ||||
-rw-r--r-- | main/src/com/google/android/setupdesign/transition/TransitionHelper.java | 59 |
2 files changed, 52 insertions, 15 deletions
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 458cb90..d4e1961 100644 --- a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java +++ b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java @@ -28,6 +28,7 @@ import android.content.res.Configuration; import android.content.res.TypedArray; 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; @@ -37,6 +38,7 @@ 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; @@ -705,14 +707,12 @@ public class GlifLoadingLayout extends GlifLayout { @Override protected void onDetachedFromWindow() { - if (BuildCompatUtils.isAtLeastU()) { + if (VERSION.SDK_INT >= Build.VERSION_CODES.Q) { PersistableBundle bundle = new PersistableBundle(); bundle.putString(GLIF_LAYOUT_TYPE, LOADING_LAYOUT); setLayoutTypeMetrics(bundle); - } else { - setLayoutTypeMetrics(null); + super.onDetachedFromWindow(); } - super.onDetachedFromWindow(); } /** The progress config used to maps to different animation */ diff --git a/main/src/com/google/android/setupdesign/transition/TransitionHelper.java b/main/src/com/google/android/setupdesign/transition/TransitionHelper.java index 773c4af..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. @@ -221,13 +224,18 @@ public class TransitionHelper { /** * 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}, or - * argument {@code useClientTransitionSettings} is false, or System property {@code - * suw_apply_glif_theme_controlled_transition} is true. + * 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} 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 + * 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}. * @@ -242,8 +250,20 @@ public class TransitionHelper { Activity activity, @TransitionType int transitionId, boolean useClientTransitionSettings) { if (BuildCompatUtils.isAtLeastU() && !useClientTransitionSettings - && PartnerConfigHelper.isGlifThemeControlledTransitionApplied(activity)) { + && 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) { @@ -363,12 +383,17 @@ public class TransitionHelper { /** * 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}, or argument {@code useClientTransitionSettings} is false, or - * System property {@code suw_apply_glif_theme_controlled_transition} is true. + * 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} 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 + * 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}. * @@ -383,8 +408,20 @@ public class TransitionHelper { Activity activity, @TransitionType int transitionId, boolean useClientTransitionSettings) { if (BuildCompatUtils.isAtLeastU() && !useClientTransitionSettings - && PartnerConfigHelper.isGlifThemeControlledTransitionApplied(activity)) { + && 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) { |