diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2efa66f2c1..935bb40fb3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -172,8 +172,10 @@
Folder closed
Folder renamed to %1$s
-
- Folder: %1$s
+
+ Folder: %1$s, %2$d items
+
+ Folder: %1$s, %2$d or more items
diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java
index 098ce50750..2be5883e4a 100644
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -201,8 +201,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
icon.mActivity = activity;
icon.mDotRenderer = grid.mDotRendererWorkSpace;
- icon.setContentDescription(
- group.getContext().getString(R.string.folder_name_format, folderInfo.title));
+ icon.setContentDescription(icon.getAccessiblityTitle(folderInfo.title));
// Keep the notification dot up to date with the sum of all the content's dots.
FolderDotInfo folderDotInfo = new FolderDotInfo();
@@ -665,6 +664,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
mDotInfo.addDotInfo(mActivity.getDotInfoForItem(item));
boolean isDotted = mDotInfo.hasDot();
updateDotScale(wasDotted, isDotted);
+ setContentDescription(getAccessiblityTitle(mInfo.title));
invalidate();
requestLayout();
}
@@ -675,13 +675,14 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
mDotInfo.subtractDotInfo(mActivity.getDotInfoForItem(item));
boolean isDotted = mDotInfo.hasDot();
updateDotScale(wasDotted, isDotted);
+ setContentDescription(getAccessiblityTitle(mInfo.title));
invalidate();
requestLayout();
}
public void onTitleChanged(CharSequence title) {
mFolderName.setText(title);
- setContentDescription(getContext().getString(R.string.folder_name_format, title));
+ setContentDescription(getAccessiblityTitle(title));
}
@Override
@@ -775,4 +776,17 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
public void getWorkspaceVisualDragBounds(Rect bounds) {
getPreviewBounds(bounds);
}
+
+ /**
+ * Returns a formatted accessibility title for folder
+ */
+ public String getAccessiblityTitle(CharSequence title) {
+ int size = mInfo.contents.size();
+ if (size < MAX_NUM_ITEMS_IN_PREVIEW) {
+ return getContext().getString(R.string.folder_name_format_exact, title, size);
+ } else {
+ return getContext().getString(R.string.folder_name_format_overflow, title,
+ MAX_NUM_ITEMS_IN_PREVIEW);
+ }
+ }
}