aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/github')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java3
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java1
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 31688494..211cf0d7 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java
@@ -2002,7 +2002,9 @@ public class DownloadService extends Service {
private synchronized void checkRemovePlayed() {
boolean changed = false;
- 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);
changed = true;
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 95fabc23..5c477ad9 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";