Skip to content
This repository was archived by the owner on Mar 30, 2024. It is now read-only.

Fix on select nothing and click ok crash #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -266,10 +266,16 @@ public boolean onCreateOptionsMenu(Menu menu) {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.done) {
Intent intent = new Intent();
intent.putExtra(MEDIA_FILES, fileGalleryAdapter.getSelectedItems());
setResult(RESULT_OK, intent);
finish();
ArrayList<MediaFile> selectedFiles = fileGalleryAdapter.getSelectedItems();
if (selectedFiles.isEmpty()) {
Toast.makeText(this, R.string.must_select_file, Toast.LENGTH_SHORT).show();
} else {
Intent intent = new Intent();
intent.putExtra(MEDIA_FILES, fileGalleryAdapter.getSelectedItems());
setResult(RESULT_OK, intent);
finish();
}

return true;
}
return super.onOptionsItemSelected(item);
1 change: 1 addition & 0 deletions filepicker/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -6,4 +6,5 @@
<string name="selection_count_title">%3$s (%1$d/%2$d)</string>
<string name="selection_count">%1$d/%2$d</string>
<string name="permission_not_given">Permission not given</string>
<string name="must_select_file">Please select one file at least</string>
</resources>