Adds non legacy support for Android Q
This commit is contained in:
parent
1e78f28220
commit
b9e33851cf
|
@ -1,3 +1,6 @@
|
||||||
|
## 1.13.1
|
||||||
|
Android: adds support to non-legacy picking on Android Q or above (thank you @lakshyab1995).
|
||||||
|
|
||||||
## 1.13.0+1
|
## 1.13.0+1
|
||||||
Fixes an issue that could prevent `1.13.0` from being built due to missing `allowCompression` property.
|
Fixes an issue that could prevent `1.13.0` from being built due to missing `allowCompression` property.
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,11 @@ public class FilePickerDelegate implements PluginRegistry.ActivityResultListener
|
||||||
final ArrayList<String> paths = new ArrayList<>();
|
final ArrayList<String> paths = new ArrayList<>();
|
||||||
while (currentItem < count) {
|
while (currentItem < count) {
|
||||||
final Uri currentUri = data.getClipData().getItemAt(currentItem).getUri();
|
final Uri currentUri = data.getClipData().getItemAt(currentItem).getUri();
|
||||||
String path = FileUtils.getPath(currentUri, FilePickerDelegate.this.activity);
|
String path;
|
||||||
if (path == null) {
|
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
path = FileUtils.getUriFromRemote(FilePickerDelegate.this.activity, currentUri);
|
path = FileUtils.getUriFromRemote(FilePickerDelegate.this.activity, currentUri);
|
||||||
|
} else {
|
||||||
|
path = FileUtils.getPath(currentUri, FilePickerDelegate.this.activity);
|
||||||
}
|
}
|
||||||
paths.add(path);
|
paths.add(path);
|
||||||
Log.i(FilePickerDelegate.TAG, "[MultiFilePick] File #" + currentItem + " - URI: " + currentUri.getPath());
|
Log.i(FilePickerDelegate.TAG, "[MultiFilePick] File #" + currentItem + " - URI: " + currentUri.getPath());
|
||||||
|
@ -108,10 +110,11 @@ public class FilePickerDelegate implements PluginRegistry.ActivityResultListener
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(FilePickerDelegate.TAG, "[SingleFilePick] File URI:" + uri.toString());
|
Log.i(FilePickerDelegate.TAG, "[SingleFilePick] File URI:" + uri.toString());
|
||||||
fullPath = FileUtils.getPath(uri, FilePickerDelegate.this.activity);
|
|
||||||
|
|
||||||
if (fullPath == null) {
|
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
fullPath = type.equals("dir") ? FileUtils.getFullPathFromTreeUri(uri, activity) : FileUtils.getUriFromRemote(FilePickerDelegate.this.activity, uri);
|
fullPath = type.equals("dir") ? FileUtils.getFullPathFromTreeUri(uri, activity) : FileUtils.getUriFromRemote(FilePickerDelegate.this.activity, uri);
|
||||||
|
} else {
|
||||||
|
fullPath = FileUtils.getPath(uri, FilePickerDelegate.this.activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullPath != null) {
|
if (fullPath != null) {
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class FileUtils {
|
||||||
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
|
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String selection = "_id=?";
|
final String selection = MediaStore.Images.Media._ID + "=?";
|
||||||
final String[] selectionArgs = new String[]{
|
final String[] selectionArgs = new String[]{
|
||||||
split[1]
|
split[1]
|
||||||
};
|
};
|
||||||
|
@ -156,7 +156,7 @@ public class FileUtils {
|
||||||
private static String getDataColumn(final Context context, final Uri uri, final String selection,
|
private static String getDataColumn(final Context context, final Uri uri, final String selection,
|
||||||
final String[] selectionArgs) {
|
final String[] selectionArgs) {
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
final String column = "_data";
|
final String column = MediaStore.Images.Media.DATA;
|
||||||
final String[] projection = {
|
final String[] projection = {
|
||||||
column
|
column
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: file_picker
|
name: file_picker
|
||||||
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
||||||
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
||||||
version: 1.13.0+1
|
version: 1.13.1
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|
Loading…
Reference in New Issue