use of android.content.Intent.ShortcutIconResource in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ShortcutPickHelper method pickShortcut.
public void pickShortcut(String[] names, ShortcutIconResource[] icons, int fragmentId) {
Bundle bundle = new Bundle();
ArrayList<String> shortcutNames = new ArrayList<String>();
if (names != null) {
for (String s : names) {
shortcutNames.add(s);
}
}
shortcutNames.add(mParent.getString(R.string.profile_applist_title));
shortcutNames.add(mParent.getString(R.string.picker_activities));
bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames);
ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>();
if (icons != null) {
for (ShortcutIconResource s : icons) {
shortcutIcons.add(s);
}
}
shortcutIcons.add(ShortcutIconResource.fromContext(mParent, android.R.drawable.sym_def_app_icon));
shortcutIcons.add(ShortcutIconResource.fromContext(mParent, R.drawable.activities_icon));
bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIcons);
Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT));
pickIntent.putExtra(Intent.EXTRA_TITLE, mParent.getText(R.string.select_custom_app_title));
pickIntent.putExtras(bundle);
lastFragmentId = fragmentId;
startFragmentOrActivity(pickIntent, REQUEST_PICK_SHORTCUT);
}
use of android.content.Intent.ShortcutIconResource in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ShortcutPickHelper method pickShortcut.
public void pickShortcut(String[] names, ShortcutIconResource[] icons, int fragmentId) {
Bundle bundle = new Bundle();
ArrayList<String> shortcutNames = new ArrayList<String>();
if (names != null) {
for (String s : names) {
shortcutNames.add(s);
}
}
shortcutNames.add(mParent.getString(R.string.profile_applist_title));
shortcutNames.add(mParent.getString(R.string.picker_activities));
bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames);
ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>();
if (icons != null) {
for (ShortcutIconResource s : icons) {
shortcutIcons.add(s);
}
}
shortcutIcons.add(ShortcutIconResource.fromContext(mParent, android.R.drawable.sym_def_app_icon));
shortcutIcons.add(ShortcutIconResource.fromContext(mParent, R.drawable.activities_icon));
bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIcons);
Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT));
pickIntent.putExtra(Intent.EXTRA_TITLE, mParent.getText(R.string.select_custom_app_title));
pickIntent.putExtras(bundle);
lastFragmentId = fragmentId;
startFragmentOrActivity(pickIntent, REQUEST_PICK_SHORTCUT);
}
use of android.content.Intent.ShortcutIconResource in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SlimShortcutPickerHelper method pickShortcut.
public void pickShortcut(int fragmentId, boolean fullAppsOnly) {
lastFragmentId = fragmentId;
if (fullAppsOnly) {
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent);
startFragmentOrActivity(pickIntent, REQUEST_PICK_APPLICATION);
} else {
Bundle bundle = new Bundle();
ArrayList<String> shortcutNames = new ArrayList<String>();
shortcutNames.add(mParent.getString(R.string.shortcuts_applications));
bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames);
ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>();
shortcutIcons.add(ShortcutIconResource.fromContext(mParent, android.R.drawable.sym_def_app_icon));
bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIcons);
Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT));
pickIntent.putExtra(Intent.EXTRA_TITLE, mParent.getText(R.string.shortcuts_select_custom_app_title));
pickIntent.putExtras(bundle);
startFragmentOrActivity(pickIntent, REQUEST_PICK_SHORTCUT);
}
}
Aggregations