Search in sources :

Example 1 with Shortcut

use of com.stardust.scriptdroid.external.shortcut.Shortcut in project Auto.js by hyb1996.

the class ShortcutCreateActivity method createShortcut.

private void createShortcut() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && mUseAndroidNShortcut.isChecked()) {
        createShortcutForAndroidN();
        return;
    }
    Shortcut shortcut = new Shortcut(this);
    if (mIsDefaultIcon) {
        shortcut.iconRes(R.drawable.ic_node_js_black);
    } else {
        Bitmap bitmap = BitmapTool.drawableToBitmap(mIcon.getDrawable());
        shortcut.icon(bitmap);
    }
    shortcut.name(mName.getText().toString()).targetClass(ShortcutActivity.class).extras(new Intent().putExtra(ScriptIntents.EXTRA_KEY_PATH, mScriptFile.getPath())).send();
}
Also used : Bitmap(android.graphics.Bitmap) Shortcut(com.stardust.scriptdroid.external.shortcut.Shortcut) Intent(android.content.Intent)

Aggregations

Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 Shortcut (com.stardust.scriptdroid.external.shortcut.Shortcut)1