summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authororionlee <orionlee@yahoo.com>2019-04-07 14:56:15 -0700
committerorionlee <orionlee@yahoo.com>2019-04-07 14:56:15 -0700
commit345e6863c343262912a9f91228d9a16dc9869c19 (patch)
treeb803e370770014575867d9d9c746d4a09486fe1a /app/src/main/java
parent3fdf6af1a3a7fdcf97cf234ed1ac3b5af52fa75f (diff)
downloadAntennaPod-345e6863c343262912a9f91228d9a16dc9869c19.zip
bugfix #3099 - add podcast by URL - show error dialog when URL points to no feed.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
index a43ff1c49..145908e97 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
@@ -342,8 +342,13 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
} catch (UnsupportedFeedtypeException e) {
Log.d(TAG, "Unsupported feed type detected");
if ("html".equalsIgnoreCase(e.getRootElement())) {
- showFeedDiscoveryDialog(new File(feed.getFile_url()), feed.getDownload_url());
- return Optional.empty();
+ boolean dialogShown = showFeedDiscoveryDialog(new File(feed.getFile_url()), feed.getDownload_url());
+ if (dialogShown) {
+ return Optional.empty();
+ } else {
+ Log.d(TAG, "Supplied feed is an HTML web page that has no references to any feed");
+ throw e;
+ }
} else {
throw e;
}
@@ -539,21 +544,25 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
}
}
- private void showFeedDiscoveryDialog(File feedFile, String baseUrl) {
+ /**
+ *
+ * @return true if a FeedDiscoveryDialog is shown, false otherwise (e.g., due to no feed found).
+ */
+ private boolean showFeedDiscoveryDialog(File feedFile, String baseUrl) {
FeedDiscoverer fd = new FeedDiscoverer();
final Map<String, String> urlsMap;
try {
urlsMap = fd.findLinks(feedFile, baseUrl);
if (urlsMap == null || urlsMap.isEmpty()) {
- return;
+ return false;
}
} catch (IOException e) {
e.printStackTrace();
- return;
+ return false;
}
if (isPaused || isFinishing()) {
- return;
+ return false;
}
final List<String> titles = new ArrayList<>();
@@ -589,6 +598,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
}
dialog = ab.show();
});
+ return true;
}
private class FeedViewAuthenticationDialog extends AuthenticationDialog {