|
@@ -76,7 +76,8 @@ import java.io.IOException;
|
|
* It proxies the necessary calls via {@link android.support.v7.app.AppCompatDelegate} to be used
|
|
* It proxies the necessary calls via {@link android.support.v7.app.AppCompatDelegate} to be used
|
|
* with AppCompat.
|
|
* with AppCompat.
|
|
*/
|
|
*/
|
|
-public class Preferences extends PreferenceActivity {
|
|
|
|
|
|
+public class Preferences extends PreferenceActivity
|
|
|
|
+ implements StorageMigration.StorageMigrationProgressListener {
|
|
|
|
|
|
private static final String TAG = Preferences.class.getSimpleName();
|
|
private static final String TAG = Preferences.class.getSimpleName();
|
|
|
|
|
|
@@ -120,6 +121,8 @@ public class Preferences extends PreferenceActivity {
|
|
|
|
|
|
public static class Keys {
|
|
public static class Keys {
|
|
public static final String STORAGE_PATH = "storage_path";
|
|
public static final String STORAGE_PATH = "storage_path";
|
|
|
|
+ public static final String INSTANT_UPLOAD_PATH = "instant_upload_path";
|
|
|
|
+ public static final String INSTANT_VIDEO_UPLOAD_PATH = "instant_video_upload_path";
|
|
}
|
|
}
|
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
@SuppressWarnings("deprecation")
|
|
@@ -367,13 +370,13 @@ public class Preferences extends PreferenceActivity {
|
|
|
|
|
|
storageMigration.migrate();
|
|
storageMigration.migrate();
|
|
|
|
|
|
- return true;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- mPrefInstantUploadPath = (PreferenceWithLongSummary)findPreference("instant_upload_path");
|
|
|
|
|
|
+ mPrefInstantUploadPath = (PreferenceWithLongSummary)findPreference(Keys.INSTANT_UPLOAD_PATH);
|
|
if (mPrefInstantUploadPath != null){
|
|
if (mPrefInstantUploadPath != null){
|
|
|
|
|
|
mPrefInstantUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
|
mPrefInstantUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
|
@@ -412,7 +415,7 @@ public class Preferences extends PreferenceActivity {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- mPrefInstantVideoUploadPath = findPreference("instant_video_upload_path");
|
|
|
|
|
|
+ mPrefInstantVideoUploadPath = findPreference(Keys.INSTANT_VIDEO_UPLOAD_PATH);
|
|
if (mPrefInstantVideoUploadPath != null){
|
|
if (mPrefInstantVideoUploadPath != null){
|
|
|
|
|
|
mPrefInstantVideoUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
|
mPrefInstantVideoUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
|
@@ -746,7 +749,7 @@ public class Preferences extends PreferenceActivity {
|
|
private void loadInstantUploadPath() {
|
|
private void loadInstantUploadPath() {
|
|
SharedPreferences appPrefs =
|
|
SharedPreferences appPrefs =
|
|
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
|
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
|
- mUploadPath = appPrefs.getString("instant_upload_path", getString(R.string.instant_upload_path));
|
|
|
|
|
|
+ mUploadPath = appPrefs.getString(Keys.INSTANT_UPLOAD_PATH, getString(R.string.instant_upload_path));
|
|
mPrefInstantUploadPath.setSummary(mUploadPath);
|
|
mPrefInstantUploadPath.setSummary(mUploadPath);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -763,6 +766,7 @@ public class Preferences extends PreferenceActivity {
|
|
editor.commit();
|
|
editor.commit();
|
|
String storageDescription = DataStorageUtils.getStorageDescriptionByPath(mStoragePath, this);
|
|
String storageDescription = DataStorageUtils.getStorageDescriptionByPath(mStoragePath, this);
|
|
mPrefStoragePath.setSummary(storageDescription);
|
|
mPrefStoragePath.setSummary(storageDescription);
|
|
|
|
+ mPrefStoragePath.setValue(newStoragePath);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -784,7 +788,7 @@ public class Preferences extends PreferenceActivity {
|
|
SharedPreferences appPrefs =
|
|
SharedPreferences appPrefs =
|
|
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
|
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
|
SharedPreferences.Editor editor = appPrefs.edit();
|
|
SharedPreferences.Editor editor = appPrefs.edit();
|
|
- editor.putString("instant_upload_path", mUploadPath);
|
|
|
|
|
|
+ editor.putString(Keys.INSTANT_UPLOAD_PATH, mUploadPath);
|
|
editor.commit();
|
|
editor.commit();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -802,15 +806,14 @@ public class Preferences extends PreferenceActivity {
|
|
SharedPreferences appPrefs =
|
|
SharedPreferences appPrefs =
|
|
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
|
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
|
SharedPreferences.Editor editor = appPrefs.edit();
|
|
SharedPreferences.Editor editor = appPrefs.edit();
|
|
- editor.putString("instant_video_upload_path", mUploadVideoPath);
|
|
|
|
|
|
+ editor.putString(Keys.INSTANT_VIDEO_UPLOAD_PATH, mUploadVideoPath);
|
|
editor.commit();
|
|
editor.commit();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onStorageMigrationFinished(String storagePath, boolean succeed) {
|
|
public void onStorageMigrationFinished(String storagePath, boolean succeed) {
|
|
- if (succeed) {
|
|
|
|
|
|
+ if (succeed)
|
|
saveStoragePath(storagePath);
|
|
saveStoragePath(storagePath);
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|