diff options
author | Alex Chau <alexchau@google.com> | 2022-02-24 11:51:59 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-02-24 11:51:59 +0000 |
commit | 1c01af74c6c3c8cc37eef08749ba39d0bba20b33 (patch) | |
tree | 0555520cc6acbbefc79ba5e4fb12cda3fa406594 /src | |
parent | 57eab459967d151f3f73e09886bf392f1a2c7ad5 (diff) | |
parent | 2dacbee028bf8d236bfb23d49b4ffe2a8f50aee4 (diff) | |
download | Launcher3-1c01af74c6c3c8cc37eef08749ba39d0bba20b33.tar.gz |
Merge "Fix incorrect accessibility announcement on two panel home" into tm-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/CellLayout.java | 23 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 5 |
2 files changed, 21 insertions, 7 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 11f58e7d87..ad4cae4440 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -1169,9 +1169,7 @@ public class CellLayout extends ViewGroup { // Apply local extracted color if the DragView is an AppWidgetHostViewDrawable. View view = dragObject.dragView.getContentView(); if (view instanceof LauncherAppWidgetHostView) { - Launcher launcher = Launcher.getLauncher(getContext()); - Workspace workspace = launcher.getWorkspace(); - int screenId = workspace.getIdForScreen(this); + int screenId = getWorkspace().getIdForScreen(this); cellToRect(targetCell[0], targetCell[1], spanX, spanY, mTempRect); ((LauncherAppWidgetHostView) view).handleDrag(mTempRect, this, screenId); @@ -1184,11 +1182,24 @@ public class CellLayout extends ViewGroup { return getContext().getString(R.string.move_to_hotseat_position, Math.max(cellX, cellY) + 1); } else { - return getContext().getString(R.string.move_to_empty_cell, - cellY + 1, cellX + 1); + Workspace workspace = getWorkspace(); + int row = cellY + 1; + int col = workspace.mIsRtl ? mCountX - cellX : cellX + 1; + int panelCount = workspace.getPanelCount(); + if (panelCount > 1) { + // Increment the column if the target is on the right side of a two panel home + int screenId = workspace.getIdForScreen(this); + int pageIndex = workspace.getPageIndexForScreenId(screenId); + col += (pageIndex % panelCount) * mCountX; + } + return getContext().getString(R.string.move_to_empty_cell, row, col); } } + private Workspace getWorkspace() { + return Launcher.cast(mActivity).getWorkspace(); + } + public void clearDragOutlines() { final int oldIndex = mDragOutlineCurrent; mDragOutlineAnims[oldIndex].animateOut(); @@ -2243,7 +2254,7 @@ public class CellLayout extends ViewGroup { private void commitTempPlacement(View dragView) { mTmpOccupied.copyTo(mOccupied); - int screenId = Launcher.cast(mActivity).getWorkspace().getIdForScreen(this); + int screenId = getWorkspace().getIdForScreen(this); int container = Favorites.CONTAINER_DESKTOP; if (mContainerType == HOTSEAT) { diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 16fecde6fd..b3f5c0334f 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -3398,7 +3398,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator> // When the workspace is not loaded, we do not know how many screen will be bound. return getContext().getString(R.string.home_screen); } - return getContext().getString(R.string.workspace_scroll_format, page + 1, nScreens); + int panelCount = getPanelCount(); + int currentPage = (page / panelCount) + 1; + int totalPages = nScreens / panelCount + nScreens % panelCount; + return getContext().getString(R.string.workspace_scroll_format, currentPage, totalPages); } /** |