mirror of
https://github.com/nextcloud/android.git
synced 2024-12-18 15:01:57 +03:00
Merge pull request #14070 from nextcloud/fix/choose_storage_location_dialogue
Fix exception when closing choose storage location dialogue
This commit is contained in:
commit
a0c5a9e3e4
1 changed files with 9 additions and 1 deletions
|
@ -819,6 +819,8 @@ public class SettingsActivity extends PreferenceActivity
|
|||
final PreferenceCategory preferenceCategoryGeneral = (PreferenceCategory) findPreference("general");
|
||||
viewThemeUtils.files.themePreferenceCategory(preferenceCategoryGeneral);
|
||||
|
||||
readStoragePath();
|
||||
|
||||
prefDataLoc = findPreference(AppPreferencesImpl.DATA_STORAGE_LOCATION);
|
||||
if (prefDataLoc != null) {
|
||||
prefDataLoc.setOnPreferenceClickListener(p -> {
|
||||
|
@ -1000,7 +1002,7 @@ public class SettingsActivity extends PreferenceActivity
|
|||
} else if (requestCode == ACTION_SET_STORAGE_LOCATION && data != null) {
|
||||
String newPath = data.getStringExtra(ChooseStorageLocationActivity.KEY_RESULT_STORAGE_LOCATION);
|
||||
|
||||
if (!storagePath.equals(newPath)) {
|
||||
if (storagePath != null && !storagePath.equals(newPath)) {
|
||||
StorageMigration storageMigration = new StorageMigration(this, user, storagePath, newPath, viewThemeUtils);
|
||||
storageMigration.setStorageMigrationProgressListener(this);
|
||||
storageMigration.migrate();
|
||||
|
@ -1150,6 +1152,12 @@ public class SettingsActivity extends PreferenceActivity
|
|||
editor.apply();
|
||||
}
|
||||
|
||||
private void readStoragePath() {
|
||||
SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
// Load storage path from shared preferences. Use private internal storage by default.
|
||||
storagePath = appPrefs.getString(AppPreferencesImpl.STORAGE_PATH, getApplicationContext().getFilesDir().getAbsolutePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStorageMigrationFinished(String storagePath, boolean succeed) {
|
||||
if (succeed) {
|
||||
|
|
Loading…
Reference in a new issue