Removing Launcher activity dependency on various animations

(This cl reverts change-Id: I455edcd17bda83ab51c2c04fa40e66097a4d6975)

Various animations were marked for cancellation when launcher activity is
destroyed. This this does not work with multiple activities (Launcher,
fallback recents, shortcut confirmation). Also since launcher activity
handles configuration changes, the activity is not destroyed often.

Instead associating a target with various animations which automatically
cancels the animations when that target goes away.

Change-Id: I64cd095a28075561a9e20c9dcdeb9f90c18e1047
This commit is contained in:
Sunny Goyal
2018-08-08 16:33:46 -07:00
parent 52b28f0926
commit 849c6a2b18
15 changed files with 149 additions and 257 deletions

View File

@@ -433,22 +433,18 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
}
requestLayout();
} else {
PropertyValuesHolder width = PropertyValuesHolder.ofInt("width", lp.width, newWidth);
PropertyValuesHolder height = PropertyValuesHolder.ofInt("height", lp.height,
newHeight);
PropertyValuesHolder x = PropertyValuesHolder.ofInt("x", lp.x, newX);
PropertyValuesHolder y = PropertyValuesHolder.ofInt("y", lp.y, newY);
ObjectAnimator oa =
LauncherAnimUtils.ofPropertyValuesHolder(lp, this, width, height, x, y);
oa.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
requestLayout();
}
});
AnimatorSet set = LauncherAnimUtils.createAnimatorSet();
ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(lp, this,
PropertyValuesHolder.ofInt("width", lp.width, newWidth),
PropertyValuesHolder.ofInt("height", lp.height, newHeight),
PropertyValuesHolder.ofInt("x", lp.x, newX),
PropertyValuesHolder.ofInt("y", lp.y, newY));
oa.addUpdateListener(a -> requestLayout());
AnimatorSet set = new AnimatorSet();
set.play(oa);
for (int i = 0; i < HANDLE_COUNT; i++) {
set.play(LauncherAnimUtils.ofFloat(mDragHandles[i], ALPHA, 1.0f));
set.play(LauncherAnimUtils.ofPropertyValuesHolder(mDragHandles[i],
PropertyValuesHolder.ofFloat(ALPHA, 1f)));
}
set.setDuration(SNAP_DURATION);