diff options
author | Scott Jackson <daneren2005@gmail.com> | 2012-11-27 23:20:40 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2012-11-27 23:20:40 -0800 |
commit | b75e4654a818cd4109d6411a8ea08a44e50b2cf0 (patch) | |
tree | ed0d4c3676fe6f341701e0e6881746ddf758cffc | |
parent | 1c6ccd371250da82a2d6ab1296904d6e1e4fa2c1 (diff) | |
download | dsub-b75e4654a818cd4109d6411a8ea08a44e50b2cf0.tar.gz dsub-b75e4654a818cd4109d6411a8ea08a44e50b2cf0.tar.bz2 dsub-b75e4654a818cd4109d6411a8ea08a44e50b2cf0.zip |
Cache whether or not the user wants the screen to stay on
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 10 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/util/Constants.java | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index aae4829a..a718ad9d 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -59,6 +59,7 @@ import android.os.Handler; import android.os.IBinder; import android.os.PowerManager; import android.util.Log; +import github.daneren2005.dsub.activity.SubsonicTabActivity; /** * @author Sindre Mehus @@ -99,7 +100,7 @@ public class DownloadServiceImpl extends Service implements DownloadService { private static DownloadService instance; private String suggestedPlaylistName; private PowerManager.WakeLock wakeLock; - private boolean keepScreenOn = false; + private boolean keepScreenOn; private static boolean equalizerAvailable; private static boolean visualizerAvailable; @@ -175,6 +176,8 @@ public class DownloadServiceImpl extends Service implements DownloadService { SharedPreferences prefs = Util.getPreferences(this); timerDuration = Integer.parseInt(prefs.getString(Constants.PREFERENCES_KEY_SLEEP_TIMER_DURATION, "60")); sleepTimer = null; + + keepScreenOn = prefs.getBoolean(Constants.PREFERENCES_KEY_KEEP_SCREEN_ON, false); instance = this; lifecycleSupport.onCreate(); @@ -335,6 +338,11 @@ public class DownloadServiceImpl extends Service implements DownloadService { @Override public void setKeepScreenOn(boolean keepScreenOn) { this.keepScreenOn = keepScreenOn; + + SharedPreferences prefs = Util.getPreferences(this); + SharedPreferences.Editor editor = prefs.edit(); + editor.putBoolean(Constants.PREFERENCES_KEY_KEEP_SCREEN_ON, keepScreenOn); + editor.commit(); } @Override diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java index 42acde16..4d48b6d4 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java @@ -83,6 +83,7 @@ public final class Constants { public static final String PREFERENCES_KEY_SHUFFLE_START_YEAR = "startYear"; public static final String PREFERENCES_KEY_SHUFFLE_END_YEAR = "endYear"; public static final String PREFERENCES_KEY_SHUFFLE_GENRE = "genre"; + public static final String PREFERENCES_KEY_KEEP_SCREEN_ON = "keepScreenOn"; // Name of the preferences file. public static final String PREFERENCES_FILE_NAME = "github.daneren2005.dsub_preferences"; |