summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPihuei Wang <pihuei@google.com>2023-03-21 01:47:00 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-03-21 01:47:00 +0000
commitf3721dabf7e5e8353bbdccdfe407e57db3dee3d4 (patch)
tree12c39afe8adc8077a36cfb45f950c690d126ad76
parent19fd46b2c6d3ca533d18f5ad00e19206cfebf328 (diff)
parent548fa71c7fa0970735f1746cff0f282f9a642815 (diff)
downloadsetupdesign-f3721dabf7e5e8353bbdccdfe407e57db3dee3d4.tar.gz
Merge "Import updated Android Setupdesign Library 515501800" into udc-dev
-rw-r--r--lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java8
-rw-r--r--main/src/com/google/android/setupdesign/transition/TransitionHelper.java59
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) {