diff --git a/quickstep/res/layout/activity_allset.xml b/quickstep/res/layout/activity_allset.xml index 625d9b361d..3d68dfb93a 100644 --- a/quickstep/res/layout/activity_allset.xml +++ b/quickstep/res/layout/activity_allset.xml @@ -29,7 +29,6 @@ android:layout_height="match_parent" android:gravity="center" android:scaleType="centerCrop" - app:lottie_autoPlay="true" app:lottie_loop="true" app:layout_constraintTop_toTopOf="parent" @@ -49,11 +48,10 @@ app:layout_constraintEnd_toEndOf="parent"> - 48dp + 48dp 48dp diff --git a/quickstep/res/values-sw600dp/dimens.xml b/quickstep/res/values-sw600dp/dimens.xml index 49965822ea..3e726519ac 100644 --- a/quickstep/res/values-sw600dp/dimens.xml +++ b/quickstep/res/values-sw600dp/dimens.xml @@ -37,7 +37,7 @@ 24dp - 120dp + 120dp 38sp 15sp diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 05f0695b7c..52ebdae31c 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -277,7 +277,7 @@ 24dp - 40dp + 40dp 36sp 14sp diff --git a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java index 953b0c56b4..c1bb2501b6 100644 --- a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java +++ b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java @@ -64,6 +64,7 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; +import com.android.launcher3.RemoveAnimationSettingsTracker; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatedFloat; import com.android.launcher3.anim.AnimatorPlaybackController; @@ -107,6 +108,9 @@ public class AllSetActivity extends Activity { private static final float ANIMATION_PAUSE_ALPHA_THRESHOLD = 0.1f; + private static final String KEY_BACKGROUND_ANIMATION_TOGGLED_ON = + "background_animation_toggled_on"; + private final AnimatedFloat mSwipeProgress = new AnimatedFloat(this::onSwipeProgressUpdate); private final InvariantDeviceProfile.OnIDPChangeListener mOnIDPChangeListener = @@ -124,6 +128,9 @@ public class AllSetActivity extends Activity { private AnimatorPlaybackController mLauncherStartAnim = null; + // Auto play background animation by default + private boolean mBackgroundAnimationToggledOn = true; + private TextView mHintView; private final OverviewChangeListener mOverviewChangeListener = this::onOverviewTargetChange; @@ -200,6 +207,15 @@ public class AllSetActivity extends Activity { LOTTIE_TERTIARY_COLOR_TOKEN, R.color.all_set_bg_tertiary), getTheme()); + mBackgroundAnimationToggledOn = savedInstanceState == null + || savedInstanceState.getBoolean(KEY_BACKGROUND_ANIMATION_TOGGLED_ON, true); + // The animated background is behind a scroll view, which intercepts all input. + // However, the content view also covers the full screen + requireViewById(R.id.content).setOnClickListener(v -> { + mBackgroundAnimationToggledOn = !mBackgroundAnimationToggledOn; + maybeResumeOrPauseBackgroundAnimation(); + }); + setUpBackgroundAnimation(getDP().isTablet); getIDP().addOnChangeListener(mOnIDPChangeListener); @@ -208,6 +224,12 @@ public class AllSetActivity extends Activity { ActivityPreloadUtil.preloadOverviewForSUWAllSet(this); } + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putBoolean(KEY_BACKGROUND_ANIMATION_TOGGLED_ON, mBackgroundAnimationToggledOn); + } + private InvariantDeviceProfile getIDP() { return LauncherAppState.getInstance(this).getInvariantDeviceProfile(); } @@ -368,8 +390,10 @@ public class AllSetActivity extends Activity { private void maybeResumeOrPauseBackgroundAnimation() { boolean shouldPlayAnimation = - getContentViewAlphaForSwipeProgress() > ANIMATION_PAUSE_ALPHA_THRESHOLD - && isResumed(); + !RemoveAnimationSettingsTracker.INSTANCE.get(this).isRemoveAnimationEnabled() + && getContentViewAlphaForSwipeProgress() > ANIMATION_PAUSE_ALPHA_THRESHOLD + && isResumed() + && mBackgroundAnimationToggledOn; if (mAnimatedBackground.isAnimating() && !shouldPlayAnimation) { mAnimatedBackground.pauseAnimation(); } else if (!mAnimatedBackground.isAnimating() && shouldPlayAnimation) {