From: Peter Henn Date: Tue, 8 Dec 2015 00:13:26 +0000 (+0000) Subject: Merge tag 'oc-android-1.9' into sdcard-save X-Git-Tag: sd-android-1.9 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/70e79071435bc8d7a53f36eb4202c4ec05dd2075?hp=--cc Merge tag 'oc-android-1.9' into sdcard-save Version 1.9: Release with expanded sharing Resolved conflicts in: src/com/owncloud/android/utils/FileStorageUtils.java --- 70e79071435bc8d7a53f36eb4202c4ec05dd2075 diff --cc src/com/owncloud/android/utils/FileStorageUtils.java index 808f2216,1740ca58..10d17090 --- a/src/com/owncloud/android/utils/FileStorageUtils.java +++ b/src/com/owncloud/android/utils/FileStorageUtils.java @@@ -52,41 -53,11 +53,40 @@@ public class FileStorageUtils public static Integer mSortOrder = SORT_NAME; public static Boolean mSortAscending = true; - - + //private static final String TAG = FileStorageUtils.class.getSimpleName(); + + @SuppressLint("NewApi") + private static final File getBaseStorePath() { + File baseStoragePath = Environment.getExternalStorageDirectory(); + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { + File[] dirs = MainApp.getAppContext().getExternalFilesDirs(null); + if (dirs.length > 1) { + baseStoragePath = dirs[1]; + } + } + return baseStoragePath; + } + + @SuppressLint("NewApi") + private static final String getBaseStorePathString() { + File baseStoragePath = Environment.getExternalStorageDirectory(); + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { + File[] dirs = MainApp.getAppContext().getExternalFilesDirs(null); + if (dirs.length > 1) { + baseStoragePath = dirs[1]; + } + return baseStoragePath.getAbsolutePath(); + } else { + return baseStoragePath.getAbsolutePath() + "/" + MainApp.getDataFolder(); + } + } + public static final String getSavePath(String accountName) { - File sdCard = Environment.getExternalStorageDirectory(); - return sdCard.getAbsolutePath() + "/" + MainApp.getDataFolder() + "/" + Uri.encode(accountName, "@"); + //File sdCard = Environment.getExternalStorageDirectory(); + //return sdCard.getAbsolutePath() + "/" + MainApp.getDataFolder() + "/" + Uri.encode(accountName, "@"); // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names, that can be in the accountName since 0.1.190B + //return getBaseStorePath().getAbsolutePath() + "/" + Uri.encode(accountName, "@"); + return getBaseStorePathString() + "/" + Uri.encode(accountName, "@"); } public static final String getDefaultSavePathFor(String accountName, OCFile file) {