diff options
author | Thomas Knepper <thknepper@gmx.de> | 2015-07-26 20:00:48 +0200 |
---|---|---|
committer | Thomas Knepper <thknepper@gmx.de> | 2015-07-26 20:00:48 +0200 |
commit | 6cb7a1de67af90d1d13cd04ab64afee4d1e99b70 (patch) | |
tree | 67ff40d7e5bd6edb94b882fe16aa69df8dc211f0 /app/src/main/java | |
parent | 04bf2e345beae36a512aa50b5b920a4af9345743 (diff) | |
download | dsub-6cb7a1de67af90d1d13cd04ab64afee4d1e99b70.tar.gz dsub-6cb7a1de67af90d1d13cd04ab64afee4d1e99b70.tar.bz2 dsub-6cb7a1de67af90d1d13cd04ab64afee4d1e99b70.zip |
option, to keep 1, 2 or 3 played songs
Diffstat (limited to 'app/src/main/java')
3 files changed, 7 insertions, 1 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java index 3be21a67..52748e7b 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java @@ -71,6 +71,7 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared private EditTextPreference cacheLocation; private ListPreference preloadCountWifi; private ListPreference preloadCountMobile; + private ListPreference keepPlayedCount; private ListPreference tempLoss; private ListPreference pauseDisconnect; private Preference addServerPreference; @@ -177,6 +178,7 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared cacheLocation = (EditTextPreference) this.findPreference(Constants.PREFERENCES_KEY_CACHE_LOCATION); preloadCountWifi = (ListPreference) this.findPreference(Constants.PREFERENCES_KEY_PRELOAD_COUNT_WIFI); preloadCountMobile = (ListPreference) this.findPreference(Constants.PREFERENCES_KEY_PRELOAD_COUNT_MOBILE); + keepPlayedCount = (ListPreference) this.findPreference(Constants.PREFERENCES_KEY_KEEP_PLAYED_CNT); tempLoss = (ListPreference) this.findPreference(Constants.PREFERENCES_KEY_TEMP_LOSS); pauseDisconnect = (ListPreference) this.findPreference(Constants.PREFERENCES_KEY_PAUSE_DISCONNECT); serversCategory = (PreferenceCategory) this.findPreference(Constants.PREFERENCES_KEY_SERVER_KEY); @@ -316,6 +318,7 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared cacheLocation.setSummary(cacheLocation.getText()); preloadCountWifi.setSummary(preloadCountWifi.getEntry()); preloadCountMobile.setSummary(preloadCountMobile.getEntry()); + keepPlayedCount.setSummary(keepPlayedCount.getEntry()); tempLoss.setSummary(tempLoss.getEntry()); pauseDisconnect.setSummary(pauseDisconnect.getEntry()); videoPlayer.setSummary(videoPlayer.getEntry()); diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java index 9e57f5b0..ae2eb073 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -1972,7 +1972,9 @@ public class DownloadService extends Service { } private synchronized void checkRemovePlayed() { - while(currentPlayingIndex > 0) { + SharedPreferences prefs = Util.getPreferences(this); + int keepCount = Integer.parseInt(prefs.getString(Constants.PREFERENCES_KEY_KEEP_PLAYED_CNT, "0")); + while(currentPlayingIndex > keepCount) { downloadList.remove(0); currentPlayingIndex = downloadList.indexOf(currentPlaying); revision++; diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java index 05481bf0..b3dd173b 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java @@ -113,6 +113,7 @@ public final class Constants { public static final String PREFERENCES_KEY_PERSISTENT_NOTIFICATION = "persistentNotification"; public static final String PREFERENCES_KEY_GAPLESS_PLAYBACK = "gaplessPlayback"; public static final String PREFERENCES_KEY_REMOVE_PLAYED = "removePlayed"; + public static final String PREFERENCES_KEY_KEEP_PLAYED_CNT = "keepPlayedCount"; public static final String PREFERENCES_KEY_SHUFFLE_MODE = "shuffleMode2"; public static final String PREFERENCES_KEY_SHUFFLE_MODE_EXTRA = "shuffleModeExtra"; public static final String PREFERENCES_KEY_CHAT_REFRESH = "chatRefreshRate"; |