Added toggle to play on Bluetooth device
This commit is contained in:
parent
d2284f410d
commit
27141c1bd2
4 changed files with 36 additions and 12 deletions
|
@ -282,9 +282,9 @@ public class MusicService extends Service implements
|
|||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
String action = intent.getAction();
|
||||
Log.i(TAG, "onReceive: " + action);
|
||||
if (action != null) {
|
||||
if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) {
|
||||
if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action) &&
|
||||
PreferenceUtil.getInstance(context).bluetoothSpeaker()) {
|
||||
if (VERSION.SDK_INT >= VERSION_CODES.M) {
|
||||
if (getAudioManager().getDevices(AudioManager.GET_DEVICES_OUTPUTS).length > 0) {
|
||||
play();
|
||||
|
|
|
@ -137,6 +137,8 @@ public final class PreferenceUtil {
|
|||
|
||||
private static final String LAST_PAGE = "last_start_page";
|
||||
|
||||
private static final String BLUETOOTH_PLAYBACK = "bluetooth_playback";
|
||||
|
||||
private static final String LAST_MUSIC_CHOOSER = "last_music_chooser";
|
||||
|
||||
private static final String DEFAULT_START_PAGE = "default_start_page";
|
||||
|
@ -292,6 +294,10 @@ public final class PreferenceUtil {
|
|||
return mPreferences.getString(AUTO_DOWNLOAD_IMAGES_POLICY, "only_wifi");
|
||||
}
|
||||
|
||||
public boolean bluetoothSpeaker() {
|
||||
return mPreferences.getBoolean(BLUETOOTH_PLAYBACK, false);
|
||||
}
|
||||
|
||||
public final boolean blurredAlbumArt() {
|
||||
return mPreferences.getBoolean(BLURRED_ALBUM_ART, false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue