mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	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"
This commit is contained in:
		
							parent
							
								
									8a9aa962bc
								
							
						
					
					
						commit
						a1b6973614
					
				
					 5 changed files with 25 additions and 24 deletions
				
			
		|  | @ -79,8 +79,8 @@ public class ContributionController { | |||
|      */ | ||||
|     private void initiateGalleryUpload(final Activity activity, final boolean allowMultipleUploads) { | ||||
|         setPickerConfiguration(activity, allowMultipleUploads); | ||||
|         boolean isGetContentPickerPreferred = defaultKvStore.getBoolean("getContentPhotoPickerPref"); | ||||
|         FilePicker.openGallery(activity, 0, isGetContentPickerPreferred); | ||||
|         boolean openDocumentIntentPreferred = defaultKvStore.getBoolean("openDocumentPhotoPickerPref"); | ||||
|         FilePicker.openGallery(activity, 0, openDocumentIntentPreferred); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  |  | |||
|  | @ -47,10 +47,10 @@ public class FilePicker implements Constants { | |||
|     } | ||||
| 
 | ||||
|     private static Intent createGalleryIntent(@NonNull Context context, int type, | ||||
|                                               boolean isGetContentPickerPreferred) { | ||||
|                                               boolean openDocumentIntentPreferred) { | ||||
|         // storing picked image type to shared preferences | ||||
|         storeType(context, type); | ||||
|         return plainGalleryPickerIntent(isGetContentPickerPreferred) | ||||
|         return plainGalleryPickerIntent(openDocumentIntentPreferred) | ||||
|                 .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 isGetContentPickerPreferred) { | ||||
|         Intent intent = createGalleryIntent(activity, type, isGetContentPickerPreferred); | ||||
|     public static void openGallery(Activity activity, int type, boolean openDocumentIntentPreferred) { | ||||
|         Intent intent = createGalleryIntent(activity, type, openDocumentIntentPreferred); | ||||
|         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 isGetContentPickerPreferred) { | ||||
|         /** | ||||
|     private static Intent plainGalleryPickerIntent(boolean openDocumentIntentPreferred) { | ||||
|         /* | ||||
|          * 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 | ||||
|          * (based on user's preference) as: | ||||
|          * Switched intent from ACTION_GET_CONTENT to ACTION_OPEN_DOCUMENT (by default; can | ||||
|          * be changed through the Setting page) 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,14 +226,15 @@ 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 (isGetContentPickerPreferred) { | ||||
|             intent = new Intent(Intent.ACTION_GET_CONTENT); | ||||
|         } else { | ||||
|         if (openDocumentIntentPreferred) { | ||||
|             intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); | ||||
|         } else { | ||||
|             intent = new Intent(Intent.ACTION_GET_CONTENT); | ||||
|         } | ||||
|         intent.setType("image/*"); | ||||
|         return intent; | ||||
|  |  | |||
|  | @ -153,10 +153,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { | |||
|             return true; | ||||
|         }); | ||||
| 
 | ||||
|         Preference getContentPickerPreference = findPreference("getContentPhotoPickerPref"); | ||||
|         getContentPickerPreference.setOnPreferenceChangeListener( | ||||
|         Preference documentBasedPickerPreference = findPreference("openDocumentPhotoPickerPref"); | ||||
|         documentBasedPickerPreference.setOnPreferenceChangeListener( | ||||
|             (preference, newValue) -> { | ||||
|                 boolean isGetContentPickerTurnedOn = (boolean) newValue; | ||||
|                 boolean isGetContentPickerTurnedOn = !(boolean) newValue; | ||||
|                 if (isGetContentPickerTurnedOn) { | ||||
|                     showLocationLossWarning(); | ||||
|                 } | ||||
|  |  | |||
|  | @ -440,9 +440,9 @@ Upload your first media by tapping on the add button.</string> | |||
|   <string name="ends_on">Ends on:</string> | ||||
|   <string name="display_campaigns">Display campaigns</string> | ||||
|   <string name="display_campaigns_explanation">See the ongoing campaigns</string> | ||||
|   <string name="get_content_photo_picker_title">Use GET_CONTENT photo picker</string> | ||||
|   <string name="get_content_photo_picker_explanation">Disable if your pictures get uploaded without location</string> | ||||
|   <string name="location_loss_warning">Please make sure that this new Android picker does not strip location from your pictures.</string> | ||||
|   <string name="open_document_photo_picker_title">Use document based photo picker</string> | ||||
|   <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> | ||||
|   <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> | ||||
| 
 | ||||
|   <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> | ||||
|   <string name="this_function_needs_network_connection">This function requires network connection, please check your connection settings.</string> | ||||
|  |  | |||
|  | @ -72,10 +72,10 @@ | |||
|           android:title="@string/display_campaigns" /> | ||||
| 
 | ||||
|         <SwitchPreference | ||||
|             android:defaultValue="false" | ||||
|             android:key="getContentPhotoPickerPref" | ||||
|             android:summary="@string/get_content_photo_picker_explanation" | ||||
|             android:title="@string/get_content_photo_picker_title"/> | ||||
|             android:defaultValue="true" | ||||
|             android:key="openDocumentPhotoPickerPref" | ||||
|             android:summary="@string/open_document_photo_picker_explanation" | ||||
|             android:title="@string/open_document_photo_picker_title"/> | ||||
|     </PreferenceCategory> | ||||
| 
 | ||||
|     <PreferenceCategory | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Kaartic Sivaraam
						Kaartic Sivaraam