Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 161ed5ad authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Announce folder content size with folder title" into ub-launcher3-rvc-dev

parents d2d9837b 1150ab38
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -172,8 +172,10 @@
    <string name="folder_closed">Folder closed</string>
    <!-- Folder renamed format -->
    <string name="folder_renamed">Folder renamed to <xliff:g id="name" example="Games">%1$s</xliff:g></string>
    <!-- Folder name format -->
    <string name="folder_name_format">Folder: <xliff:g id="name" example="Games">%1$s</xliff:g></string>
    <!-- Folder name format when folder has less than 4 items -->
    <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 -->
    <!-- Text for widget add button -->
+17 −3
Original line number Diff line number Diff line
@@ -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);
        }
    }
}