Animate to bottom view in app => overview
We always want to animate to the bottom so we should just do that if we
have the view laid out even if at the time the app task doesn't actually
match the view.
Bug: 114136250
Test: Go to recents, press overview twice quickly, see it animate
correctly
Change-Id: I0516ef127ff6ef0f865c85314c9ffe4a7c6ef9e3
(cherry picked from commit 86957f28ff
)
This commit is contained in:
parent
6f927ecd8e
commit
1060a0d7fc
|
@ -131,10 +131,11 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
|
|||
return anim;
|
||||
}
|
||||
|
||||
View thumbnailView = mRecentsView.getThumbnailViewForTask(mTargetTaskId);
|
||||
View thumbnailView = mRecentsView.getBottomThumbnailView();
|
||||
if (thumbnailView == null) {
|
||||
// TODO: We should either 1) guarantee the view is loaded before attempting this
|
||||
// or 2) have a backup animation.
|
||||
// This can be null if there were previously 0 tasks and the recycler view has not had
|
||||
// enough time to take in the data change, bind a new view, and lay out the new view.
|
||||
// TODO: Have a fallback to animate to
|
||||
if (Log.isLoggable(TAG, Log.WARN)) {
|
||||
Log.w(TAG, "No thumbnail view for running task. Using stub animation.");
|
||||
}
|
||||
|
|
|
@ -15,12 +15,10 @@
|
|||
*/
|
||||
package com.android.quickstep;
|
||||
|
||||
import android.util.ArrayMap;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView.Adapter;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
|
@ -39,7 +37,6 @@ public final class TaskAdapter extends Adapter<TaskHolder> {
|
|||
private static final int MAX_TASKS_TO_DISPLAY = 6;
|
||||
private static final String TAG = "TaskAdapter";
|
||||
private final TaskListLoader mLoader;
|
||||
private final ArrayMap<Integer, TaskItemView> mTaskIdToViewMap = new ArrayMap<>();
|
||||
private TaskActionController mTaskActionController;
|
||||
private boolean mIsShowingLoadingUi;
|
||||
|
||||
|
@ -63,16 +60,6 @@ public final class TaskAdapter extends Adapter<TaskHolder> {
|
|||
mIsShowingLoadingUi = isShowingLoadingUi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get task item view for a given task id if it's attached to the view.
|
||||
*
|
||||
* @param taskId task id to search for
|
||||
* @return corresponding task item view if it's attached, null otherwise
|
||||
*/
|
||||
public @Nullable TaskItemView getTaskItemView(int taskId) {
|
||||
return mTaskIdToViewMap.get(taskId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
TaskItemView itemView = (TaskItemView) LayoutInflater.from(parent.getContext())
|
||||
|
@ -116,22 +103,6 @@ public final class TaskAdapter extends Adapter<TaskHolder> {
|
|||
super.onBindViewHolder(holder, position, payloads);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAttachedToWindow(@NonNull TaskHolder holder) {
|
||||
if (holder.getTask() == null) {
|
||||
return;
|
||||
}
|
||||
mTaskIdToViewMap.put(holder.getTask().key.id, (TaskItemView) holder.itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(@NonNull TaskHolder holder) {
|
||||
if (holder.getTask() == null) {
|
||||
return;
|
||||
}
|
||||
mTaskIdToViewMap.remove(holder.getTask().key.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (mIsShowingLoadingUi) {
|
||||
|
|
|
@ -225,16 +225,15 @@ public final class IconRecentsView extends FrameLayout {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the thumbnail view associated with a task for the purposes of animation.
|
||||
* Get the bottom most thumbnail view to animate to.
|
||||
*
|
||||
* @param taskId task id of thumbnail view to get
|
||||
* @return the thumbnail view for the task if attached, null otherwise
|
||||
* @return the thumbnail view if laid out
|
||||
*/
|
||||
public @Nullable View getThumbnailViewForTask(int taskId) {
|
||||
TaskItemView view = mTaskAdapter.getTaskItemView(taskId);
|
||||
if (view == null) {
|
||||
public @Nullable View getBottomThumbnailView() {
|
||||
if (mTaskRecyclerView.getChildCount() == 0) {
|
||||
return null;
|
||||
}
|
||||
TaskItemView view = (TaskItemView) mTaskRecyclerView.getChildAt(0);
|
||||
return view.getThumbnailView();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue