Wrap animation runner for recents animation
Bug: 160239388 Change-Id: I937c89b963b88702548daca7c0b85f7a79d5d706
This commit is contained in:
parent
30cd4dca5f
commit
907845eba5
|
@ -34,8 +34,7 @@ import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
|
|||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.P)
|
||||
public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCompat,
|
||||
WrappedAnimationRunnerImpl {
|
||||
public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCompat {
|
||||
|
||||
private static final String TAG = "LauncherAnimationRunner";
|
||||
|
||||
|
|
|
@ -41,7 +41,10 @@ import com.android.launcher3.AbstractFloatingView;
|
|||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.LauncherAnimationRunner;
|
||||
import com.android.launcher3.LauncherAnimationRunner.AnimationResult;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.WrappedAnimationRunnerImpl;
|
||||
import com.android.launcher3.WrappedLauncherAnimationRunner;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||
|
@ -87,6 +90,9 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
|||
|
||||
private StateManager<RecentsState> mStateManager;
|
||||
|
||||
// Strong refs to runners which are cleared when the activity is destroyed
|
||||
private WrappedAnimationRunnerImpl mActivityLaunchAnimationRunner;
|
||||
|
||||
/**
|
||||
* Init drag layer and overview panel views.
|
||||
*/
|
||||
|
@ -170,8 +176,11 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
|||
}
|
||||
|
||||
final TaskView taskView = (TaskView) v;
|
||||
RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(mUiHandler,
|
||||
true /* startAtFrontOfQueue */) {
|
||||
mActivityLaunchAnimationRunner = new WrappedAnimationRunnerImpl() {
|
||||
@Override
|
||||
public Handler getHandler() {
|
||||
return mUiHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets,
|
||||
|
@ -182,8 +191,10 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
|||
result.setAnimation(anim, RecentsActivity.this);
|
||||
}
|
||||
};
|
||||
final LauncherAnimationRunner wrapper = new WrappedLauncherAnimationRunner<>(
|
||||
mActivityLaunchAnimationRunner, true /* startAtFrontOfQueue */);
|
||||
return ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(
|
||||
runner, RECENTS_LAUNCH_DURATION,
|
||||
wrapper, RECENTS_LAUNCH_DURATION,
|
||||
RECENTS_LAUNCH_DURATION - STATUS_BAR_TRANSITION_DURATION
|
||||
- STATUS_BAR_TRANSITION_PRE_DELAY));
|
||||
}
|
||||
|
@ -288,6 +299,7 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
|||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
ACTIVITY_TRACKER.onActivityDestroyed(this);
|
||||
mActivityLaunchAnimationRunner = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,6 +21,8 @@ import android.content.Context;
|
|||
import android.os.Handler;
|
||||
|
||||
import com.android.launcher3.LauncherAnimationRunner;
|
||||
import com.android.launcher3.LauncherAnimationRunner.AnimationResult;
|
||||
import com.android.launcher3.WrappedAnimationRunnerImpl;
|
||||
import com.android.launcher3.WrappedLauncherAnimationRunner;
|
||||
import com.android.systemui.shared.system.ActivityOptionsCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
|
||||
|
@ -28,14 +30,17 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
|||
|
||||
public abstract class RemoteAnimationProvider {
|
||||
|
||||
LauncherAnimationRunner mAnimationRunner;
|
||||
WrappedAnimationRunnerImpl mAnimationRunner;
|
||||
|
||||
public abstract AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets);
|
||||
|
||||
ActivityOptions toActivityOptions(Handler handler, long duration, Context context) {
|
||||
mAnimationRunner = new LauncherAnimationRunner(handler,
|
||||
false /* startAtFrontOfQueue */) {
|
||||
mAnimationRunner = new WrappedAnimationRunnerImpl() {
|
||||
@Override
|
||||
public Handler getHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets,
|
||||
|
@ -45,7 +50,6 @@ public abstract class RemoteAnimationProvider {
|
|||
};
|
||||
final LauncherAnimationRunner wrapper = new WrappedLauncherAnimationRunner(
|
||||
mAnimationRunner, false /* startAtFrontOfQueue */);
|
||||
|
||||
return ActivityOptionsCompat.makeRemoteAnimation(
|
||||
new RemoteAnimationAdapterCompat(wrapper, duration, 0));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue