Added basic support for App Shortcuts

Shuffle All, Top Tracks, and Last added. Still need to fix icons and add dynamic shortcuts for playlists
This commit is contained in:
Adrian Campos 2017-03-08 23:44:27 -08:00 committed by Karim Abou Zeid
commit 33ff49de0f
7 changed files with 232 additions and 0 deletions

View file

@ -39,4 +39,6 @@
white-space: pre-wrap;
}
</string>
<string name="id_shortcuttype">com.kabouzeid.gramophone.appshortcuts.ShortcutType</string>
</resources>

View file

@ -275,4 +275,16 @@
<string name="copied_device_info_to_clipboard">Copied device info to clipboard.</string>
<string name="your_account_data_is_only_used_for_authentication">Your account data is only used for authentication.</string>
<string name="you_will_be_forwarded_to_the_issue_tracker_website">You will be forwarded to the issue tracker website.</string>
<!-- App Shortcuts -->
<string name="appshortcut_shuffleall_long">@string/action_shuffle_all</string>
<string name="appshortcut_shuffleall_short">Shuffle</string>
<string name="appshortcut_toptracks_long">@string/my_top_tracks</string>
<string name="appshortcut_toptracks_short">Top Tracks</string>
<string name="appshortcut_lastadded_long">@string/last_added</string>
<string name="appshortcut_lastadded_short">@string/last_added</string>
<string name="error_launching_shortcut">Error launching shortcut.</string>
</resources>

View file

@ -0,0 +1,55 @@
<shortcuts
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:targetApi="25">
<shortcut
android:shortcutId="shuffle_all"
android:enabled="true"
android:icon="@drawable/ic_shuffle_white_24dp"
android:shortcutShortLabel="@string/appshortcut_shuffleall_short"
android:shortcutLongLabel="@string/appshortcut_shuffleall_long">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="com.kabouzeid.gramophone.appshortcuts.AppShortcutLauncherActivity"
android:targetPackage="${applicationId}">
<extra
android:name="com.kabouzeid.gramophone.appshortcuts.ShortcutType"
android:value="SHUFFLE_ALL" />
</intent>
</shortcut>
<shortcut
android:shortcutId="top_tracks"
android:enabled="true"
android:icon="@drawable/ic_trending_up_white_24dp"
android:shortcutShortLabel="@string/appshortcut_toptracks_short"
android:shortcutLongLabel="@string/appshortcut_toptracks_long"
>
<intent
android:action="android.intent.action.VIEW"
android:targetClass="com.kabouzeid.gramophone.appshortcuts.AppShortcutLauncherActivity"
android:targetPackage="${applicationId}">
<extra
android:name="com.kabouzeid.gramophone.appshortcuts.ShortcutType"
android:value="TOP_TRACKS" />
</intent>
</shortcut>
<shortcut
android:shortcutId="last_added"
android:enabled="true"
android:icon="@drawable/ic_library_add_white_24dp"
android:shortcutShortLabel="@string/appshortcut_lastadded_short"
android:shortcutLongLabel="@string/appshortcut_lastadded_long"
>
<intent
android:action="android.intent.action.VIEW"
android:targetClass="com.kabouzeid.gramophone.appshortcuts.AppShortcutLauncherActivity"
android:targetPackage="${applicationId}">
<extra
android:name="com.kabouzeid.gramophone.appshortcuts.ShortcutType"
android:value="LAST_ADDED" />
</intent>
</shortcut>
</shortcuts>