Loading quickstep/src/com/android/quickstep/views/RecentsView.java +76 −0 Original line number Diff line number Diff line Loading @@ -1041,6 +1041,17 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T } } public boolean isTaskViewFullyVisible(TaskView tv) { if (showAsGrid()) { int screenStart = mOrientationHandler.getPrimaryScroll(this); int screenEnd = screenStart + mOrientationHandler.getMeasuredSize(this); return isTaskViewFullyWithinBounds(tv, screenStart, screenEnd); } else { // For now, just check if it's the active task return indexOfChild(tv) == getNextPage(); } } @Nullable private TaskView getLastGridTaskView() { return getLastGridTaskView(getTopRowIdArray(), getBottomRowIdArray()); Loading Loading @@ -1087,6 +1098,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T && taskEnd <= end); } private boolean isTaskViewFullyWithinBounds(TaskView tv, int start, int end) { int taskStart = mOrientationHandler.getChildStart(tv) + (int) tv.getOffsetAdjustment( showAsFullscreen(), showAsGrid()); int taskSize = (int) (mOrientationHandler.getMeasuredSize(tv) * tv.getSizeAdjustment( showAsFullscreen())); int taskEnd = taskStart + taskSize; return taskStart >= start && taskEnd <= end; } /** * Returns true if the task is in expected scroll position. * Loading Loading @@ -4853,6 +4873,62 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T return mPipCornerRadius; } @Override public boolean scrollLeft() { if (!showAsGrid()) { return super.scrollLeft(); } int targetPage = getNextPage(); if (targetPage >= 0) { // Find the next page that is not fully visible. TaskView taskView = getTaskViewAt(targetPage); while ((taskView == null || isTaskViewFullyVisible(taskView)) && targetPage - 1 >= 0) { taskView = getTaskViewAt(--targetPage); } // Target a scroll where targetPage is on left of screen but still fully visible. int lastTaskEnd = (mIsRtl ? mLastComputedGridSize.left : mLastComputedGridSize.right) + (mIsRtl ? mPageSpacing : -mPageSpacing); int normalTaskEnd = mIsRtl ? mLastComputedGridTaskSize.left : mLastComputedGridTaskSize.right; int targetScroll = getScrollForPage(targetPage) + normalTaskEnd - lastTaskEnd; // Find a page that is close to targetScroll while not over it. while (targetPage - 1 >= 0 && (mIsRtl ? getScrollForPage(targetPage - 1) < targetScroll : getScrollForPage(targetPage - 1) > targetScroll)) { targetPage--; } snapToPage(targetPage); return true; } return mAllowOverScroll; } @Override public boolean scrollRight() { if (!showAsGrid()) { return super.scrollRight(); } int targetPage = getNextPage(); if (targetPage < getChildCount()) { // Find the next page that is not fully visible. TaskView taskView = getTaskViewAt(targetPage); while ((taskView != null && isTaskViewFullyVisible(taskView)) && targetPage + 1 < getChildCount()) { taskView = getTaskViewAt(++targetPage); } snapToPage(targetPage); return true; } return mAllowOverScroll; } @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); Loading src/com/android/launcher3/PagedView.java +15 −12 Original line number Diff line number Diff line Loading @@ -1749,9 +1749,11 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); final boolean pagesFlipped = isPageOrderFlipped(); int offset = (mAllowOverScroll ? 0 : 1); info.setScrollable(getPageCount() > offset); if (getCurrentPage() < getPageCount() - offset) { info.setScrollable(getPageCount() > 0); int primaryScroll = mOrientationHandler.getPrimaryScroll(this); if (getCurrentPage() < getPageCount() - getPanelCount() || (getCurrentPage() == getPageCount() - getPanelCount() && primaryScroll != getScrollForPage(getPageCount() - getPanelCount()))) { info.addAction(pagesFlipped ? AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD : AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); Loading @@ -1759,7 +1761,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT : AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT); } if (getCurrentPage() >= offset) { if (getCurrentPage() > 0 || (getCurrentPage() == 0 && primaryScroll != getScrollForPage(0))) { info.addAction(pagesFlipped ? AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD : AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); Loading Loading
quickstep/src/com/android/quickstep/views/RecentsView.java +76 −0 Original line number Diff line number Diff line Loading @@ -1041,6 +1041,17 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T } } public boolean isTaskViewFullyVisible(TaskView tv) { if (showAsGrid()) { int screenStart = mOrientationHandler.getPrimaryScroll(this); int screenEnd = screenStart + mOrientationHandler.getMeasuredSize(this); return isTaskViewFullyWithinBounds(tv, screenStart, screenEnd); } else { // For now, just check if it's the active task return indexOfChild(tv) == getNextPage(); } } @Nullable private TaskView getLastGridTaskView() { return getLastGridTaskView(getTopRowIdArray(), getBottomRowIdArray()); Loading Loading @@ -1087,6 +1098,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T && taskEnd <= end); } private boolean isTaskViewFullyWithinBounds(TaskView tv, int start, int end) { int taskStart = mOrientationHandler.getChildStart(tv) + (int) tv.getOffsetAdjustment( showAsFullscreen(), showAsGrid()); int taskSize = (int) (mOrientationHandler.getMeasuredSize(tv) * tv.getSizeAdjustment( showAsFullscreen())); int taskEnd = taskStart + taskSize; return taskStart >= start && taskEnd <= end; } /** * Returns true if the task is in expected scroll position. * Loading Loading @@ -4853,6 +4873,62 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T return mPipCornerRadius; } @Override public boolean scrollLeft() { if (!showAsGrid()) { return super.scrollLeft(); } int targetPage = getNextPage(); if (targetPage >= 0) { // Find the next page that is not fully visible. TaskView taskView = getTaskViewAt(targetPage); while ((taskView == null || isTaskViewFullyVisible(taskView)) && targetPage - 1 >= 0) { taskView = getTaskViewAt(--targetPage); } // Target a scroll where targetPage is on left of screen but still fully visible. int lastTaskEnd = (mIsRtl ? mLastComputedGridSize.left : mLastComputedGridSize.right) + (mIsRtl ? mPageSpacing : -mPageSpacing); int normalTaskEnd = mIsRtl ? mLastComputedGridTaskSize.left : mLastComputedGridTaskSize.right; int targetScroll = getScrollForPage(targetPage) + normalTaskEnd - lastTaskEnd; // Find a page that is close to targetScroll while not over it. while (targetPage - 1 >= 0 && (mIsRtl ? getScrollForPage(targetPage - 1) < targetScroll : getScrollForPage(targetPage - 1) > targetScroll)) { targetPage--; } snapToPage(targetPage); return true; } return mAllowOverScroll; } @Override public boolean scrollRight() { if (!showAsGrid()) { return super.scrollRight(); } int targetPage = getNextPage(); if (targetPage < getChildCount()) { // Find the next page that is not fully visible. TaskView taskView = getTaskViewAt(targetPage); while ((taskView != null && isTaskViewFullyVisible(taskView)) && targetPage + 1 < getChildCount()) { taskView = getTaskViewAt(++targetPage); } snapToPage(targetPage); return true; } return mAllowOverScroll; } @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); Loading
src/com/android/launcher3/PagedView.java +15 −12 Original line number Diff line number Diff line Loading @@ -1749,9 +1749,11 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); final boolean pagesFlipped = isPageOrderFlipped(); int offset = (mAllowOverScroll ? 0 : 1); info.setScrollable(getPageCount() > offset); if (getCurrentPage() < getPageCount() - offset) { info.setScrollable(getPageCount() > 0); int primaryScroll = mOrientationHandler.getPrimaryScroll(this); if (getCurrentPage() < getPageCount() - getPanelCount() || (getCurrentPage() == getPageCount() - getPanelCount() && primaryScroll != getScrollForPage(getPageCount() - getPanelCount()))) { info.addAction(pagesFlipped ? AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD : AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); Loading @@ -1759,7 +1761,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT : AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT); } if (getCurrentPage() >= offset) { if (getCurrentPage() > 0 || (getCurrentPage() == 0 && primaryScroll != getScrollForPage(0))) { info.addAction(pagesFlipped ? AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD : AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); Loading