summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fietz <Martin.Fietz@gmail.com>2016-11-27 10:44:49 +0100
committerMartin Fietz <Martin.Fietz@gmail.com>2016-11-27 10:44:49 +0100
commit4ff8d5430fb83d54b7ef63132b400033e5cf4392 (patch)
tree6e484da8bad32066907ccfcf7efc1988c1c8f256
parentcf8deb12efb5032cb5a79dc0adcca333cbcfd706 (diff)
downloadAntennaPod-4ff8d5430fb83d54b7ef63132b400033e5cf4392.zip
Refactor
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java19
1 files changed, 7 insertions, 12 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java
index 9bd377293..3d752df76 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java
@@ -53,20 +53,15 @@ public class NSRSS20 extends Namespace {
} else if (ENCLOSURE.equals(localName)) {
String type = attributes.getValue(ENC_TYPE);
String url = attributes.getValue(ENC_URL);
- boolean validType = false;
- boolean validUrl = !TextUtils.isEmpty(url);
- if(SyndTypeUtils.enclosureTypeValid(type)) {
- validType = true;
- } else {
- type = SyndTypeUtils.getMimeTypeFromUrl(url);
- }
-
- if(SyndTypeUtils.enclosureTypeValid(type)) {
- validType = true;
- }
+ boolean validType = SyndTypeUtils.enclosureTypeValid(type);
+ if(!validType) {
+ type = SyndTypeUtils.getMimeTypeFromUrl(url);
+ validType = SyndTypeUtils.enclosureTypeValid(type);
+ }
- if (state.getCurrentItem() != null && state.getCurrentItem().getMedia() == null &&
+ boolean validUrl = !TextUtils.isEmpty(url);
+ if (state.getCurrentItem() != null && state.getCurrentItem().getMedia() == null &&
validType && validUrl) {
long size = 0;
try {