Example usage for android.content Intent ACTION_CREATE_SHORTCUT

List of usage examples for android.content Intent ACTION_CREATE_SHORTCUT

Introduction

In this page you can find the example usage for android.content Intent ACTION_CREATE_SHORTCUT.

Prototype

String ACTION_CREATE_SHORTCUT

To view the source code for android.content Intent ACTION_CREATE_SHORTCUT.

Click Source Link

Document

Activity Action: Creates a shortcut.

Usage

From source file:com.android.leanlauncher.LauncherTransitionable.java

/**
 * Process a shortcut drop./*  w w  w  .  jav a  2s.c  om*/
 *
 * @param componentName The name of the component
 * @param cell          The cell it should be added to, optional
 */
void processShortcutFromDrop(ComponentName componentName, long container, int[] cell, int[] loc) {
    resetAddInfo();
    mPendingAddInfo.container = container;
    mPendingAddInfo.dropPos = loc;

    if (cell != null) {
        mPendingAddInfo.cellX = cell[0];
        mPendingAddInfo.cellY = cell[1];
    }

    Intent createShortcutIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
    createShortcutIntent.setComponent(componentName);
    processShortcut(createShortcutIntent);
}

From source file:com.android.launcher2.Launcher.java

/**
 * Process a shortcut drop.//ww  w .j  a  v  a  2 s  .  com
 *
 * @param componentName The name of the component
 * @param screen The screen where it should be added
 * @param cell The cell it should be added to, optional
 * @param position The location on the screen where it was dropped, optional
 */
void processShortcutFromDrop(ComponentName componentName, long container, int screen, int[] cell, int[] loc) {
    resetAddInfo();
    mPendingAddInfo.container = container;
    mPendingAddInfo.screen = screen;
    mPendingAddInfo.dropPos = loc;

    if (cell != null) {
        mPendingAddInfo.cellX = cell[0];
        mPendingAddInfo.cellY = cell[1];
    }

    Intent createShortcutIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
    createShortcutIntent.setComponent(componentName);
    processShortcut(createShortcutIntent);
}

From source file:com.android.soma.Launcher.java

/**
 * Process a shortcut drop./*from  ww w .j  ava2s .com*/
 *
 * @param componentName The name of the component
 * @param screenId The ID of the screen where it should be added
 * @param cell The cell it should be added to, optional
 * @param position The location on the screen where it was dropped, optional
 */
void processShortcutFromDrop(ComponentName componentName, long container, long screenId, int[] cell,
        int[] loc) {
    resetAddInfo();
    mPendingAddInfo.container = container;
    mPendingAddInfo.screenId = screenId;
    mPendingAddInfo.dropPos = loc;

    if (cell != null) {
        mPendingAddInfo.cellX = cell[0];
        mPendingAddInfo.cellY = cell[1];
    }

    Intent createShortcutIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
    createShortcutIntent.setComponent(componentName);
    processShortcut(createShortcutIntent);
}

From source file:com.klinker.android.launcher.launcher3.Launcher.java

/**
 * Process a shortcut drop.//w ww  . j a v a2  s  . c  o m
 *
 * @param componentName The name of the component
 * @param screenId The ID of the screen where it should be added
 * @param cell The cell it should be added to, optional
 */
private void processShortcutFromDrop(ComponentName componentName, long container, long screenId, int[] cell) {
    resetAddInfo();
    mPendingAddInfo.container = container;
    mPendingAddInfo.screenId = screenId;
    mPendingAddInfo.dropPos = null;

    if (cell != null) {
        mPendingAddInfo.cellX = cell[0];
        mPendingAddInfo.cellY = cell[1];
    }

    Intent createShortcutIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
    createShortcutIntent.setComponent(componentName);
    Utilities.startActivityForResultSafely(this, createShortcutIntent, REQUEST_CREATE_SHORTCUT);
}

From source file:com.android.launcher3.Launcher.java

/**
 * Process a shortcut drop.//  w  ww. ja va2  s.  c om
 */
private void processShortcutFromDrop(PendingAddItemInfo info) {
    Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT).setComponent(info.componentName);
    setWaitingForResult(PendingRequestArgs.forIntent(REQUEST_CREATE_SHORTCUT, intent, info));
    Utilities.startActivityForResultSafely(this, intent, REQUEST_CREATE_SHORTCUT);
}

From source file:com.cognizant.trumobi.PersonaLauncher.java

private void pickShortcut(int requestCode, int title) {
    Bundle bundle = new Bundle();
    /*//from w w  w  .ja va2s .  c o  m
          ArrayList<String> shortcutNames = new ArrayList<String>();
          shortcutNames.add(getString(R.string.group_applications));
          bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames);
            
          ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>();
          shortcutIcons.add(ShortcutIconResource.fromContext(
    PersonaLauncher.this, R.drawable.pr_ic_launcher_application));
          bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
    shortcutIcons);*/
    //   Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
    Intent pickIntent = new Intent();

    String ShortCutName = new String(getString(R.string.group_applications));
    bundle.putString(Intent.EXTRA_SHORTCUT_NAME, ShortCutName);

    pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT));
    pickIntent.putExtra(Intent.EXTRA_TITLE, getString(R.string.group_applications));
    pickIntent.putExtras(bundle);
    processShortcut(pickIntent, REQUEST_PICK_APPLICATION, REQUEST_CREATE_SHORTCUT);
    //startActivityForResult(pickIntent, requestCode);
}