aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/activity/SettingsActivity.java4
-rw-r--r--src/github/daneren2005/dsub/util/SyncUtil.java8
2 files changed, 12 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/activity/SettingsActivity.java b/src/github/daneren2005/dsub/activity/SettingsActivity.java
index c415d164..a1a58758 100644
--- a/src/github/daneren2005/dsub/activity/SettingsActivity.java
+++ b/src/github/daneren2005/dsub/activity/SettingsActivity.java
@@ -47,6 +47,7 @@ import github.daneren2005.dsub.service.MusicService;
import github.daneren2005.dsub.service.MusicServiceFactory;
import github.daneren2005.dsub.util.Constants;
import github.daneren2005.dsub.util.LoadingTask;
+import github.daneren2005.dsub.util.SyncUtil;
import github.daneren2005.dsub.view.ErrorDialog;
import github.daneren2005.dsub.util.FileUtil;
import github.daneren2005.dsub.util.Util;
@@ -243,6 +244,9 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
DownloadService downloadService = DownloadServiceImpl.getInstance();
downloadService.setSleepTimerDuration(Integer.parseInt(sharedPreferences.getString(key, "60")));
}
+ else if(Constants.PREFERENCES_KEY_SYNC_MOST_RECENT.equals(key)) {
+ SyncUtil.removeMostRecentSyncFiles(this);
+ }
scheduleBackup();
}
diff --git a/src/github/daneren2005/dsub/util/SyncUtil.java b/src/github/daneren2005/dsub/util/SyncUtil.java
index fe7b4e29..99e6824c 100644
--- a/src/github/daneren2005/dsub/util/SyncUtil.java
+++ b/src/github/daneren2005/dsub/util/SyncUtil.java
@@ -7,6 +7,7 @@ import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
+import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -157,6 +158,13 @@ public final class SyncUtil {
}
return list;
}
+ public static void removeMostRecentSyncFiles(Context context) {
+ int total = Util.getServerCount(context);
+ for(int i = 0; i < total; i++) {
+ File file = new File(context.getCacheDir(), getMostRecentSyncFile(context, i));
+ file.delete();
+ }
+ }
public static String getMostRecentSyncFile(Context context, int instance) {
return "sync-most_recent-" + (Util.getRestUrl(context, null, instance, false)).hashCode() + ".ser";
}