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