Add overview button handling to Go recents.
Add the same overview button handling as in the original launcher. Specifically, pressing overview on recents will launch the next appropriate task (e.g. the next most recent task if you came from an app). Bug: 114136250 Test: Go to recents from launcher, press overview => launch task. Test: Go to recents from app, press overview => launches next task Change-Id: I946974b4c2b65b6d0f212d8e8c0816983386d952
This commit is contained in:
parent
969e7a6c57
commit
c977ea9a3c
|
@ -28,6 +28,7 @@ import com.android.launcher3.Utilities;
|
|||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.util.TouchController;
|
||||
import com.android.quickstep.OverviewInteractionState;
|
||||
import com.android.quickstep.views.IconRecentsView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -35,7 +36,7 @@ import java.util.ArrayList;
|
|||
* Provides recents-related {@link UiFactory} logic and classes.
|
||||
*/
|
||||
public abstract class RecentsUiFactory {
|
||||
|
||||
|
||||
public static final boolean GO_LOW_RAM_RECENTS_ENABLED = true;
|
||||
// Scale recents takes before animating in
|
||||
private static final float RECENTS_PREPARE_SCALE = 1.33f;
|
||||
|
@ -87,7 +88,10 @@ public abstract class RecentsUiFactory {
|
|||
*
|
||||
* @param launcher the launcher activity
|
||||
*/
|
||||
public static void resetOverview(Launcher launcher) {}
|
||||
public static void resetOverview(Launcher launcher) {
|
||||
IconRecentsView recentsView = launcher.getOverviewPanel();
|
||||
recentsView.setTransitionedFromApp(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recents logic that triggers when launcher state changes or launcher activity stops/resumes.
|
||||
|
|
|
@ -34,6 +34,7 @@ import androidx.annotation.NonNull;
|
|||
import com.android.launcher3.BaseDraggingActivity;
|
||||
import com.android.quickstep.util.MultiValueUpdateListener;
|
||||
import com.android.quickstep.util.RemoteAnimationProvider;
|
||||
import com.android.quickstep.util.RemoteAnimationTargetSet;
|
||||
import com.android.quickstep.views.IconRecentsView;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat;
|
||||
|
@ -100,6 +101,10 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
|
|||
return anim;
|
||||
}
|
||||
|
||||
RemoteAnimationTargetSet targetSet =
|
||||
new RemoteAnimationTargetSet(targetCompats, MODE_CLOSING);
|
||||
mRecentsView.setTransitionedFromApp(!targetSet.isAnimatingHome());
|
||||
|
||||
RemoteAnimationTargetCompat recentsTarget = null;
|
||||
RemoteAnimationTargetCompat closingAppTarget = null;
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public class OverviewCommandHelper {
|
|||
if (recents == null) {
|
||||
return false;
|
||||
}
|
||||
//TODO: Launch last running task or go to home.
|
||||
recents.handleOverviewCommand();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class OverviewCommandHelper {
|
|||
protected boolean handleCommand(long elapsedTime) {
|
||||
IconRecentsView recents = mHelper.getVisibleRecentsView();
|
||||
if (recents != null) {
|
||||
//TODO: Launch next task in icon recents.
|
||||
recents.handleOverviewCommand();
|
||||
return true;
|
||||
} else if (elapsedTime < ViewConfiguration.getDoubleTapTimeout()) {
|
||||
// The user tried to launch back into overview too quickly, either after
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.android.systemui.shared.recents.model.Task;
|
|||
* A recycler view holder that holds the task view and binds {@link Task} content (app title, icon,
|
||||
* etc.) to the view.
|
||||
*/
|
||||
final class TaskHolder extends ViewHolder {
|
||||
public final class TaskHolder extends ViewHolder {
|
||||
|
||||
private final TaskItemView mTaskItemView;
|
||||
private Task mTask;
|
||||
|
|
|
@ -35,8 +35,9 @@ import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver;
|
|||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.quickstep.RecentsToActivityHelper;
|
||||
import com.android.quickstep.TaskAdapter;
|
||||
import com.android.quickstep.TaskActionController;
|
||||
import com.android.quickstep.TaskAdapter;
|
||||
import com.android.quickstep.TaskHolder;
|
||||
import com.android.quickstep.TaskListLoader;
|
||||
import com.android.quickstep.TaskSwipeCallback;
|
||||
|
||||
|
@ -80,6 +81,7 @@ public final class IconRecentsView extends FrameLayout {
|
|||
private RecyclerView mTaskRecyclerView;
|
||||
private View mEmptyView;
|
||||
private View mContentView;
|
||||
private boolean mTransitionedFromApp;
|
||||
|
||||
public IconRecentsView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
@ -146,6 +148,38 @@ public final class IconRecentsView extends FrameLayout {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether we transitioned to recents from the most recent app.
|
||||
*
|
||||
* @param transitionedFromApp true if transitioned from the most recent app, false otherwise
|
||||
*/
|
||||
public void setTransitionedFromApp(boolean transitionedFromApp) {
|
||||
mTransitionedFromApp = transitionedFromApp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles input from the overview button. Launch the most recent task unless we just came from
|
||||
* the app. In that case, we launch the next most recent.
|
||||
*/
|
||||
public void handleOverviewCommand() {
|
||||
int childCount = mTaskRecyclerView.getChildCount();
|
||||
if (childCount == 0) {
|
||||
// Do nothing
|
||||
return;
|
||||
}
|
||||
TaskHolder taskToLaunch;
|
||||
if (mTransitionedFromApp && childCount > 1) {
|
||||
// Launch the next most recent app
|
||||
TaskItemView itemView = (TaskItemView) mTaskRecyclerView.getChildAt(1);
|
||||
taskToLaunch = (TaskHolder) mTaskRecyclerView.getChildViewHolder(itemView);
|
||||
} else {
|
||||
// Launch the most recent app
|
||||
TaskItemView itemView = (TaskItemView) mTaskRecyclerView.getChildAt(0);
|
||||
taskToLaunch = (TaskHolder) mTaskRecyclerView.getChildViewHolder(itemView);
|
||||
}
|
||||
mTaskActionController.launchTask(taskToLaunch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the thumbnail view associated with a task for the purposes of animation.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue