diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionController.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionController.java index e4cc0e55f..b44484b8d 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionController.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionController.java @@ -171,8 +171,8 @@ public class ContributionController { */ private void initiateGalleryUpload(final Activity activity, final boolean allowMultipleUploads) { setPickerConfiguration(activity, allowMultipleUploads); - boolean openDocumentIntentPreferred = defaultKvStore.getBoolean("openDocumentPhotoPickerPref"); - FilePicker.openGallery(activity, 0, openDocumentIntentPreferred); + boolean isGetContentPickerPreferred = defaultKvStore.getBoolean("getContentPhotoPickerPref"); + FilePicker.openGallery(activity, 0, isGetContentPickerPreferred); } /** diff --git a/app/src/main/java/fr/free/nrw/commons/filepicker/FilePicker.java b/app/src/main/java/fr/free/nrw/commons/filepicker/FilePicker.java index 31ea06e0d..f05f6a7e7 100644 --- a/app/src/main/java/fr/free/nrw/commons/filepicker/FilePicker.java +++ b/app/src/main/java/fr/free/nrw/commons/filepicker/FilePicker.java @@ -47,10 +47,10 @@ public class FilePicker implements Constants { } private static Intent createGalleryIntent(@NonNull Context context, int type, - boolean openDocumentIntentPreferred) { + boolean isGetContentPickerPreferred) { // storing picked image type to shared preferences storeType(context, type); - return plainGalleryPickerIntent(openDocumentIntentPreferred) + return plainGalleryPickerIntent(isGetContentPickerPreferred) .putExtra(Intent.EXTRA_ALLOW_MULTIPLE, configuration(context).allowsMultiplePickingInGallery()); } @@ -106,8 +106,8 @@ public class FilePicker implements Constants { * * @param type Custom type of your choice, which will be returned with the images */ - public static void openGallery(Activity activity, int type, boolean openDocumentIntentPreferred) { - Intent intent = createGalleryIntent(activity, type, openDocumentIntentPreferred); + public static void openGallery(Activity activity, int type, boolean isGetContentPickerPreferred) { + Intent intent = createGalleryIntent(activity, type, isGetContentPickerPreferred); activity.startActivityForResult(intent, RequestCodes.PICK_PICTURE_FROM_GALLERY); } @@ -201,8 +201,8 @@ public class FilePicker implements Constants { return data == null || (data.getData() == null && data.getClipData() == null); } - private static Intent plainGalleryPickerIntent(boolean openDocumentIntentPreferred) { - /* + private static Intent plainGalleryPickerIntent(boolean isGetContentPickerPreferred) { + /** * Asking for ACCESS_MEDIA_LOCATION at runtime solved the location-loss issue * in the custom selector in Contributions fragment. * Detailed discussion: https://github.com/commons-app/apps-android-commons/issues/5015 @@ -217,8 +217,8 @@ public class FilePicker implements Constants { * Reported on the Google Issue Tracker: https://issuetracker.google.com/issues/243294058 * Status: Won't fix (Intended behaviour) * - * Switched intent from ACTION_GET_CONTENT to ACTION_OPEN_DOCUMENT (by default; can - * be changed through the Setting page) as: + * Switched intent from ACTION_GET_CONTENT to ACTION_OPEN_DOCUMENT + * (based on user's preference) as: * * ACTION_GET_CONTENT opens the 'best application' for choosing that kind of data * The best application is the new Photo Picker that redacts the location tags @@ -226,15 +226,14 @@ public class FilePicker implements Constants { * ACTION_OPEN_DOCUMENT, however, displays the various DocumentsProvider instances * installed on the device, letting the user interactively navigate through them. * - * So, this allows us to use the traditional file picker that does not redact location tags - * from EXIF. + * So, this allows us to use the traditional file picker that does not redact location tags from EXIF. * */ Intent intent; - if (openDocumentIntentPreferred) { - intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); - } else { + if (isGetContentPickerPreferred) { intent = new Intent(Intent.ACTION_GET_CONTENT); + } else { + intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); } intent.setType("image/*"); return intent; diff --git a/app/src/main/java/fr/free/nrw/commons/settings/SettingsFragment.java b/app/src/main/java/fr/free/nrw/commons/settings/SettingsFragment.java index fddb91df8..ad1c7e039 100644 --- a/app/src/main/java/fr/free/nrw/commons/settings/SettingsFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/settings/SettingsFragment.java @@ -171,10 +171,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { return true; }); - Preference documentBasedPickerPreference = findPreference("openDocumentPhotoPickerPref"); - documentBasedPickerPreference.setOnPreferenceChangeListener( + Preference getContentPickerPreference = findPreference("getContentPhotoPickerPref"); + getContentPickerPreference.setOnPreferenceChangeListener( (preference, newValue) -> { - boolean isGetContentPickerTurnedOn = !(boolean) newValue; + boolean isGetContentPickerTurnedOn = (boolean) newValue; if (isGetContentPickerTurnedOn) { showLocationLossWarning(); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 42a1b70dc..767170a51 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -451,7 +451,9 @@ Upload your first media by tapping on the add button. The app would not record location along with in-shots as the GPS is turned off Use document based photo picker The new Android photo picker risks losing location information. Enable if you seem to be using it. - Turning this off could trigger the new Android photo picker. It risks losing location information.\n\nTap on \'Read more\' for more information. + Use GET_CONTENT photo picker + Disable if your pictures get uploaded without location + Please make sure that this new Android picker does not strip location from your pictures. You won\'t see the campaigns anymore. However, you can re-enable this notification in Settings if you wish. This function requires network connection, please check your connection settings. diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 8ac890545..183757b7c 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -57,7 +57,6 @@ android:title="Uploads"> - - +