Animate recent app icon in after activity transition
This prevents the icon from being eclipsed by the drag view
as it scales down.
Change-Id: I6d06414bf58ddbc95e51827358e8845897ee554d
diff --git a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
index 75db45b..965696f 100644
--- a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
+++ b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
@@ -320,5 +320,9 @@
private void onAnimationToLauncherComplete() {
mDragView.close(false);
+ View currentRecentsPage = mRecentsView.getPageAt(mRecentsView.getCurrentPage());
+ if (currentRecentsPage instanceof TaskView) {
+ ((TaskView) currentRecentsPage).animateIconToScale(1f);
+ }
}
}
diff --git a/quickstep/src/com/android/quickstep/RecentsView.java b/quickstep/src/com/android/quickstep/RecentsView.java
index a107343..fd9010d 100644
--- a/quickstep/src/com/android/quickstep/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/RecentsView.java
@@ -146,6 +146,9 @@
public void update(RecentsTaskLoadPlan loadPlan) {
final RecentsTaskLoader loader = TouchInteractionService.getRecentsTaskLoader();
setCurrentPage(0);
+ if (getPageAt(mCurrentPage) instanceof TaskView) {
+ ((TaskView) getPageAt(mCurrentPage)).setIconScale(0);
+ }
TaskStack stack = loadPlan != null ? loadPlan.getTaskStack() : null;
if (stack == null) {
removeAllViews();
diff --git a/quickstep/src/com/android/quickstep/TaskView.java b/quickstep/src/com/android/quickstep/TaskView.java
index a0ad618..d834881 100644
--- a/quickstep/src/com/android/quickstep/TaskView.java
+++ b/quickstep/src/com/android/quickstep/TaskView.java
@@ -59,6 +59,8 @@
*/
private static final float SWIPE_DISTANCE_HEIGHT_PERCENTAGE = 0.38f;
+ private static final long SCALE_ICON_DURATION = 120;
+
private static final Property<TaskView, Float> PROPERTY_SWIPE_PROGRESS =
new Property<TaskView, Float>(Float.class, "swipe_progress") {
@@ -73,6 +75,19 @@
}
};
+ private static final Property<TaskView, Float> SCALE_ICON_PROPERTY =
+ new Property<TaskView, Float>(Float.TYPE, "scale_icon") {
+ @Override
+ public Float get(TaskView taskView) {
+ return taskView.mIconScale;
+ }
+
+ @Override
+ public void set(TaskView taskView, Float iconScale) {
+ taskView.setIconScale(iconScale);
+ }
+ };
+
private Task mTask;
private TaskThumbnailView mSnapshotView;
private ImageView mIconView;
@@ -81,6 +96,7 @@
private float mSwipeProgress;
private Interpolator mAlphaInterpolator;
private Interpolator mSwipeAnimInterpolator;
+ private float mIconScale = 1f;
public TaskView(Context context) {
this(context, null);
@@ -259,4 +275,17 @@
swipeAnimator.setInterpolator(mSwipeAnimInterpolator);
swipeAnimator.start();
}
+
+ public void animateIconToScale(float scale) {
+ ObjectAnimator.ofFloat(this, SCALE_ICON_PROPERTY, scale)
+ .setDuration(SCALE_ICON_DURATION).start();
+ }
+
+ protected void setIconScale(float iconScale) {
+ mIconScale = iconScale;
+ if (mIconView != null) {
+ mIconView.setScaleX(mIconScale);
+ mIconView.setScaleY(mIconScale);
+ }
+ }
}