Add 'shortcuts' support
@ -38,8 +38,8 @@ THE SOFTWARE.
|
|||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.mirrorlink.android.rockscout.allow-offline-access"
|
android:name="com.mirrorlink.android.rockscout.allow-offline-access"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="FullPlaybackActivity"
|
android:name="FullPlaybackActivity"
|
||||||
@ -54,6 +54,11 @@ THE SOFTWARE.
|
|||||||
<category android:name="android.intent.category.APP_MUSIC" />
|
<category android:name="android.intent.category.APP_MUSIC" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.shortcuts"
|
||||||
|
android:resource="@xml/shortcuts"/>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="PlaylistActivity"
|
android:name="PlaylistActivity"
|
||||||
@ -158,6 +163,10 @@ THE SOFTWARE.
|
|||||||
android:name="PermissionRequestActivity"
|
android:name="PermissionRequestActivity"
|
||||||
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
|
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="ShortcutPseudoActivity"
|
||||||
|
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
|
||||||
|
|
||||||
<activity android:name="AudioPickerActivity" android:theme="@style/PopupDialog"
|
<activity android:name="AudioPickerActivity" android:theme="@style/PopupDialog"
|
||||||
android:excludeFromRecents="true" android:exported="true" >
|
android:excludeFromRecents="true" android:exported="true" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
BIN
orig/shortcut_play.svgz
Normal file
BIN
orig/shortcut_random.svgz
Normal file
BIN
res/drawable-hdpi/shortcut_play.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
res/drawable-hdpi/shortcut_random.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
res/drawable-mdpi/shortcut_play.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
res/drawable-mdpi/shortcut_random.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
res/drawable-xhdpi/shortcut_play.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
res/drawable-xhdpi/shortcut_random.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
res/drawable-xxhdpi/shortcut_play.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
res/drawable-xxhdpi/shortcut_random.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
@ -161,6 +161,10 @@ public final class PlaybackService extends Service
|
|||||||
* when this is called.
|
* when this is called.
|
||||||
*/
|
*/
|
||||||
public static final String ACTION_PREVIOUS_SONG_AUTOPLAY = "ch.blinkenlights.android.vanilla.action.PREVIOUS_SONG_AUTOPLAY";
|
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.
|
* Change the shuffle mode.
|
||||||
*/
|
*/
|
||||||
@ -559,6 +563,14 @@ public final class PlaybackService extends Service
|
|||||||
cycleFinishAction();
|
cycleFinishAction();
|
||||||
} else if (ACTION_CYCLE_SHUFFLE.equals(action)) {
|
} else if (ACTION_CYCLE_SHUFFLE.equals(action)) {
|
||||||
cycleShuffle();
|
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)) {
|
} else if (ACTION_CLOSE_NOTIFICATION.equals(action)) {
|
||||||
mForceNotificationVisible = false;
|
mForceNotificationVisible = false;
|
||||||
pause();
|
pause();
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Adrian Ulrich <adrian@blinkenlights.ch>
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|