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

Commit ce5d92c3 authored by Alan Viverette's avatar Alan Viverette
Browse files

Add badge content description to TargetInfo, use in ResolverActivity

Bug: 22667344
Change-Id: Iee241b9179c74a15b1c635cf90d2f96f6f7b31cd
parent 5d6a2d38
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -517,6 +517,7 @@ public class ChooserActivity extends ResolverActivity {
        private final ResolveInfo mBackupResolveInfo;
        private final ChooserTarget mChooserTarget;
        private Drawable mBadgeIcon = null;
        private CharSequence mBadgeContentDescription;
        private Drawable mDisplayIcon;
        private final Intent mFillInIntent;
        private final int mFillInFlags;
@@ -532,7 +533,9 @@ public class ChooserActivity extends ResolverActivity {
                if (ri != null) {
                    final ActivityInfo ai = ri.activityInfo;
                    if (ai != null && ai.applicationInfo != null) {
                        mBadgeIcon = getPackageManager().getApplicationIcon(ai.applicationInfo);
                        final PackageManager pm = getPackageManager();
                        mBadgeIcon = pm.getApplicationIcon(ai.applicationInfo);
                        mBadgeContentDescription = pm.getApplicationLabel(ai.applicationInfo);
                    }
                }
            }
@@ -555,6 +558,7 @@ public class ChooserActivity extends ResolverActivity {
            mBackupResolveInfo = other.mBackupResolveInfo;
            mChooserTarget = other.mChooserTarget;
            mBadgeIcon = other.mBadgeIcon;
            mBadgeContentDescription = other.mBadgeContentDescription;
            mDisplayIcon = other.mDisplayIcon;
            mFillInIntent = fillInIntent;
            mFillInFlags = flags;
@@ -646,6 +650,11 @@ public class ChooserActivity extends ResolverActivity {
            return mBadgeIcon;
        }

        @Override
        public CharSequence getBadgeContentDescription() {
            return mBadgeContentDescription;
        }

        @Override
        public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
            return new ChooserTargetInfo(this, fillInIntent, flags);
+11 −0
Original line number Diff line number Diff line
@@ -931,6 +931,11 @@ public class ResolverActivity extends Activity {
            return null;
        }

        @Override
        public CharSequence getBadgeContentDescription() {
            return null;
        }

        @Override
        public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
            return new DisplayResolveInfo(this, fillInIntent, flags);
@@ -1071,6 +1076,11 @@ public class ResolverActivity extends Activity {
         */
        public Drawable getBadgeIcon();

        /**
         * @return The content description for the badge icon
         */
        public CharSequence getBadgeContentDescription();

        /**
         * Clone this target with the given fill-in information.
         */
@@ -1542,6 +1552,7 @@ public class ResolverActivity extends Activity {
                final Drawable badge = info.getBadgeIcon();
                if (badge != null) {
                    holder.badge.setImageDrawable(badge);
                    holder.badge.setContentDescription(info.getBadgeContentDescription());
                    holder.badge.setVisibility(View.VISIBLE);
                } else {
                    holder.badge.setVisibility(View.GONE);