Skip to content

Commit

Permalink
Closes #740
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamantcheese committed Feb 26, 2020
1 parent 3f0d1c4 commit 5af776d
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,17 @@ private void pickLocalFile(ImagePickCallback callback) {
intents.add(newIntent);
}

if (intents.size() == 1 || !ChanSettings.allowFilePickChooser.get()) {
activity.startActivityForResult(intents.get(0), IMAGE_PICK_RESULT);
} else if (intents.size() > 1) {
Intent chooser = Intent.createChooser(intents.remove(intents.size() - 1),
getString(R.string.image_pick_delegate_select_file_picker)
);

chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new Intent[0]));
activity.startActivityForResult(chooser, IMAGE_PICK_RESULT);
if (!intents.isEmpty()) {
if (intents.size() == 1 || !ChanSettings.allowFilePickChooser.get()) {
activity.startActivityForResult(intents.get(0), IMAGE_PICK_RESULT);
} else {
Intent chooser = Intent.createChooser(intents.remove(intents.size() - 1),
getString(R.string.image_pick_delegate_select_file_picker)
);

chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new Intent[0]));
activity.startActivityForResult(chooser, IMAGE_PICK_RESULT);
}
} else {
showToast(activity, R.string.open_file_picker_failed, Toast.LENGTH_LONG);
callback.onFilePickError(false);
Expand Down

0 comments on commit 5af776d

Please sign in to comment.