summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Maas <seanmaas27@gmail.com>2016-09-29 22:10:49 (GMT)
committerSean Maas <seanmaas27@gmail.com>2016-09-30 19:09:03 (GMT)
commitdf56b062c3c799fd070106f600c0203915eedff4 (patch)
tree0ca99062932758d74d500c88566bfc25147ed8ac
parent89f5a4d2c22bd1d2c17500fcee6a37e2754aff49 (diff)
downloadandroid_packages_apps_Eleven-df56b062c3c799fd070106f600c0203915eedff4.zip
android_packages_apps_Eleven-df56b062c3c799fd070106f600c0203915eedff4.tar.gz
android_packages_apps_Eleven-df56b062c3c799fd070106f600c0203915eedff4.tar.bz2
Eleven: Set preferences on play
The shake to play and lockscreen album art settings were not being set when playback started without the app, ex. with a headphone button. This caused them both to be set to false until the app was opened. Change-Id: Id15c134e9001bba62faa04266726c1e10fbfb9dd
-rw-r--r--src/com/cyanogenmod/eleven/MusicPlaybackService.java5
-rw-r--r--src/com/cyanogenmod/eleven/utils/MusicUtils.java18
2 files changed, 7 insertions, 16 deletions
diff --git a/src/com/cyanogenmod/eleven/MusicPlaybackService.java b/src/com/cyanogenmod/eleven/MusicPlaybackService.java
index 485542d..64a131e 100644
--- a/src/com/cyanogenmod/eleven/MusicPlaybackService.java
+++ b/src/com/cyanogenmod/eleven/MusicPlaybackService.java
@@ -70,6 +70,7 @@ import com.cyanogenmod.eleven.provider.SongPlayCount;
import com.cyanogenmod.eleven.service.MusicPlaybackTrack;
import com.cyanogenmod.eleven.utils.BitmapWithColors;
import com.cyanogenmod.eleven.utils.Lists;
+import com.cyanogenmod.eleven.utils.PreferenceUtils;
import com.cyanogenmod.eleven.utils.ShakeDetector;
import com.cyanogenmod.eleven.utils.SrtManager;
@@ -653,6 +654,10 @@ public class MusicPlaybackService extends Service {
mPreferences = getSharedPreferences("Service", 0);
mCardId = getCardId();
+ mShowAlbumArtOnLockscreen = mPreferences.getBoolean(
+ PreferenceUtils.SHOW_ALBUM_ART_ON_LOCKSCREEN, true);
+ setShakeToPlayEnabled(mPreferences.getBoolean(PreferenceUtils.SHAKE_TO_PLAY, true));
+
registerExternalStorageListener();
// Initialize the media player
diff --git a/src/com/cyanogenmod/eleven/utils/MusicUtils.java b/src/com/cyanogenmod/eleven/utils/MusicUtils.java
index 72aa29e..8ab4c73 100644
--- a/src/com/cyanogenmod/eleven/utils/MusicUtils.java
+++ b/src/com/cyanogenmod/eleven/utils/MusicUtils.java
@@ -113,8 +113,7 @@ public final class MusicUtils {
}
final ContextWrapper contextWrapper = new ContextWrapper(realActivity);
contextWrapper.startService(new Intent(contextWrapper, MusicPlaybackService.class));
- final ServiceBinder binder = new ServiceBinder(callback,
- contextWrapper.getApplicationContext());
+ final ServiceBinder binder = new ServiceBinder(callback);
if (contextWrapper.bindService(
new Intent().setClass(contextWrapper, MusicPlaybackService.class), binder, 0)) {
mConnectionMap.put(contextWrapper, binder);
@@ -143,16 +142,14 @@ public final class MusicUtils {
public static final class ServiceBinder implements ServiceConnection {
private final ServiceConnection mCallback;
- private final Context mContext;
/**
* Constructor of <code>ServiceBinder</code>
*
* @param context The {@link ServiceConnection} to use
*/
- public ServiceBinder(final ServiceConnection callback, final Context context) {
+ public ServiceBinder(final ServiceConnection callback) {
mCallback = callback;
- mContext = context;
}
@Override
@@ -161,7 +158,6 @@ public final class MusicUtils {
if (mCallback != null) {
mCallback.onServiceConnected(className, service);
}
- MusicUtils.initPlaybackServiceWithSettings(mContext);
}
@Override
@@ -279,16 +275,6 @@ public final class MusicUtils {
}
/**
- * Initialize playback service with values from Settings
- */
- public static void initPlaybackServiceWithSettings(final Context context) {
- MusicUtils.setShakeToPlayEnabled(
- PreferenceUtils.getInstance(context).getShakeToPlay());
- MusicUtils.setShowAlbumArtOnLockscreen(
- PreferenceUtils.getInstance(context).getShowAlbumArtOnLockscreen());
- }
-
- /**
* Set shake to play status
*/
public static void setShakeToPlayEnabled(final boolean enabled) {