Share
Embed
Transcript
21 slides
-
4UBUJD4IPSUDVU <activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" /> </activity> "OESPJE.BOJGFTUYNM -
4UBUJD4IPSUDVU <?xml version="1.0" encoding="utf-8"?> <shortcuts xmlns:android="http://schemas.android.com/apk/res/android"> <shortcut android:shortcutId="createEmail" android:enabled="true" android:icon="@mipmap/ic_create_email"
android:shortcutShortLabel="@string/email_shortcut_short_label" android:shortcutLongLabel="@string/email_shortcut_long_label" android:shortcutDisabledMessage="@string/disabled_message"> <intent android:action="android.intent.action.VIEW" android:targetPackage="com.example.arakitaku" android:targetClass="com.example.arakitaku.EmailActivity" /> </shortcut> </shortcuts> YNMTIPSUDVUTYNM -
%ZOBNJD4IPSUDVU ShortcutManager shortcutManager = getSystemService(ShortcutManager.class); ShortcutInfo ara_tack = new ShortcutInfo.Builder(this,
"ara_tack") .setShortLabel("ara_tack") .setLongLabel("mail to ara_tack") .setIcon(Icon.createWithResource(this, R.mipmap.ic_create_email_a)) .setIntent( EmailActivity.createIntent(this, "ara_tack") .setAction(Intent.ACTION_VIEW) ) .build(); shortcutManager.setDynamicShortcuts(Arrays.asList(ara_tack)); .BJO"DUJWJUZKBWB -
%ZOBNJD4IPSUDVU ShortcutManager shortcutManager = getSystemService(ShortcutManager.class); ShortcutInfo ara_tack = new ShortcutInfo.Builder(this,
"ara_tack") .setShortLabel("ara_tack") .setLongLabel("mail to ara_tack") .setIcon(Icon.createWithResource(this, R.mipmap.ic_create_email_a)) .setIntent( EmailActivity.createIntent(this, "ara_tack") .setAction(Intent.ACTION_VIEW) ) .build(); ShortcutInfo hashido = new ShortcutInfo.Builder(this, “hashido”)…… ShortcutInfo n_morioka = new ShortcutInfo.Builder(this, “n_morioka”)…… shortcutManager.setDynamicShortcuts(Arrays.asList( ara_tack, hashido, n_morioka )); .BJO"DUJWJUZKBWB -
%ZOBNJD4IPSUDVU ShortcutManager shortcutManager = getSystemService(ShortcutManager.class); ShortcutInfo kan = new ShortcutInfo.Builder(this,
“kan”)…… ShortcutInfo sai = new ShortcutInfo.Builder(this, “sai”)…… ShortcutInfo mobairu = new ShortcutInfo.Builder(this, “mobairu”)…… ShortcutInfo apuri = new ShortcutInfo.Builder(this, “apuri”)…… ShortcutInfo kenkyu = new ShortcutInfo.Builder(this, “kenkyu”)…… ShortcutInfo kai = new ShortcutInfo.Builder(this, “kai”)…… // IllegalArgumentException will be thrown. // Max shortcut num is 5. (include static shortcuts) shortcutManager.setDynamicShortcuts(Arrays.asList( kan, sai, mobairu, apuri, kenkyu, kai )); .BJO"DUJWJUZKBWB -
%ZOBNJD4IPSUDVU // List<ShortcutInfo> shortcutInfos; // List<String> shortcutIds; // set shortcutManager.setDynamicShortcuts(shortcutInfos);
// add shortcutManager.addDynamicShortcuts(shortcutInfos); // update shortcutManager.updateShortcuts(shortcutInfos); // remove specific shortcutManager.removeDynamicShortcuts(shortcutIds); // remove all shortcutManager.removeAllDynamicShortcuts(); // disable shortcutManager.disableShortcuts(shortcutIds); .BJO"DUJWJUZKBWB -
%ZOBNJD4IPSUDVU ShortcutManager shortcutManager = getSystemService(ShortcutManager.class); ShortcutInfo n_morioka = new ShortcutInfo.Builder(this,
"n_morioka") .setShortLabel("n_morioka") .setLongLabel("mail to n_morioka") .setIcon(Icon.createWithResource(this, R.mipmap.ic_create_email_n)) // Multiple Intent can be set .setIntents(new Intent[]{ MainActivity.createIntent(this) .setAction(Intent.ACTION_VIEW), EmailActivity.createIntent(this, "n_morioka") .setAction(Intent.ACTION_VIEW) }) .build(); shortcutManager.setDynamicShortcuts(Arrays.asList(n_morioka)); .BJO"DUJWJUZKBWB