diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java index 3f3eb39d0..d0f1cb335 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java @@ -1186,11 +1186,15 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity { throw new IllegalArgumentException("Unknown ID type " + v.getId()); } - Intent i = new Intent(Intent.ACTION_PICK); - i.setType("image/*"); + Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); + photoPickerIntent.setType("image/*"); + Intent contentIntent = new Intent(Intent.ACTION_GET_CONTENT); + contentIntent.setType("image/*"); + Intent chooserIntent = Intent.createChooser(photoPickerIntent, getString(R.string.addFromImage)); + chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { contentIntent }); try { - mPhotoPickerLauncher.launch(i); + mPhotoPickerLauncher.launch(chooserIntent); } catch (ActivityNotFoundException e) { Toast.makeText(getApplicationContext(), R.string.failedLaunchingPhotoPicker, Toast.LENGTH_LONG).show(); Log.e(TAG, "No activity found to handle intent", e); diff --git a/app/src/main/java/protect/card_locker/ScanActivity.java b/app/src/main/java/protect/card_locker/ScanActivity.java index 13119515e..1e86981e0 100644 --- a/app/src/main/java/protect/card_locker/ScanActivity.java +++ b/app/src/main/java/protect/card_locker/ScanActivity.java @@ -225,8 +225,13 @@ public class ScanActivity extends CatimaAppCompatActivity { public void addFromImage(View view) { Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); + Intent contentIntent = new Intent(Intent.ACTION_GET_CONTENT); + contentIntent.setType("image/*"); + + Intent chooserIntent = Intent.createChooser(photoPickerIntent, getString(R.string.addFromImage)); + chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { contentIntent }); try { - photoPickerLauncher.launch(photoPickerIntent); + photoPickerLauncher.launch(chooserIntent); } catch (ActivityNotFoundException e) { Toast.makeText(getApplicationContext(), R.string.failedLaunchingPhotoPicker, Toast.LENGTH_LONG).show(); Log.e(TAG, "No activity found to handle intent", e);