From 930531f6690cb73de899eb7b1c1b6ef258fe3d92 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Thu, 16 Jun 2022 16:49:11 -0700 Subject: [PATCH] Make Talkback anounce which page is the icon being move on. Adding a third argument for the talkback string. Fix: 230593493 Test: Move an item using Talkback and it should mention the row, column and page where you can drop the item. Change-Id: Id3d4435e9ef3348278643e6e2a1cd1e8bf5157b7 --- res/values/strings.xml | 2 +- src/com/android/launcher3/CellLayout.java | 7 ++++--- src/com/android/launcher3/Workspace.java | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 847e4a8625..2addf5034e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -344,7 +344,7 @@ Move item - Move to row %1$s column %2$s + Move to row %1$s column %2$s in %3$s Move to position %1$s diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 300e7bfb11..52dfcd40a9 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -1202,13 +1202,14 @@ public class CellLayout extends ViewGroup { int row = cellY + 1; int col = workspace.mIsRtl ? mCountX - cellX : cellX + 1; int panelCount = workspace.getPanelCount(); + int screenId = workspace.getIdForScreen(this); + int pageIndex = workspace.getPageIndexForScreenId(screenId); 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); + return getContext().getString(R.string.move_to_empty_cell_description, row, col, + workspace.getPageDescription(pageIndex)); } } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 4903d7758a..c482ed5698 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -3418,7 +3418,11 @@ public class Workspace extends PagedView return getPageDescription(page); } - private String getPageDescription(int page) { + /** + * @param page page index. + * @return Description of the page at the given page index. + */ + public String getPageDescription(int page) { int nScreens = getChildCount(); int extraScreenId = mScreenOrder.indexOf(EXTRA_EMPTY_SCREEN_ID); if (extraScreenId >= 0 && nScreens > 1) {