mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
setRequireOriginal
This commit is contained in:
parent
96a0dce6a6
commit
fe1cd75b95
1 changed files with 22 additions and 12 deletions
|
|
@ -8,6 +8,8 @@ import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build.VERSION;
|
||||||
|
import android.os.Build.VERSION_CODES;
|
||||||
import androidx.exifinterface.media.ExifInterface;
|
import androidx.exifinterface.media.ExifInterface;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
|
|
@ -273,13 +275,17 @@ public class FilePicker implements Constants {
|
||||||
if (clipData == null) {
|
if (clipData == null) {
|
||||||
Uri uri = data.getData();
|
Uri uri = data.getData();
|
||||||
|
|
||||||
InputStream stream = activity.getBaseContext().getContentResolver().openInputStream(uri);
|
if (VERSION.SDK_INT >= VERSION_CODES.Q) {
|
||||||
//if (stream == null) {
|
Uri uriWithLocation = MediaStore.setRequireOriginal(uri);
|
||||||
|
InputStream stream = activity.getBaseContext().getContentResolver().openInputStream(uriWithLocation);
|
||||||
|
//if (stream == null) {
|
||||||
//Log.w(TAG, "Got a null input stream for " + photoUri);
|
//Log.w(TAG, "Got a null input stream for " + photoUri);
|
||||||
//continue;
|
//continue;
|
||||||
//}
|
//}
|
||||||
ExifInterface exif = new ExifInterface(stream);
|
ExifInterface exif = new ExifInterface(stream);
|
||||||
double[] location = exif.getLatLong();
|
double[] location = exif.getLatLong();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
UploadableFile file = PickedFiles.pickedExistingPicture(activity, uri);
|
UploadableFile file = PickedFiles.pickedExistingPicture(activity, uri);
|
||||||
files.add(file);
|
files.add(file);
|
||||||
|
|
@ -287,13 +293,17 @@ public class FilePicker implements Constants {
|
||||||
for (int i = 0; i < clipData.getItemCount(); i++) {
|
for (int i = 0; i < clipData.getItemCount(); i++) {
|
||||||
Uri uri = clipData.getItemAt(i).getUri();
|
Uri uri = clipData.getItemAt(i).getUri();
|
||||||
|
|
||||||
InputStream stream = activity.getBaseContext().getContentResolver().openInputStream(uri);
|
if (VERSION.SDK_INT >= VERSION_CODES.Q) {
|
||||||
//if (stream == null) {
|
Uri uriWithLocation = MediaStore.setRequireOriginal(uri);
|
||||||
//Log.w(TAG, "Got a null input stream for " + photoUri);
|
InputStream stream = activity.getBaseContext().getContentResolver().openInputStream(uriWithLocation);
|
||||||
//continue;
|
//if (stream == null) {
|
||||||
//}
|
//Log.w(TAG, "Got a null input stream for " + photoUri);
|
||||||
ExifInterface exif = new ExifInterface(stream);
|
//continue;
|
||||||
double[] location = exif.getLatLong();
|
//}
|
||||||
|
ExifInterface exif = new ExifInterface(stream);
|
||||||
|
double[] location = exif.getLatLong();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
UploadableFile file = PickedFiles.pickedExistingPicture(activity, uri);
|
UploadableFile file = PickedFiles.pickedExistingPicture(activity, uri);
|
||||||
files.add(file);
|
files.add(file);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue