From 049ae62f1bf8bc6a77bca70c0b372742283d65fd Mon Sep 17 00:00:00 2001 From: Cj Malone Date: Fri, 17 Mar 2017 18:10:26 +0000 Subject: [PATCH 1/3] OPML Intent Add an SEND filter for opml files (from a browser) --- app/src/main/AndroidManifest.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2049b6bae..d9638e705 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -191,6 +191,21 @@ + + + + + + + + + + + + + + + + From d555668d10f7f22d3d4bee26a17caa99c97300a1 Mon Sep 17 00:00:00 2001 From: Cj Malone Date: Fri, 17 Mar 2017 18:30:53 +0000 Subject: [PATCH 2/3] Handle OPML send intent --- .../activity/OpmlImportFromIntentActivity.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java index 02e16a7b5..7cf83bcd9 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java @@ -1,5 +1,6 @@ package de.danoeh.antennapod.activity; +import android.content.Intent; import android.net.Uri; import android.os.Bundle; @@ -18,8 +19,12 @@ public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(true); Uri uri = getIntent().getData(); - if(uri.toString().startsWith("/")) { - uri = Uri.parse("file://" + uri.toString()); + if(uri != null) { + if(uri.toString().startsWith("/")) { + uri = Uri.parse("file://" + uri.toString()); + } + } else { + uri = getIntent().getStringExtra(Intent.EXTRA_TEXT); } importUri(uri); } From 77e89b57864fadc8292abf3c39a9678e952999d6 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Mon, 10 Apr 2017 21:19:25 +0200 Subject: [PATCH 3/3] Convert string to uri --- .../OpmlImportFromIntentActivity.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java index 7cf83bcd9..4c94e2b76 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java @@ -6,25 +6,25 @@ import android.os.Bundle; import de.danoeh.antennapod.core.preferences.UserPreferences; -/** Lets the user start the OPML-import process. */ +/** + * Lets the user start the OPML-import process. + */ public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity { private static final String TAG = "OpmlImportFromIntentAct"; @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(UserPreferences.getTheme()); - super.onCreate(savedInstanceState); + protected void onCreate(Bundle savedInstanceState) { + setTheme(UserPreferences.getTheme()); + super.onCreate(savedInstanceState); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); Uri uri = getIntent().getData(); - if(uri != null) { - if(uri.toString().startsWith("/")) { - uri = Uri.parse("file://" + uri.toString()); - } + if (uri != null && uri.toString().startsWith("/")) { + uri = Uri.parse("file://" + uri.toString()); } else { - uri = getIntent().getStringExtra(Intent.EXTRA_TEXT); + uri = Uri.parse(getIntent().getStringExtra(Intent.EXTRA_TEXT)); } importUri(uri); }