Skip to content

Commit a1b6973

Browse files
authored
Toggle photo picker switch behaviour and tweak phrases (#5250)
* photo picker: toggle behaviour of switch and adjust phrasing for better UX The enable state used to trigger the GET_CONTENT intent. Alter the flow such that the GET_CONTENT intent is triggered when switch is disabled. Adjust default value and other parts of code naming to reflect this. The existing phrasing had a lot of tech jargon in it which could result in the non-technical users being confused. Tweak the phrasing to avoid such phrases. The documentation in the website could also use some follow up improvements. * Adjust strings to clearly convey that location loss is a "risk"
1 parent 8a9aa96 commit a1b6973

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

app/src/main/java/fr/free/nrw/commons/contributions/ContributionController.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ public void initiateCustomGalleryPickWithPermission(final Activity activity) {
7979
*/
8080
private void initiateGalleryUpload(final Activity activity, final boolean allowMultipleUploads) {
8181
setPickerConfiguration(activity, allowMultipleUploads);
82-
boolean isGetContentPickerPreferred = defaultKvStore.getBoolean("getContentPhotoPickerPref");
83-
FilePicker.openGallery(activity, 0, isGetContentPickerPreferred);
82+
boolean openDocumentIntentPreferred = defaultKvStore.getBoolean("openDocumentPhotoPickerPref");
83+
FilePicker.openGallery(activity, 0, openDocumentIntentPreferred);
8484
}
8585

8686
/**

app/src/main/java/fr/free/nrw/commons/filepicker/FilePicker.java

+13-12
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ private static Uri createCameraPictureFile(@NonNull Context context) throws IOEx
4747
}
4848

4949
private static Intent createGalleryIntent(@NonNull Context context, int type,
50-
boolean isGetContentPickerPreferred) {
50+
boolean openDocumentIntentPreferred) {
5151
// storing picked image type to shared preferences
5252
storeType(context, type);
53-
return plainGalleryPickerIntent(isGetContentPickerPreferred)
53+
return plainGalleryPickerIntent(openDocumentIntentPreferred)
5454
.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, configuration(context).allowsMultiplePickingInGallery());
5555
}
5656

@@ -106,8 +106,8 @@ private static int restoreType(@NonNull Context context) {
106106
*
107107
* @param type Custom type of your choice, which will be returned with the images
108108
*/
109-
public static void openGallery(Activity activity, int type, boolean isGetContentPickerPreferred) {
110-
Intent intent = createGalleryIntent(activity, type, isGetContentPickerPreferred);
109+
public static void openGallery(Activity activity, int type, boolean openDocumentIntentPreferred) {
110+
Intent intent = createGalleryIntent(activity, type, openDocumentIntentPreferred);
111111
activity.startActivityForResult(intent, RequestCodes.PICK_PICTURE_FROM_GALLERY);
112112
}
113113

@@ -201,8 +201,8 @@ private static boolean isPhoto(Intent data) {
201201
return data == null || (data.getData() == null && data.getClipData() == null);
202202
}
203203

204-
private static Intent plainGalleryPickerIntent(boolean isGetContentPickerPreferred) {
205-
/**
204+
private static Intent plainGalleryPickerIntent(boolean openDocumentIntentPreferred) {
205+
/*
206206
* Asking for ACCESS_MEDIA_LOCATION at runtime solved the location-loss issue
207207
* in the custom selector in Contributions fragment.
208208
* Detailed discussion: https://github.com/commons-app/apps-android-commons/issues/5015
@@ -217,23 +217,24 @@ private static Intent plainGalleryPickerIntent(boolean isGetContentPickerPreferr
217217
* Reported on the Google Issue Tracker: https://issuetracker.google.com/issues/243294058
218218
* Status: Won't fix (Intended behaviour)
219219
*
220-
* Switched intent from ACTION_GET_CONTENT to ACTION_OPEN_DOCUMENT
221-
* (based on user's preference) as:
220+
* Switched intent from ACTION_GET_CONTENT to ACTION_OPEN_DOCUMENT (by default; can
221+
* be changed through the Setting page) as:
222222
*
223223
* ACTION_GET_CONTENT opens the 'best application' for choosing that kind of data
224224
* The best application is the new Photo Picker that redacts the location tags
225225
*
226226
* ACTION_OPEN_DOCUMENT, however, displays the various DocumentsProvider instances
227227
* installed on the device, letting the user interactively navigate through them.
228228
*
229-
* So, this allows us to use the traditional file picker that does not redact location tags from EXIF.
229+
* So, this allows us to use the traditional file picker that does not redact location tags
230+
* from EXIF.
230231
*
231232
*/
232233
Intent intent;
233-
if (isGetContentPickerPreferred) {
234-
intent = new Intent(Intent.ACTION_GET_CONTENT);
235-
} else {
234+
if (openDocumentIntentPreferred) {
236235
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
236+
} else {
237+
intent = new Intent(Intent.ACTION_GET_CONTENT);
237238
}
238239
intent.setType("image/*");
239240
return intent;

app/src/main/java/fr/free/nrw/commons/settings/SettingsFragment.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ public boolean onPreferenceClick(Preference preference) {
153153
return true;
154154
});
155155

156-
Preference getContentPickerPreference = findPreference("getContentPhotoPickerPref");
157-
getContentPickerPreference.setOnPreferenceChangeListener(
156+
Preference documentBasedPickerPreference = findPreference("openDocumentPhotoPickerPref");
157+
documentBasedPickerPreference.setOnPreferenceChangeListener(
158158
(preference, newValue) -> {
159-
boolean isGetContentPickerTurnedOn = (boolean) newValue;
159+
boolean isGetContentPickerTurnedOn = !(boolean) newValue;
160160
if (isGetContentPickerTurnedOn) {
161161
showLocationLossWarning();
162162
}

app/src/main/res/values/strings.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ Upload your first media by tapping on the add button.</string>
440440
<string name="ends_on">Ends on:</string>
441441
<string name="display_campaigns">Display campaigns</string>
442442
<string name="display_campaigns_explanation">See the ongoing campaigns</string>
443-
<string name="get_content_photo_picker_title">Use GET_CONTENT photo picker</string>
444-
<string name="get_content_photo_picker_explanation">Disable if your pictures get uploaded without location</string>
445-
<string name="location_loss_warning">Please make sure that this new Android picker does not strip location from your pictures.</string>
443+
<string name="open_document_photo_picker_title">Use document based photo picker</string>
444+
<string name="open_document_photo_picker_explanation">The new Android photo picker risks losing location information. Enable if you seem to be using it.</string>
445+
<string name="location_loss_warning">Turning this off could trigger the new Android photo picker. It risks losing location information.\n\nTap on \'Read more\' for more information.</string>
446446

447447
<string name="nearby_campaign_dismiss_message">You won\'t see the campaigns anymore. However, you can re-enable this notification in Settings if you wish.</string>
448448
<string name="this_function_needs_network_connection">This function requires network connection, please check your connection settings.</string>

app/src/main/res/xml/preferences.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@
7272
android:title="@string/display_campaigns" />
7373

7474
<SwitchPreference
75-
android:defaultValue="false"
76-
android:key="getContentPhotoPickerPref"
77-
android:summary="@string/get_content_photo_picker_explanation"
78-
android:title="@string/get_content_photo_picker_title"/>
75+
android:defaultValue="true"
76+
android:key="openDocumentPhotoPickerPref"
77+
android:summary="@string/open_document_photo_picker_explanation"
78+
android:title="@string/open_document_photo_picker_title"/>
7979
</PreferenceCategory>
8080

8181
<PreferenceCategory

0 commit comments

Comments
 (0)