diff options
author | Kevin <kevhan@google.com> | 2019-04-18 17:17:06 -0700 |
---|---|---|
committer | Kevin Han <kevhan@google.com> | 2019-04-23 19:27:42 +0000 |
commit | 52645638e905b7fcdf27a2a77575a6c65973f532 (patch) | |
tree | 2ffb32bfa482073f0baba4bc84f648bf706bd8e3 /go/quickstep | |
parent | 5f4e2fead06e6e81584220a1903a05ad96c5519e (diff) | |
download | android_packages_apps_Trebuchet-52645638e905b7fcdf27a2a77575a6c65973f532.tar.gz android_packages_apps_Trebuchet-52645638e905b7fcdf27a2a77575a6c65973f532.tar.bz2 android_packages_apps_Trebuchet-52645638e905b7fcdf27a2a77575a6c65973f532.zip |
Ensure recents scrolled to first task in landscape
The app should animate to the bottom view which means we should ensure
the bottom view is scrolled to be visible at the bottom when we animate
in. Note that this is only a consideration in landscape since in
portrait, all tasks are always visible and the recyclver view is not
scrollable.
Bug: 114136250
Test: Go to recents Go from app in landscape mode
Change-Id: If4ea35759cc881f2c32565368d031620b62a45dd
(cherry picked from commit 64bb5bbb786f1d7020984c1b1bfbb93099f12ba7)
Diffstat (limited to 'go/quickstep')
-rw-r--r-- | go/quickstep/src/com/android/quickstep/views/IconRecentsView.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java index ec02e9d70..b7ed5b59f 100644 --- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java +++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java @@ -15,6 +15,8 @@ */ package com.android.quickstep.views; +import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; + import static androidx.recyclerview.widget.LinearLayoutManager.VERTICAL; import static com.android.quickstep.TaskAdapter.CHANGE_EVENT_TYPE_EMPTY_TO_CONTENT; @@ -99,6 +101,7 @@ public final class IconRecentsView extends FrameLayout { private final Context mContext; private final TaskListLoader mTaskLoader; private final TaskAdapter mTaskAdapter; + private final LinearLayoutManager mTaskLayoutManager; private final TaskActionController mTaskActionController; private final DefaultItemAnimator mDefaultItemAnimator = new DefaultItemAnimator(); private final ContentFillItemAnimator mLoadingContentItemAnimator = @@ -138,6 +141,7 @@ public final class IconRecentsView extends FrameLayout { mTaskAdapter.setOnClearAllClickListener(view -> animateClearAllTasks()); mTaskActionController = new TaskActionController(mTaskLoader, mTaskAdapter); mTaskAdapter.setActionController(mTaskActionController); + mTaskLayoutManager = new LinearLayoutManager(mContext, VERTICAL, true /* reverseLayout */); RecentsModel.INSTANCE.get(context).addThumbnailChangeListener(listener); } @@ -147,8 +151,7 @@ public final class IconRecentsView extends FrameLayout { if (mTaskRecyclerView == null) { mTaskRecyclerView = findViewById(R.id.recent_task_recycler_view); mTaskRecyclerView.setAdapter(mTaskAdapter); - mTaskRecyclerView.setLayoutManager( - new LinearLayoutManager(mContext, VERTICAL, true /* reverseLayout */)); + mTaskRecyclerView.setLayoutManager(mTaskLayoutManager); ItemTouchHelper helper = new ItemTouchHelper( new TaskSwipeCallback(mTaskActionController)); helper.attachToRecyclerView(mTaskRecyclerView); @@ -211,6 +214,12 @@ public final class IconRecentsView extends FrameLayout { * becomes visible. */ public void onBeginTransitionToOverview() { + if (mContext.getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE) { + // Scroll to bottom of task in landscape mode. This is a non-issue in portrait mode as + // all tasks should be visible to fill up the screen in portrait mode and the view will + // not be scrollable. + mTaskLayoutManager.scrollToPositionWithOffset(TASKS_START_POSITION, 0 /* offset */); + } scheduleFadeInLayoutAnimation(); // Load any task changes if (!mTaskLoader.needsToLoad()) { |