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 committed 2018-08-10 13:31:46 -07:00
1 parent 52b28f0926
commit 849c6a2b18
15 files changed
+149 -257

No files matched your search

@@ -37,7 +37,6 @@ import android.view.View;
import com.android.launcher3.CellLayout;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.R;
import com.android.launcher3.util.Themes;
@@ -368,7 +367,7 @@ public class PreviewBackground {
mScaleAnimator.cancel();
}
mScaleAnimator = LauncherAnimUtils.ofFloat(0f, 1.0f);
mScaleAnimator = ValueAnimator.ofFloat(0f, 1.0f);
mScaleAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
@@ -400,37 +399,19 @@ public class PreviewBackground {
mScaleAnimator.start();
}
public void animateToAccept(final CellLayout cl, final int cellX, final int cellY) {
Runnable onStart = new Runnable() {
@Override
public void run() {
delegateDrawing(cl, cellX, cellY);
}
};
animateScale(ACCEPT_SCALE_FACTOR, ACCEPT_COLOR_MULTIPLIER, onStart, null);
public void animateToAccept(CellLayout cl, int cellX, int cellY) {
animateScale(ACCEPT_SCALE_FACTOR, ACCEPT_COLOR_MULTIPLIER,
() -> delegateDrawing(cl, cellX, cellY), null);
}
public void animateToRest() {
// This can be called multiple times -- we need to make sure the drawing delegate
// is saved and restored at the beginning of the animation, since cancelling the
// existing animation can clear the delgate.
final CellLayout cl = mDrawingDelegate;
final int cellX = delegateCellX;
final int cellY = delegateCellY;
Runnable onStart = new Runnable() {
@Override
public void run() {
delegateDrawing(cl, cellX, cellY);
}
};
Runnable onEnd = new Runnable() {
@Override
public void run() {
clearDrawingDelegate();
}
};
animateScale(1f, 1f, onStart, onEnd);
CellLayout cl = mDrawingDelegate;
int cellX = delegateCellX;
int cellY = delegateCellY;
animateScale(1f, 1f, () -> delegateDrawing(cl, cellX, cellY), this::clearDrawingDelegate);
}
public int getBackgroundAlpha() {