Loading src/com/android/launcher3/PagedView.java +21 −6 Original line number Diff line number Diff line Loading @@ -833,18 +833,25 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou return; } // Add the current page's views as focusable and the next possible page's too. If the // last focus change action was left then the left neighbour's views will be added, and // if it was right then the right neighbour's views will be added. // Unfortunately mCurrentPage can be outdated if there were multiple control actions in a // short period of time, but mNextPage is up to date because it is always updated by // method snapToPage. int nextPage = getNextPage(); // XXX-RTL: This will be fixed in a future CL if (mCurrentPage >= 0 && mCurrentPage < getPageCount()) { getPageAt(mCurrentPage).addFocusables(views, direction, focusableMode); if (nextPage >= 0 && nextPage < getPageCount()) { getPageAt(nextPage).addFocusables(views, direction, focusableMode); } if (direction == View.FOCUS_LEFT) { if (mCurrentPage > 0) { int nextPage = validateNewPage(mCurrentPage - 1); if (nextPage > 0) { nextPage = validateNewPage(nextPage - 1); getPageAt(nextPage).addFocusables(views, direction, focusableMode); } } else if (direction == View.FOCUS_RIGHT) { if (mCurrentPage < getPageCount() - 1) { int nextPage = validateNewPage(mCurrentPage + 1); if (nextPage < getPageCount() - 1) { nextPage = validateNewPage(nextPage + 1); getPageAt(nextPage).addFocusables(views, direction, focusableMode); } } Loading Loading @@ -1414,6 +1421,14 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou @Override public void requestChildFocus(View child, View focused) { super.requestChildFocus(child, focused); // In case the device is controlled by a controller, mCurrentPage isn't updated properly // which results in incorrect navigation int nextPage = getNextPage(); if (nextPage != mCurrentPage) { setCurrentPage(nextPage); } int page = indexToPage(indexOfChild(child)); if (page >= 0 && page != getCurrentPage() && !isInTouchMode()) { snapToPage(page); Loading Loading
src/com/android/launcher3/PagedView.java +21 −6 Original line number Diff line number Diff line Loading @@ -833,18 +833,25 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou return; } // Add the current page's views as focusable and the next possible page's too. If the // last focus change action was left then the left neighbour's views will be added, and // if it was right then the right neighbour's views will be added. // Unfortunately mCurrentPage can be outdated if there were multiple control actions in a // short period of time, but mNextPage is up to date because it is always updated by // method snapToPage. int nextPage = getNextPage(); // XXX-RTL: This will be fixed in a future CL if (mCurrentPage >= 0 && mCurrentPage < getPageCount()) { getPageAt(mCurrentPage).addFocusables(views, direction, focusableMode); if (nextPage >= 0 && nextPage < getPageCount()) { getPageAt(nextPage).addFocusables(views, direction, focusableMode); } if (direction == View.FOCUS_LEFT) { if (mCurrentPage > 0) { int nextPage = validateNewPage(mCurrentPage - 1); if (nextPage > 0) { nextPage = validateNewPage(nextPage - 1); getPageAt(nextPage).addFocusables(views, direction, focusableMode); } } else if (direction == View.FOCUS_RIGHT) { if (mCurrentPage < getPageCount() - 1) { int nextPage = validateNewPage(mCurrentPage + 1); if (nextPage < getPageCount() - 1) { nextPage = validateNewPage(nextPage + 1); getPageAt(nextPage).addFocusables(views, direction, focusableMode); } } Loading Loading @@ -1414,6 +1421,14 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou @Override public void requestChildFocus(View child, View focused) { super.requestChildFocus(child, focused); // In case the device is controlled by a controller, mCurrentPage isn't updated properly // which results in incorrect navigation int nextPage = getNextPage(); if (nextPage != mCurrentPage) { setCurrentPage(nextPage); } int page = indexToPage(indexOfChild(child)); if (page >= 0 && page != getCurrentPage() && !isInTouchMode()) { snapToPage(page); Loading