use of com.android.quickstep.views.RecentsView in project android_packages_apps_Launcher3 by crdroidandroid.
the class BaseQuickstepLauncher method onScreenOff.
@Override
protected void onScreenOff() {
super.onScreenOff();
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
RecentsView recentsView = getOverviewPanel();
recentsView.finishRecentsAnimation(true, /* toRecents */
null);
}
}
use of com.android.quickstep.views.RecentsView in project android_packages_apps_Launcher3 by crdroidandroid.
the class BaseActivityInterface method switchRunningTaskViewToScreenshot.
public void switchRunningTaskViewToScreenshot(ThumbnailData thumbnailData, Runnable runnable) {
ACTIVITY_TYPE activity = getCreatedActivity();
if (activity == null) {
return;
}
RecentsView recentsView = activity.getOverviewPanel();
if (recentsView == null) {
if (runnable != null) {
runnable.run();
}
return;
}
recentsView.switchToScreenshot(thumbnailData, runnable);
}
use of com.android.quickstep.views.RecentsView in project android_packages_apps_Launcher3 by crdroidandroid.
the class OverviewCommandHelper method executeCommand.
/**
* Executes the task and returns true if next task can be executed. If false, then the next
* task is deferred until {@link #scheduleNextTask} is called
*/
private <T extends StatefulActivity<?>> boolean executeCommand(CommandInfo cmd) {
BaseActivityInterface<?, T> activityInterface = mOverviewComponentObserver.getActivityInterface();
RecentsView recents = activityInterface.getVisibleRecentsView();
if (recents == null) {
if (cmd.type == TYPE_HIDE) {
// already hidden
return true;
}
} else {
switch(cmd.type) {
case TYPE_SHOW:
// already visible
return true;
case TYPE_HIDE:
{
int currentPage = recents.getNextPage();
TaskView tv = (currentPage >= 0 && currentPage < recents.getTaskViewCount()) ? (TaskView) recents.getPageAt(currentPage) : null;
return launchTask(recents, tv, cmd);
}
case TYPE_TOGGLE:
return launchTask(recents, getNextTask(recents), cmd);
}
}
if (activityInterface.switchToRecentsIfVisible(() -> scheduleNextTask(cmd))) {
// If successfully switched, wait until animation finishes
return false;
}
final T activity = activityInterface.getCreatedActivity();
if (activity != null) {
InteractionJankMonitorWrapper.begin(activity.getRootView(), InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH);
}
GestureState gestureState = mService.createGestureState(GestureState.DEFAULT_STATE);
gestureState.setHandlingAtomicEvent(true);
AbsSwipeUpHandler interactionHandler = mService.getSwipeUpHandlerFactory().newHandler(gestureState, cmd.createTime);
interactionHandler.setGestureEndCallback(() -> onTransitionComplete(cmd, interactionHandler));
interactionHandler.initWhenReady();
RecentsAnimationListener recentAnimListener = new RecentsAnimationListener() {
@Override
public void onRecentsAnimationStart(RecentsAnimationController controller, RecentsAnimationTargets targets) {
interactionHandler.onGestureEnded(0, new PointF(), new PointF());
cmd.removeListener(this);
}
@Override
public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) {
interactionHandler.onGestureCancelled();
cmd.removeListener(this);
RecentsView createdRecents = activityInterface.getCreatedActivity().getOverviewPanel();
if (createdRecents != null) {
createdRecents.onRecentsAnimationComplete();
}
}
};
if (mTaskAnimationManager.isRecentsAnimationRunning()) {
cmd.mActiveCallbacks = mTaskAnimationManager.continueRecentsAnimation(gestureState);
cmd.mActiveCallbacks.addListener(interactionHandler);
mTaskAnimationManager.notifyRecentsAnimationState(interactionHandler);
interactionHandler.onGestureStarted(true);
cmd.mActiveCallbacks.addListener(recentAnimListener);
mTaskAnimationManager.notifyRecentsAnimationState(recentAnimListener);
} else {
Intent intent = new Intent(interactionHandler.getLaunchIntent());
intent.putExtra(INTENT_EXTRA_LOG_TRACE_ID, gestureState.getGestureId());
cmd.mActiveCallbacks = mTaskAnimationManager.startRecentsAnimation(gestureState, intent, interactionHandler);
interactionHandler.onGestureStarted(false);
cmd.mActiveCallbacks.addListener(recentAnimListener);
}
Trace.beginAsyncSection(TRANSITION_NAME, 0);
return false;
}
use of com.android.quickstep.views.RecentsView in project android_packages_apps_Launcher3 by crdroidandroid.
the class RecentsActivity method startHome.
public void startHome() {
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
RecentsView recentsView = getOverviewPanel();
recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true, this::startHomeInternal));
} else {
startHomeInternal();
}
}
use of com.android.quickstep.views.RecentsView in project android_packages_apps_Launcher3 by crdroidandroid.
the class NavBarToHomeTouchController method initCurrentAnimation.
private void initCurrentAnimation() {
long accuracy = (long) (getShiftRange() * 2);
final PendingAnimation builder = new PendingAnimation(accuracy);
if (mStartState.overviewUi) {
RecentsView recentsView = mLauncher.getOverviewPanel();
AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher, builder);
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
builder.addOnFrameCallback(recentsView::redrawLiveTile);
}
AbstractFloatingView.closeOpenContainer(mLauncher, AbstractFloatingView.TYPE_TASK_MENU);
} else if (mStartState == ALL_APPS) {
AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
builder.setFloat(allAppsController, ALL_APPS_PROGRESS, -mPullbackDistance / allAppsController.getShiftRange(), PULLBACK_INTERPOLATOR);
// Slightly fade out all apps content to further distinguish from scrolling.
StateAnimationConfig config = new StateAnimationConfig();
config.duration = accuracy;
config.setInterpolator(StateAnimationConfig.ANIM_ALL_APPS_FADE, Interpolators.mapToProgress(PULLBACK_INTERPOLATOR, 0, 0.5f));
allAppsController.setAlphas(mEndState, config, builder);
}
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mLauncher);
if (topView != null) {
topView.addHintCloseAnim(mPullbackDistance, PULLBACK_INTERPOLATOR, builder);
}
mCurrentAnimation = builder.createPlaybackController();
mCurrentAnimation.getTarget().addListener(newCancelListener(this::clearState));
}
Aggregations