mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
More tries
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
833c7f5773
commit
ec13dc8234
2 changed files with 2 additions and 35 deletions
|
@ -52,8 +52,6 @@ import com.owncloud.android.datamodel.MediaProvider;
|
|||
import com.owncloud.android.datamodel.SyncedFolder;
|
||||
import com.owncloud.android.datamodel.SyncedFolderProvider;
|
||||
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
|
||||
import com.owncloud.android.datastorage.DataStorageProvider;
|
||||
import com.owncloud.android.datastorage.StoragePoint;
|
||||
import com.owncloud.android.db.PreferenceManager;
|
||||
import com.owncloud.android.jobs.NCJobCreator;
|
||||
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
|
||||
|
@ -220,15 +218,8 @@ public class MainApp extends MultiDexApplication {
|
|||
appPrefs.getInt(WhatsNewActivity.KEY_LAST_SEEN_VERSION_CODE, 0) != 0) {
|
||||
String storagePath = appPrefs.getString(Preferences.PreferenceKeys.STORAGE_PATH, "");
|
||||
if (TextUtils.isEmpty(storagePath)) {
|
||||
storagePath = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
StoragePoint[] storagePoints = DataStorageProvider.getInstance().getLegacyAvailableStoragePoints();
|
||||
for(StoragePoint storagePoint : storagePoints) {
|
||||
if (storagePoint.getPath().startsWith(storagePath)) {
|
||||
storagePath = storagePoint.getPath();
|
||||
break;
|
||||
}
|
||||
}
|
||||
appPrefs.edit().putString(Preferences.PreferenceKeys.STORAGE_PATH, storagePath).commit();
|
||||
appPrefs.edit().putString(Preferences.PreferenceKeys.STORAGE_PATH,
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath()).commit();
|
||||
appPrefs.edit().remove(PreferenceManager.PREF__KEYS_MIGRATION).commit();
|
||||
}
|
||||
PreferenceManager.setStoragePathFix(this, true);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
package com.owncloud.android.datastorage;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
|
||||
import com.owncloud.android.MainApp;
|
||||
|
@ -32,7 +31,6 @@ import com.owncloud.android.datastorage.providers.MountCommandStoragePointProvid
|
|||
import com.owncloud.android.datastorage.providers.SystemDefaultStoragePointProvider;
|
||||
import com.owncloud.android.datastorage.providers.VDCStoragePointProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
|
@ -59,28 +57,6 @@ public class DataStorageProvider {
|
|||
|
||||
private DataStorageProvider() {}
|
||||
|
||||
public StoragePoint[] getLegacyAvailableStoragePoints() {
|
||||
if (mCachedStoragePoints.size() != 0) {
|
||||
return mCachedStoragePoints.toArray(new StoragePoint[mCachedStoragePoints.size()]);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
for (File f : MainApp.getAppContext().getExternalMediaDirs()) {
|
||||
if (f != null) {
|
||||
mCachedStoragePoints.add(new StoragePoint(f.getAbsolutePath(), f.getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (IStoragePointProvider p : mStorageProviders) {
|
||||
if (p.canProvideStoragePoints()) {
|
||||
mCachedStoragePoints.addAll(p.getAvailableStoragePoint());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mCachedStoragePoints.toArray(new StoragePoint[mCachedStoragePoints.size()]);
|
||||
}
|
||||
|
||||
public StoragePoint[] getAvailableStoragePoints() {
|
||||
if (mCachedStoragePoints.size() != 0) {
|
||||
return mCachedStoragePoints.toArray(new StoragePoint[mCachedStoragePoints.size()]);
|
||||
|
|
Loading…
Reference in a new issue