Add shortcut manager support to Settings (2/2)

b/28298258

Locale change will be handled in future CL/ dynamic shortcut list
change using a UI will be handled in follow up CL.

Change-Id: I5468b17e8c8b32625139ab0484d5d0386be0961d
This commit is contained in:
Hyunyoung Song
2016-05-04 10:49:59 -07:00
parent 00b127b134
commit 79ec6df771
3 changed files with 152 additions and 3 deletions

View File

@@ -59,14 +59,14 @@ public class CreateShortcut extends LauncherActivity {
ResolveInfo resolveInfo = itemForPosition(position).resolveInfo;
ActivityInfo activityInfo = resolveInfo.activityInfo;
if (activityInfo.icon != 0) {
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, createIcon(activityInfo.icon));
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, createIcon(this, activityInfo.icon));
}
setResult(RESULT_OK, intent);
finish();
}
private Bitmap createIcon(int resource) {
Context context = new ContextThemeWrapper(this, android.R.style.Theme_Material);
static Bitmap createIcon(Context ctx, int resource) {
Context context = new ContextThemeWrapper(ctx, android.R.style.Theme_Material);
View view = LayoutInflater.from(context).inflate(R.layout.shortcut_badge, null);
((ImageView) view.findViewById(android.R.id.icon)).setImageResource(resource);