diff options
Diffstat (limited to 'quickstep/src/com/android/quickstep/views/RecentsView.java')
-rw-r--r-- | quickstep/src/com/android/quickstep/views/RecentsView.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 65b53fe84..ae8ebbe09 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -41,6 +41,7 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; import android.os.UserHandle; +import android.support.annotation.Nullable; import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; @@ -582,6 +583,11 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl * and unloads the associated task data for tasks that are no longer visible. */ public void loadVisibleTaskData() { + if (!mOverviewStateEnabled) { + // Skip loading visible task data if we've already left the overview state + return; + } + RecentsTaskLoader loader = mModel.getRecentsTaskLoader(); int centerPageIndex = getPageNearestToCenterOfScreen(); int lower = Math.max(0, centerPageIndex - 2); @@ -968,6 +974,13 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_TAB: + if (!event.isAltPressed() && + getNextPage() == + (event.isShiftPressed() ? 0 : getChildCount() - 1)) { + // If not Alt-Tab navigation, don't loop forever in the carousel and leave + // it once we reached the end. + return false; + } snapToPageRelative(event.isShiftPressed() ? -1 : 1); return true; case KeyEvent.KEYCODE_DPAD_RIGHT: @@ -993,6 +1006,22 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl return super.dispatchKeyEvent(event); } + @Override + protected void onFocusChanged(boolean gainFocus, int direction, + @Nullable Rect previouslyFocusedRect) { + super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); + if (gainFocus && getChildCount() > 0) { + switch (direction) { + case FOCUS_FORWARD: + setCurrentPage(0); + break; + case FOCUS_BACKWARD: + setCurrentPage(getChildCount() - 1); + break; + } + } + } + public void snapToTaskAfterNext() { snapToPageRelative(1); } @@ -1304,6 +1333,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl } public void revealClearAllButton() { + setCurrentPage(getChildCount() - 1); // Loads tasks info if needed. scrollTo(mIsRtl ? 0 : computeMaxScrollX(), 0); } |