Merge "Add badge content description to TargetInfo, use in ResolverActivity" into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e76bf46ab9
@ -517,6 +517,7 @@ public class ChooserActivity extends ResolverActivity {
|
|||||||
private final ResolveInfo mBackupResolveInfo;
|
private final ResolveInfo mBackupResolveInfo;
|
||||||
private final ChooserTarget mChooserTarget;
|
private final ChooserTarget mChooserTarget;
|
||||||
private Drawable mBadgeIcon = null;
|
private Drawable mBadgeIcon = null;
|
||||||
|
private CharSequence mBadgeContentDescription;
|
||||||
private Drawable mDisplayIcon;
|
private Drawable mDisplayIcon;
|
||||||
private final Intent mFillInIntent;
|
private final Intent mFillInIntent;
|
||||||
private final int mFillInFlags;
|
private final int mFillInFlags;
|
||||||
@ -532,7 +533,9 @@ public class ChooserActivity extends ResolverActivity {
|
|||||||
if (ri != null) {
|
if (ri != null) {
|
||||||
final ActivityInfo ai = ri.activityInfo;
|
final ActivityInfo ai = ri.activityInfo;
|
||||||
if (ai != null && ai.applicationInfo != null) {
|
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;
|
mBackupResolveInfo = other.mBackupResolveInfo;
|
||||||
mChooserTarget = other.mChooserTarget;
|
mChooserTarget = other.mChooserTarget;
|
||||||
mBadgeIcon = other.mBadgeIcon;
|
mBadgeIcon = other.mBadgeIcon;
|
||||||
|
mBadgeContentDescription = other.mBadgeContentDescription;
|
||||||
mDisplayIcon = other.mDisplayIcon;
|
mDisplayIcon = other.mDisplayIcon;
|
||||||
mFillInIntent = fillInIntent;
|
mFillInIntent = fillInIntent;
|
||||||
mFillInFlags = flags;
|
mFillInFlags = flags;
|
||||||
@ -646,6 +650,11 @@ public class ChooserActivity extends ResolverActivity {
|
|||||||
return mBadgeIcon;
|
return mBadgeIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getBadgeContentDescription() {
|
||||||
|
return mBadgeContentDescription;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
|
public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
|
||||||
return new ChooserTargetInfo(this, fillInIntent, flags);
|
return new ChooserTargetInfo(this, fillInIntent, flags);
|
||||||
|
@ -931,6 +931,11 @@ public class ResolverActivity extends Activity {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getBadgeContentDescription() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
|
public TargetInfo cloneFilledIn(Intent fillInIntent, int flags) {
|
||||||
return new DisplayResolveInfo(this, fillInIntent, flags);
|
return new DisplayResolveInfo(this, fillInIntent, flags);
|
||||||
@ -1071,6 +1076,11 @@ public class ResolverActivity extends Activity {
|
|||||||
*/
|
*/
|
||||||
public Drawable getBadgeIcon();
|
public Drawable getBadgeIcon();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The content description for the badge icon
|
||||||
|
*/
|
||||||
|
public CharSequence getBadgeContentDescription();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone this target with the given fill-in information.
|
* Clone this target with the given fill-in information.
|
||||||
*/
|
*/
|
||||||
@ -1542,6 +1552,7 @@ public class ResolverActivity extends Activity {
|
|||||||
final Drawable badge = info.getBadgeIcon();
|
final Drawable badge = info.getBadgeIcon();
|
||||||
if (badge != null) {
|
if (badge != null) {
|
||||||
holder.badge.setImageDrawable(badge);
|
holder.badge.setImageDrawable(badge);
|
||||||
|
holder.badge.setContentDescription(info.getBadgeContentDescription());
|
||||||
holder.badge.setVisibility(View.VISIBLE);
|
holder.badge.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
holder.badge.setVisibility(View.GONE);
|
holder.badge.setVisibility(View.GONE);
|
||||||
|
Reference in New Issue
Block a user