From 94c826a4ce4e03981bac1698252a487792c34192 Mon Sep 17 00:00:00 2001 From: Colin Willson Date: Sun, 24 May 2015 06:53:12 -0400 Subject: [PATCH] Fixed import Google Drive --- .../activity/OpmlImportFromPathActivity.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java index c1bbb7e52..74d22d9ff 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java @@ -172,8 +172,19 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK && requestCode == CHOOSE_OPML_FILE) { - String filename = data.getData().getPath(); - startImport(new File(filename)); + Uri uri = data.getData(); + + if ("content".equals(uri.getScheme())) { + try { + Reader mReader = new InputStreamReader(getContentResolver().openInputStream(uri), LangUtils.UTF_8); + startImport(mReader); + } catch (FileNotFoundException e) { + Log.d(TAG, "File not found"); + } + } else { + String filename = uri.getPath(); + startImport(new File(filename)); + } } }