diff --git a/AndroidManifest.xml b/AndroidManifest.xml index e9830b4f..94b90e6a 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -38,8 +38,8 @@ THE SOFTWARE. android:label="@string/app_name"> + android:name="com.mirrorlink.android.rockscout.allow-offline-access" + android:value="true" /> + + + + + diff --git a/orig/random_active.svgz b/orig/random_active.svgz index 05c658ef..0941ce84 100644 Binary files a/orig/random_active.svgz and b/orig/random_active.svgz differ diff --git a/orig/shortcut_play.svgz b/orig/shortcut_play.svgz new file mode 100644 index 00000000..1e19e10e Binary files /dev/null and b/orig/shortcut_play.svgz differ diff --git a/orig/shortcut_random.svgz b/orig/shortcut_random.svgz new file mode 100644 index 00000000..ad595ca1 Binary files /dev/null and b/orig/shortcut_random.svgz differ diff --git a/res/drawable-hdpi/shortcut_play.png b/res/drawable-hdpi/shortcut_play.png new file mode 100644 index 00000000..5a8310fa Binary files /dev/null and b/res/drawable-hdpi/shortcut_play.png differ diff --git a/res/drawable-hdpi/shortcut_random.png b/res/drawable-hdpi/shortcut_random.png new file mode 100644 index 00000000..74b88a83 Binary files /dev/null and b/res/drawable-hdpi/shortcut_random.png differ diff --git a/res/drawable-mdpi/shortcut_play.png b/res/drawable-mdpi/shortcut_play.png new file mode 100644 index 00000000..83b32aa6 Binary files /dev/null and b/res/drawable-mdpi/shortcut_play.png differ diff --git a/res/drawable-mdpi/shortcut_random.png b/res/drawable-mdpi/shortcut_random.png new file mode 100644 index 00000000..1e4d6835 Binary files /dev/null and b/res/drawable-mdpi/shortcut_random.png differ diff --git a/res/drawable-xhdpi/shortcut_play.png b/res/drawable-xhdpi/shortcut_play.png new file mode 100644 index 00000000..2563b913 Binary files /dev/null and b/res/drawable-xhdpi/shortcut_play.png differ diff --git a/res/drawable-xhdpi/shortcut_random.png b/res/drawable-xhdpi/shortcut_random.png new file mode 100644 index 00000000..d171a280 Binary files /dev/null and b/res/drawable-xhdpi/shortcut_random.png differ diff --git a/res/drawable-xxhdpi/shortcut_play.png b/res/drawable-xxhdpi/shortcut_play.png new file mode 100644 index 00000000..92fdf335 Binary files /dev/null and b/res/drawable-xxhdpi/shortcut_play.png differ diff --git a/res/drawable-xxhdpi/shortcut_random.png b/res/drawable-xxhdpi/shortcut_random.png new file mode 100644 index 00000000..5dc2dc40 Binary files /dev/null and b/res/drawable-xxhdpi/shortcut_random.png differ diff --git a/src/ch/blinkenlights/android/vanilla/PlaybackService.java b/src/ch/blinkenlights/android/vanilla/PlaybackService.java index 83010c48..f996a3ed 100644 --- a/src/ch/blinkenlights/android/vanilla/PlaybackService.java +++ b/src/ch/blinkenlights/android/vanilla/PlaybackService.java @@ -161,6 +161,10 @@ public final class PlaybackService extends Service * when this is called. */ public static final String ACTION_PREVIOUS_SONG_AUTOPLAY = "ch.blinkenlights.android.vanilla.action.PREVIOUS_SONG_AUTOPLAY"; + /** + * Flushes the queue, switches to random mode and starts playing. + */ + public static final String ACTION_RANDOM_MIX_AUTOPLAY = "ch.blinkenlights.android.vanilla.action.RANDOM_MIX_AUTOPLAY"; /** * Change the shuffle mode. */ @@ -559,6 +563,14 @@ public final class PlaybackService extends Service cycleFinishAction(); } else if (ACTION_CYCLE_SHUFFLE.equals(action)) { cycleShuffle(); + } else if (ACTION_RANDOM_MIX_AUTOPLAY.equals(action)) { + pause(); + emptyQueue(); + setFinishAction(SongTimeline.FINISH_RANDOM); + // We can't use play() here as setFinishAction() is handled in the background. + // We therefore send a GO message to the same queue, so it will get handled as + // soon as the queue is ready. + mHandler.sendEmptyMessage(MSG_CALL_GO); } else if (ACTION_CLOSE_NOTIFICATION.equals(action)) { mForceNotificationVisible = false; pause(); diff --git a/src/ch/blinkenlights/android/vanilla/ShortcutPseudoActivity.java b/src/ch/blinkenlights/android/vanilla/ShortcutPseudoActivity.java new file mode 100644 index 00000000..c37ed53f --- /dev/null +++ b/src/ch/blinkenlights/android/vanilla/ShortcutPseudoActivity.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2017 Adrian Ulrich + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package ch.blinkenlights.android.vanilla; + + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; + + +public class ShortcutPseudoActivity extends Activity { + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + final String action = getIntent().getAction(); + switch (action) { + case PlaybackService.ACTION_TOGGLE_PLAYBACK: + case PlaybackService.ACTION_RANDOM_MIX_AUTOPLAY: + Intent intent = new Intent(this, PlaybackService.class); + intent.setAction(action); + startService(intent); + break; + default: + throw new IllegalArgumentException("No such action: " + action); + } + + finish(); + } +}