Skip to content

Commit

Permalink
Improve the way a db file can be selected for import
Browse files Browse the repository at this point in the history
  • Loading branch information
caarmen committed Jun 19, 2016
1 parent 4d8500d commit c2b828a
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,8 @@ protected void onActivityResult(int requestCode, int resultCode, Intent intent)
Snackbar.make(mBinding.getRoot(), R.string.import_result_no_file, Snackbar.LENGTH_SHORT).show();
return;
}
final File file = new File(filePath);
if (!file.exists()) {
Snackbar.make(mBinding.getRoot(), getString(R.string.import_result_file_does_not_exist, file.getName()), Snackbar.LENGTH_SHORT).show();
return;
}
// Save the uri of the file. We will import it in onResumeFragments.
getIntent().putExtra(EXTRA_IMPORT_URI, Uri.fromFile(file));
getIntent().putExtra(EXTRA_IMPORT_URI, intent.getData());
} else {
super.onActivityResult(requestCode, resultCode, intent);
}
Expand Down Expand Up @@ -495,7 +490,8 @@ public void onInputEntered(int actionId, String input, Bundle extras) {
@NeedsPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
void startFileChooser() {
Intent importIntent = new Intent(Intent.ACTION_GET_CONTENT);
importIntent.setType("file/*");
importIntent.setType("*/*");
importIntent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(Intent.createChooser(importIntent, getResources().getText(R.string.action_import)), ACTIVITY_REQUEST_CODE_IMPORT);
}

Expand Down

0 comments on commit c2b828a

Please sign in to comment.