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();
}