diff options
author | Cj Malone <Cj-Malone@users.noreply.github.com> | 2016-07-25 09:44:17 +0100 |
---|---|---|
committer | Cj Malone <Cj-Malone@users.noreply.github.com> | 2016-07-25 09:44:17 +0100 |
commit | d4d696d83a298cb31a7c33afc559814248ea0204 (patch) | |
tree | 00395198178e84fa1d4f8d3ebfbf13b2577b6ef3 | |
parent | 8e281890dd1a41cbb969e32c16d57f6ecff93953 (diff) | |
download | AntennaPod-d4d696d83a298cb31a7c33afc559814248ea0204.zip |
Format NSMedia.java
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java index 7a8b2bc03..7e4e090b4 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java @@ -26,19 +26,19 @@ public class NSMedia extends Namespace { @Override public SyndElement handleElementStart(String localName, HandlerState state, - Attributes attributes) { + Attributes attributes) { if (CONTENT.equals(localName)) { String url = attributes.getValue(DOWNLOAD_URL); String type = attributes.getValue(MIME_TYPE); - boolean validType; - if(SyndTypeUtils.enclosureTypeValid(type)) { - validType = true; - } else { - type = SyndTypeUtils.getValidMimeTypeFromUrl(url); - validType = type != null; - } - if (state.getCurrentItem() != null && state.getCurrentItem().getMedia() == null && - url != null && validType) { + boolean validType; + if (SyndTypeUtils.enclosureTypeValid(type)) { + validType = true; + } else { + type = SyndTypeUtils.getValidMimeTypeFromUrl(url); + validType = type != null; + } + if (state.getCurrentItem() != null && state.getCurrentItem().getMedia() == null && + url != null && validType) { long size = 0; String sizeStr = attributes.getValue(SIZE); try { @@ -51,14 +51,14 @@ public class NSMedia extends Namespace { String durationStr = attributes.getValue(DURATION); if (!TextUtils.isEmpty(durationStr)) { try { - long duration = Long.parseLong(durationStr); + long duration = Long.parseLong(durationStr); durationMs = (int) TimeUnit.MILLISECONDS.convert(duration, TimeUnit.SECONDS); } catch (NumberFormatException e) { Log.e(TAG, "Duration \"" + durationStr + "\" could not be parsed"); } } FeedMedia media = new FeedMedia(state.getCurrentItem(), url, size, type); - if(durationMs > 0) { + if (durationMs > 0) { media.setDuration(durationMs); } state.getCurrentItem().setMedia(media); @@ -71,5 +71,4 @@ public class NSMedia extends Namespace { public void handleElementEnd(String localName, HandlerState state) { } - -} +}
\ No newline at end of file |