Merge "Taskbar should animate immediately when tapping a live tile" into sc-v2-dev am: 255887ccdc
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15467635 Change-Id: I1d6855335bf027535308c34c70cd49bdf9c33b51
This commit is contained in:
@@ -38,9 +38,9 @@ import com.android.quickstep.RecentsAnimationCallbacks;
|
||||
import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener;
|
||||
import com.android.quickstep.RecentsAnimationController;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
|
||||
|
||||
/**
|
||||
* A data source which integrates with a Launcher instance
|
||||
*/
|
||||
@@ -159,8 +159,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
* automatically reset once the recents animation finishes
|
||||
*/
|
||||
public Animator createAnimToLauncher(@NonNull LauncherState toState,
|
||||
@NonNull RecentsAnimationCallbacks callbacks,
|
||||
long duration) {
|
||||
@NonNull RecentsAnimationCallbacks callbacks, long duration) {
|
||||
TaskbarStashController stashController = mControllers.taskbarStashController;
|
||||
ObjectAnimator animator = mIconAlignmentForGestureState
|
||||
.animateToValue(1)
|
||||
@@ -180,31 +179,15 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
stashController.animateToIsStashed(false, duration);
|
||||
}
|
||||
});
|
||||
callbacks.addListener(new RecentsAnimationListener() {
|
||||
@Override
|
||||
public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) {
|
||||
endGestureStateOverride(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationFinished(RecentsAnimationController controller) {
|
||||
endGestureStateOverride(!controller.getFinishTargetIsLauncher());
|
||||
}
|
||||
|
||||
private void endGestureStateOverride(boolean finishedToApp) {
|
||||
callbacks.removeListener(this);
|
||||
mIsAnimatingToLauncherViaGesture = false;
|
||||
|
||||
mIconAlignmentForGestureState
|
||||
.animateToValue(0)
|
||||
.start();
|
||||
|
||||
if (finishedToApp) {
|
||||
// We only need this for the exiting live tile case.
|
||||
stashController.animateToIsStashed(stashController.isStashedInApp());
|
||||
}
|
||||
}
|
||||
TaskBarRecentsAnimationListener listener = new TaskBarRecentsAnimationListener(callbacks);
|
||||
callbacks.addListener(listener);
|
||||
RecentsView recentsView = mLauncher.getOverviewPanel();
|
||||
recentsView.setTaskLaunchListener(() -> {
|
||||
listener.endGestureStateOverride(true);
|
||||
callbacks.removeListener(listener);
|
||||
});
|
||||
|
||||
return animator;
|
||||
}
|
||||
|
||||
@@ -249,4 +232,36 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
mIconAlphaForHome.setValue(isVisible ? 1 : 0);
|
||||
mLauncher.getHotseat().setIconsAlpha(isVisible ? 0f : 1f);
|
||||
}
|
||||
|
||||
private final class TaskBarRecentsAnimationListener implements RecentsAnimationListener {
|
||||
private final RecentsAnimationCallbacks mCallbacks;
|
||||
|
||||
TaskBarRecentsAnimationListener(RecentsAnimationCallbacks callbacks) {
|
||||
mCallbacks = callbacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) {
|
||||
endGestureStateOverride(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationFinished(RecentsAnimationController controller) {
|
||||
endGestureStateOverride(!controller.getFinishTargetIsLauncher());
|
||||
}
|
||||
|
||||
private void endGestureStateOverride(boolean finishedToApp) {
|
||||
mCallbacks.removeListener(this);
|
||||
mIsAnimatingToLauncherViaGesture = false;
|
||||
|
||||
mIconAlignmentForGestureState
|
||||
.animateToValue(0)
|
||||
.start();
|
||||
|
||||
TaskbarStashController controller = mControllers.taskbarStashController;
|
||||
if (finishedToApp) {
|
||||
controller.animateToIsStashed(controller.isStashedInApp());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,6 +602,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
};
|
||||
|
||||
private RunnableList mSideTaskLaunchCallback;
|
||||
private TaskLaunchListener mTaskLaunchListener;
|
||||
|
||||
public RecentsView(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
BaseActivityInterface sizeStrategy) {
|
||||
@@ -882,6 +883,21 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mSideTaskLaunchCallback.add(callback::executeAllAndDestroy);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a one-time callback when touching in live tile mode. It's reset to null right
|
||||
* after it's called.
|
||||
*/
|
||||
public void setTaskLaunchListener(TaskLaunchListener taskLaunchListener) {
|
||||
mTaskLaunchListener = taskLaunchListener;
|
||||
}
|
||||
|
||||
public void onTaskLaunchedInLiveTileMode() {
|
||||
if (mTaskLaunchListener != null) {
|
||||
mTaskLaunchListener.onTaskLaunched();
|
||||
mTaskLaunchListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void executeSideTaskLaunchCallback() {
|
||||
if (mSideTaskLaunchCallback != null) {
|
||||
mSideTaskLaunchCallback.executeAllAndDestroy();
|
||||
@@ -4210,4 +4226,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
// Set locus context is a binder call, don't want it to happen during a transition
|
||||
UI_HELPER_EXECUTOR.post(() -> mActivity.setLocusContext(id, Bundle.EMPTY));
|
||||
}
|
||||
|
||||
public interface TaskLaunchListener {
|
||||
void onTaskLaunched();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,6 +584,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
}
|
||||
});
|
||||
anim.start();
|
||||
recentsView.onTaskLaunchedInLiveTileMode();
|
||||
} else {
|
||||
launchTaskAnimated();
|
||||
}
|
||||
@@ -614,12 +615,14 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
ActivityOptionsWrapper opts = mActivity.getActivityLaunchOptions(this, null);
|
||||
if (ActivityManagerWrapper.getInstance()
|
||||
.startActivityFromRecents(mTask.key, opts.options)) {
|
||||
if (ENABLE_QUICKSTEP_LIVE_TILE.get() &&
|
||||
getRecentsView().getRunningTaskViewId() != -1) {
|
||||
RecentsView recentsView = getRecentsView();
|
||||
if (ENABLE_QUICKSTEP_LIVE_TILE.get() && recentsView.getRunningTaskViewId() != -1) {
|
||||
recentsView.onTaskLaunchedInLiveTileMode();
|
||||
|
||||
// Return a fresh callback in the live tile case, so that it's not accidentally
|
||||
// triggered by QuickstepTransitionManager.AppLaunchAnimationRunner.
|
||||
RunnableList callbackList = new RunnableList();
|
||||
getRecentsView().addSideTaskLaunchCallback(callbackList);
|
||||
recentsView.addSideTaskLaunchCallback(callbackList);
|
||||
return callbackList;
|
||||
}
|
||||
return opts.onEndCallback;
|
||||
|
||||
Reference in New Issue
Block a user