aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java17
2 files changed, 16 insertions, 3 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ea8a1022..1b5f3f9e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -23,6 +23,7 @@
<string name="common.confirm">Confirm</string>
<string name="common.confirm_message">Do you want to %1$s %2$s?</string>
<string name="common.empty">None found</string>
+ <string name="common.warning">Warning</string>
<string name="button_bar.home">Home</string>
<string name="button_bar.browse">Library</string>
@@ -255,6 +256,7 @@
<string name="settings.cache_size">Cache size (MB)</string>
<string name="settings.cache_location">Cache location</string>
<string name="settings.cache_location_error">Invalid cache location. Using default.</string>
+ <string name="settings.cache_location_reset">The cache location you have set is no longer writable. If you recently upgraded your phone OS to KitKat 4.4, then the way apps write to the SD Card has changed so that they can only write to a specific location. The location that DSub uses has already been automatically changed to the correct location. In order to delete all of the old app data, you will need to mount the SD Card on your computer and delete the old folder manually</string>
<string name="settings.cache_clear">Clear Cache</string>
<string name="settings.cache_clear_complete">Finished clearing cache</string>
<string name="settings.testing_connection">Testing connection...</string>
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 7444229b..7e047a94 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -434,9 +434,14 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
SharedPreferences prefs = Util.getPreferences(this);
if (!prefs.contains(Constants.PREFERENCES_KEY_CACHE_LOCATION)) {
- SharedPreferences.Editor editor = prefs.edit();
- editor.putString(Constants.PREFERENCES_KEY_CACHE_LOCATION, FileUtil.getDefaultMusicDirectory(this).getPath());
- editor.commit();
+ resetCacheLocation(prefs);
+ } else {
+ String path = prefs.getString(Constants.PREFERENCES_KEY_CACHE_LOCATION, null);
+ File cacheLocation = new File(path);
+ if(!FileUtil.ensureDirectoryExistsAndIsReadWritable(cacheLocation)) {
+ resetCacheLocation(prefs);
+ Util.info(this, R.string.common_warning, R.string.settings_cache_location_reset);
+ }
}
if (!prefs.contains(Constants.PREFERENCES_KEY_OFFLINE)) {
@@ -457,6 +462,12 @@ 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 void createAccount() {
final Context context = this;