summaryrefslogtreecommitdiffstats
path: root/go
diff options
context:
space:
mode:
authorKevin <kevhan@google.com>2019-04-12 09:57:25 -0700
committerKevin Han <kevhan@google.com>2019-04-23 19:23:25 +0000
commit1060a0d7fc41a61e7b7646265455bd2916ffbdc5 (patch)
tree79597e31b369abd62503d5c8a6665d0cbd889f8b /go
parent6f927ecd8ef12f17f5814d453d136690988782fc (diff)
downloadandroid_packages_apps_Trebuchet-1060a0d7fc41a61e7b7646265455bd2916ffbdc5.tar.gz
android_packages_apps_Trebuchet-1060a0d7fc41a61e7b7646265455bd2916ffbdc5.tar.bz2
android_packages_apps_Trebuchet-1060a0d7fc41a61e7b7646265455bd2916ffbdc5.zip
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 86957f28fff4c3b68f4ea81d48a29b42c53e8176)
Diffstat (limited to 'go')
-rw-r--r--go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java7
-rw-r--r--go/quickstep/src/com/android/quickstep/TaskAdapter.java29
-rw-r--r--go/quickstep/src/com/android/quickstep/views/IconRecentsView.java11
3 files changed, 9 insertions, 38 deletions
diff --git a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
index d1d697c0c..c228bb94f 100644
--- a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
+++ b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
@@ -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.");
}
diff --git a/go/quickstep/src/com/android/quickstep/TaskAdapter.java b/go/quickstep/src/com/android/quickstep/TaskAdapter.java
index 66c074bdd..02cbf4e01 100644
--- a/go/quickstep/src/com/android/quickstep/TaskAdapter.java
+++ b/go/quickstep/src/com/android/quickstep/TaskAdapter.java
@@ -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())
@@ -117,22 +104,6 @@ public final class TaskAdapter extends Adapter<TaskHolder> {
}
@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) {
// Show loading version of all items.
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index 7f77b6cc4..59755bcb3 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -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();
}