From 47bf322e219d9fc86cd482fee6aa2efc0f4bfc71 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Mon, 30 Oct 2023 12:15:22 -0700 Subject: [PATCH] Animate aways Notification Dots for Taskbar Pinning Annimation Test: Manual Bug: 308460959 Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED Change-Id: Ic16881c05c70ed717dc63131d94ece805c39f6fc --- .../launcher3/taskbar/TaskbarPinningController.kt | 1 + .../launcher3/taskbar/TaskbarViewController.java | 12 ++++++++++++ src/com/android/launcher3/BubbleTextView.java | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt index d1bed3e714..20d63432a1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt @@ -85,6 +85,7 @@ class TaskbarPinningController(private val context: TaskbarActivityContext) : animatorSet.doOnEnd { recreateTaskbarAndUpdatePinningValue() } animatorSet.duration = PINNING_ANIMATION_DURATION updateIsAnimatingTaskbarPinningAndNotifyTaskbarDragLayer(true) + taskbarViewController.animateAwayNotificationDotsDuringTaskbarPinningAnimation() animatorSet.start() } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 0780cf8747..c54288c500 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -52,6 +52,7 @@ import androidx.core.graphics.ColorUtils; import androidx.core.view.OneShotPreDrawListener; import com.android.app.animation.Interpolators; +import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; @@ -338,6 +339,17 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar } } + /** + * Animate away taskbar icon notification dots during the taskbar pinning animation. + */ + public void animateAwayNotificationDotsDuringTaskbarPinningAnimation() { + for (View iconView : mTaskbarView.getIconViews()) { + if (iconView instanceof BubbleTextView && ((BubbleTextView) iconView).hasDot()) { + ((BubbleTextView) iconView).animateDotScale(0); + } + } + } + private void updateTaskbarIconTranslationXForPinning() { View[] iconViews = mTaskbarView.getIconViews(); float scale = mTaskbarIconTranslationXForPinning.value; diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index ddcb1e629c..e2e528c968 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -294,7 +294,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, } } - private void animateDotScale(float... dotScales) { + public void animateDotScale(float... dotScales) { cancelDotScaleAnim(); mDotScaleAnim = ObjectAnimator.ofFloat(this, DOT_SCALE_PROPERTY, dotScales); mDotScaleAnim.addListener(new AnimatorListenerAdapter() { @@ -646,7 +646,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, return mForceHideDot; } - private boolean hasDot() { + public boolean hasDot() { return mDotInfo != null; }