Skip to content

Commit

Permalink
Limit intent receivers for text/xml
Browse files Browse the repository at this point in the history
  • Loading branch information
caseydavenport committed Sep 10, 2015
1 parent a224514 commit 5f4a8c4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/com/biermacht/brews/frontend/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
Expand Down Expand Up @@ -258,8 +259,8 @@ private AlertDialog.Builder importRecipeAlert() {
public void onClick(DialogInterface dialog, int which) {
try {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
String[] mimeTypes = {"file/*.xml", "file/*.bsmx", "text/*"};
intent.setType("*/*");
String[] mimeTypes = {"file/*", "text/xml", "text/bsmx"};
intent.setType("text/xml");
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
startActivityForResult(intent, Constants.REQUEST_IMPORT_FILE);
} catch (android.content.ActivityNotFoundException e) {
Expand Down Expand Up @@ -288,6 +289,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d("MainActivity::onActivityResult", "URI: " + uri.toString());
Log.d("MainActivity::onActivityResult", "Path: " + path);

ContentResolver cR = getContentResolver();
Log.d("MainActivity::onActivityResult", "MIME type: " + cR.getType(uri));

if (path != null) {
new LoadRecipes(this, uri, ingredientHandler).execute("");
}
Expand Down

0 comments on commit 5f4a8c4

Please sign in to comment.