aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-27 17:07:47 -0700
committerScott Jackson <daneren2005@gmail.com>2015-03-27 17:07:47 -0700
commit8e05176e579b0dd9932dfb2be0ca862759f8668b (patch)
treebea3fbe2265280b8f57b9623563f54d9c2b71dc7
parentba6c1bc2b70c2528734e386c9c2f4928699794fb (diff)
downloaddsub-8e05176e579b0dd9932dfb2be0ca862759f8668b.tar.gz
dsub-8e05176e579b0dd9932dfb2be0ca862759f8668b.tar.bz2
dsub-8e05176e579b0dd9932dfb2be0ca862759f8668b.zip
Only warn users if the folder was actually changed
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 74329dd0..4bb7c1be 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -500,8 +500,10 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
String path = prefs.getString(Constants.PREFERENCES_KEY_CACHE_LOCATION, null);
File cacheLocation = new File(path);
if(!FileUtil.verifyCanWrite(cacheLocation)) {
- resetCacheLocation(prefs);
- Util.info(this, R.string.common_warning, R.string.settings_cache_location_reset);
+ // Only warn user if there is a difference saved
+ if(resetCacheLocation(prefs)) {
+ Util.info(this, R.string.common_warning, R.string.settings_cache_location_reset);
+ }
}
}
@@ -523,10 +525,16 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
}
}
- private void resetCacheLocation(SharedPreferences prefs) {
- SharedPreferences.Editor editor = prefs.edit();
- editor.putString(Constants.PREFERENCES_KEY_CACHE_LOCATION, FileUtil.getDefaultMusicDirectory(this).getPath());
- editor.commit();
+ private boolean resetCacheLocation(SharedPreferences prefs) {
+ String newDirectory = FileUtil.getDefaultMusicDirectory(this).getPath();
+ if(newDirectory == null || newDirectory.equals(prefs.getString(Constants.PREFERENCES_KEY_CACHE_LOCATION, newDirectory))) {
+ return false;
+ } else {
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putString(Constants.PREFERENCES_KEY_CACHE_LOCATION, newDirectory);
+ editor.commit();
+ return true;
+ }
}
private void loadBookmarks() {