Fix for bug where Talkback announce Folder:null

Bug: 385046797
Test: Verified this works locally.
Flag: EXEMPT bug fix
Change-Id: I9ad23f351df078b6bd40ff861e13b9109bfa8993
This commit is contained in:
Stefan Andonian committed 2024-12-30 14:01:28 -08:00
1 parent bf5e7e867f
commit 25283f0f45
2 files changed
+6

No files matched your search

+2
View File
@@ -308,6 +308,8 @@
<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>
<!-- Accessibility announement for unnamed folders -->
<string name="unnamed_folder">Unnamed folder</string>
<!-- App pair accessibility -->
<!-- App pair name -->
@@ -816,6 +816,10 @@ public class FolderIcon extends FrameLayout implements FolderListener, FloatingI
* Returns a formatted accessibility title for folder
*/
public String getAccessiblityTitle(CharSequence title) {
if (title == null) {
// Avoids "Talkback -> Folder: null" announcement.
title = getContext().getString(R.string.unnamed_folder);
}
int size = mInfo.getContents().size();
if (size < MAX_NUM_ITEMS_IN_PREVIEW) {
return getContext().getString(R.string.folder_name_format_exact, title, size);