Loading res/values/strings.xml +4 −2 Original line number Original line Diff line number Diff line Loading @@ -172,8 +172,10 @@ <string name="folder_closed">Folder closed</string> <string name="folder_closed">Folder closed</string> <!-- Folder renamed format --> <!-- Folder renamed format --> <string name="folder_renamed">Folder renamed to <xliff:g id="name" example="Games">%1$s</xliff:g></string> <string name="folder_renamed">Folder renamed to <xliff:g id="name" example="Games">%1$s</xliff:g></string> <!-- Folder name format --> <!-- Folder name format when folder has less than 4 items --> <string name="folder_name_format">Folder: <xliff:g id="name" example="Games">%1$s</xliff:g></string> <string name="folder_name_format_exact">Folder: <xliff:g id="name" example="Games">%1$s</xliff:g>, <xliff:g id="size" example="2">%2$d</xliff:g> items</string> <!-- Folder name format when folder has 4 or more items shown in preview--> <string name="folder_name_format_overflow">Folder: <xliff:g id="name" example="Games">%1$s</xliff:g>, <xliff:g id="size" example="2">%2$d</xliff:g> or more items</string> <!-- Strings for the customization mode --> <!-- Strings for the customization mode --> <!-- Text for widget add button --> <!-- Text for widget add button --> Loading src/com/android/launcher3/folder/FolderIcon.java +17 −3 Original line number Original line Diff line number Diff line Loading @@ -201,8 +201,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel icon.mActivity = activity; icon.mActivity = activity; icon.mDotRenderer = grid.mDotRendererWorkSpace; icon.mDotRenderer = grid.mDotRendererWorkSpace; icon.setContentDescription( icon.setContentDescription(icon.getAccessiblityTitle(folderInfo.title)); group.getContext().getString(R.string.folder_name_format, folderInfo.title)); // Keep the notification dot up to date with the sum of all the content's dots. // Keep the notification dot up to date with the sum of all the content's dots. FolderDotInfo folderDotInfo = new FolderDotInfo(); FolderDotInfo folderDotInfo = new FolderDotInfo(); Loading Loading @@ -665,6 +664,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel mDotInfo.addDotInfo(mActivity.getDotInfoForItem(item)); mDotInfo.addDotInfo(mActivity.getDotInfoForItem(item)); boolean isDotted = mDotInfo.hasDot(); boolean isDotted = mDotInfo.hasDot(); updateDotScale(wasDotted, isDotted); updateDotScale(wasDotted, isDotted); setContentDescription(getAccessiblityTitle(mInfo.title)); invalidate(); invalidate(); requestLayout(); requestLayout(); } } Loading @@ -675,13 +675,14 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel mDotInfo.subtractDotInfo(mActivity.getDotInfoForItem(item)); mDotInfo.subtractDotInfo(mActivity.getDotInfoForItem(item)); boolean isDotted = mDotInfo.hasDot(); boolean isDotted = mDotInfo.hasDot(); updateDotScale(wasDotted, isDotted); updateDotScale(wasDotted, isDotted); setContentDescription(getAccessiblityTitle(mInfo.title)); invalidate(); invalidate(); requestLayout(); requestLayout(); } } public void onTitleChanged(CharSequence title) { public void onTitleChanged(CharSequence title) { mFolderName.setText(title); mFolderName.setText(title); setContentDescription(getContext().getString(R.string.folder_name_format, title)); setContentDescription(getAccessiblityTitle(title)); } } @Override @Override Loading Loading @@ -775,4 +776,17 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel public void getWorkspaceVisualDragBounds(Rect bounds) { public void getWorkspaceVisualDragBounds(Rect bounds) { getPreviewBounds(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); } } } } Loading
res/values/strings.xml +4 −2 Original line number Original line Diff line number Diff line Loading @@ -172,8 +172,10 @@ <string name="folder_closed">Folder closed</string> <string name="folder_closed">Folder closed</string> <!-- Folder renamed format --> <!-- Folder renamed format --> <string name="folder_renamed">Folder renamed to <xliff:g id="name" example="Games">%1$s</xliff:g></string> <string name="folder_renamed">Folder renamed to <xliff:g id="name" example="Games">%1$s</xliff:g></string> <!-- Folder name format --> <!-- Folder name format when folder has less than 4 items --> <string name="folder_name_format">Folder: <xliff:g id="name" example="Games">%1$s</xliff:g></string> <string name="folder_name_format_exact">Folder: <xliff:g id="name" example="Games">%1$s</xliff:g>, <xliff:g id="size" example="2">%2$d</xliff:g> items</string> <!-- Folder name format when folder has 4 or more items shown in preview--> <string name="folder_name_format_overflow">Folder: <xliff:g id="name" example="Games">%1$s</xliff:g>, <xliff:g id="size" example="2">%2$d</xliff:g> or more items</string> <!-- Strings for the customization mode --> <!-- Strings for the customization mode --> <!-- Text for widget add button --> <!-- Text for widget add button --> Loading
src/com/android/launcher3/folder/FolderIcon.java +17 −3 Original line number Original line Diff line number Diff line Loading @@ -201,8 +201,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel icon.mActivity = activity; icon.mActivity = activity; icon.mDotRenderer = grid.mDotRendererWorkSpace; icon.mDotRenderer = grid.mDotRendererWorkSpace; icon.setContentDescription( icon.setContentDescription(icon.getAccessiblityTitle(folderInfo.title)); group.getContext().getString(R.string.folder_name_format, folderInfo.title)); // Keep the notification dot up to date with the sum of all the content's dots. // Keep the notification dot up to date with the sum of all the content's dots. FolderDotInfo folderDotInfo = new FolderDotInfo(); FolderDotInfo folderDotInfo = new FolderDotInfo(); Loading Loading @@ -665,6 +664,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel mDotInfo.addDotInfo(mActivity.getDotInfoForItem(item)); mDotInfo.addDotInfo(mActivity.getDotInfoForItem(item)); boolean isDotted = mDotInfo.hasDot(); boolean isDotted = mDotInfo.hasDot(); updateDotScale(wasDotted, isDotted); updateDotScale(wasDotted, isDotted); setContentDescription(getAccessiblityTitle(mInfo.title)); invalidate(); invalidate(); requestLayout(); requestLayout(); } } Loading @@ -675,13 +675,14 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel mDotInfo.subtractDotInfo(mActivity.getDotInfoForItem(item)); mDotInfo.subtractDotInfo(mActivity.getDotInfoForItem(item)); boolean isDotted = mDotInfo.hasDot(); boolean isDotted = mDotInfo.hasDot(); updateDotScale(wasDotted, isDotted); updateDotScale(wasDotted, isDotted); setContentDescription(getAccessiblityTitle(mInfo.title)); invalidate(); invalidate(); requestLayout(); requestLayout(); } } public void onTitleChanged(CharSequence title) { public void onTitleChanged(CharSequence title) { mFolderName.setText(title); mFolderName.setText(title); setContentDescription(getContext().getString(R.string.folder_name_format, title)); setContentDescription(getAccessiblityTitle(title)); } } @Override @Override Loading Loading @@ -775,4 +776,17 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel public void getWorkspaceVisualDragBounds(Rect bounds) { public void getWorkspaceVisualDragBounds(Rect bounds) { getPreviewBounds(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); } } } }