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

Commit 01453e85 authored by Kenny Guy's avatar Kenny Guy
Browse files

Add content description to bagded icons.

Enabled accesibility so that icons badged by the
managed profile have a content description
that is different to the non-bagdged version.

Bug: 15106236
Change-Id: Id483273173d9539916eebd59111d179087526be3
parent 74b68a40
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -125,6 +125,9 @@ public class BubbleTextView extends TextView {
        setCompoundDrawables(null, iconDrawable, null, null);
        setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
        setText(info.title);
        if (info.contentDescription != null) {
            setContentDescription(info.contentDescription);
        }
        setTag(info);
        if (info.isPromise()) {
            setState(ShortcutInfo.PACKAGE_STATE_UNKNOWN); // TODO: persist this state somewhere
+3 −0
Original line number Diff line number Diff line
@@ -571,6 +571,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
        textView.setCompoundDrawables(null,
                Utilities.createIconDrawable(item.getIcon(mIconCache)), null, null);
        textView.setText(item.title);
        if (item.contentDescription != null) {
            textView.setContentDescription(item.contentDescription);
        }
        textView.setTag(item);
        textView.setTextColor(getResources().getColor(R.color.folder_items_text_color));
        textView.setShadowsEnabled(false);
+4 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public class IconCache {
    private static class CacheEntry {
        public Bitmap icon;
        public String title;
        public String contentDescription;
    }

    private static class CacheKey {
@@ -240,6 +241,7 @@ public class IconCache {

            application.title = entry.title;
            application.iconBitmap = entry.icon;
            application.contentDescription = entry.contentDescription;
        }
    }

@@ -262,6 +264,7 @@ public class IconCache {
            CacheEntry entry = cacheLocked(component, launcherActInfo, null, user);
            if (title != null) {
                entry.title = title;
                entry.contentDescription = mUserManager.getBadgedLabelForUser(title, user);
            }
            return entry.icon;
        }
@@ -310,6 +313,7 @@ public class IconCache {
                    }
                }

                entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);
                entry.icon = Utilities.createIconBitmap(
                        info.getBadgedIcon(mIconDpi), mContext);
            } else {
+7 −0
Original line number Diff line number Diff line
@@ -107,6 +107,11 @@ public class ItemInfo {
     */
    CharSequence title;

    /**
     * Content description of the item.
     */
    String contentDescription;

    /**
     * The position of the item in a drag-and-drop operation.
     */
@@ -115,6 +120,7 @@ public class ItemInfo {
    UserHandleCompat user;

    ItemInfo() {
        user = UserHandleCompat.myUserHandle();
    }

    ItemInfo(ItemInfo info) {
@@ -127,6 +133,7 @@ public class ItemInfo {
        itemType = info.itemType;
        container = info.container;
        user = info.user;
        contentDescription = info.contentDescription;
        // tempdebug:
        LauncherModel.checkItemInfo(this);
    }
+3 −1
Original line number Diff line number Diff line
@@ -4674,7 +4674,9 @@ public class Launcher extends Activity

    public ItemInfo createShortcutDragInfo(Intent shortcutIntent, CharSequence caption,
            Bitmap icon, UserHandleCompat user) {
        return new ShortcutInfo(shortcutIntent, caption, icon, user);
        UserManagerCompat userManager = UserManagerCompat.getInstance(this);
        String contentDescription = userManager.getBadgedLabelForUser(caption.toString(), user);
        return new ShortcutInfo(shortcutIntent, caption, contentDescription, icon, user);
    }

    protected void moveWorkspaceToDefaultScreen() {
Loading