Search in sources :

Example 21 with ShortcutIconResource

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);
}
Also used : Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) ShortcutIconResource(android.content.Intent.ShortcutIconResource) Intent(android.content.Intent)

Example 22 with ShortcutIconResource

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);
}
Also used : Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) ShortcutIconResource(android.content.Intent.ShortcutIconResource) Intent(android.content.Intent)

Example 23 with ShortcutIconResource

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);
    }
}
Also used : Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) ShortcutIconResource(android.content.Intent.ShortcutIconResource) Intent(android.content.Intent)

Aggregations

ShortcutIconResource (android.content.Intent.ShortcutIconResource)23 Intent (android.content.Intent)22 ArrayList (java.util.ArrayList)11 Resources (android.content.res.Resources)10 Bitmap (android.graphics.Bitmap)10 Bundle (android.os.Bundle)9 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)8 PackageManager (android.content.pm.PackageManager)7 Parcelable (android.os.Parcelable)7 RemoteException (android.os.RemoteException)5 URISyntaxException (java.net.URISyntaxException)5 Drawable (android.graphics.drawable.Drawable)4 BitmapDrawable (android.graphics.drawable.BitmapDrawable)3 ComponentName (android.content.ComponentName)2 ActivityInfo (android.content.pm.ActivityInfo)2 Paint (android.graphics.Paint)2 PaintDrawable (android.graphics.drawable.PaintDrawable)2 LauncherIntent (mobi.intuitit.android.content.LauncherIntent)2 AlertDialog (android.app.AlertDialog)1 Dialog (android.app.Dialog)1