summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/syndication
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/danoeh/antennapod/syndication')
-rw-r--r--src/de/danoeh/antennapod/syndication/handler/FeedHandler.java16
-rw-r--r--src/de/danoeh/antennapod/syndication/handler/HandlerState.java8
-rw-r--r--src/de/danoeh/antennapod/syndication/handler/SyndHandler.java27
-rw-r--r--src/de/danoeh/antennapod/syndication/handler/TypeGetter.java25
-rw-r--r--src/de/danoeh/antennapod/syndication/namespace/NSContent.java3
-rw-r--r--src/de/danoeh/antennapod/syndication/namespace/NSMedia.java13
-rw-r--r--src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java7
-rw-r--r--src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java7
-rw-r--r--src/de/danoeh/antennapod/syndication/namespace/Namespace.java3
-rw-r--r--src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java3
-rw-r--r--src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java4
-rw-r--r--src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java4
-rw-r--r--src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java3
13 files changed, 53 insertions, 70 deletions
diff --git a/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java b/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java
index 9b25d16c4..5576603b6 100644
--- a/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java
+++ b/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java
@@ -1,18 +1,16 @@
package de.danoeh.antennapod.syndication.handler;
-import java.io.File;
-import java.io.IOException;
-import java.io.Reader;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
+import de.danoeh.antennapod.feed.Feed;
import org.apache.commons.io.input.XmlStreamReader;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-import de.danoeh.antennapod.feed.Feed;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
public class FeedHandler {
diff --git a/src/de/danoeh/antennapod/syndication/handler/HandlerState.java b/src/de/danoeh/antennapod/syndication/handler/HandlerState.java
index e8687858b..a9a8bb934 100644
--- a/src/de/danoeh/antennapod/syndication/handler/HandlerState.java
+++ b/src/de/danoeh/antennapod/syndication/handler/HandlerState.java
@@ -1,14 +1,14 @@
package de.danoeh.antennapod.syndication.handler;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Stack;
-
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.syndication.namespace.Namespace;
import de.danoeh.antennapod.syndication.namespace.SyndElement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Stack;
+
/**
* Contains all relevant information to describe the current state of a
* SyndHandler.
diff --git a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java
index c51d054d4..15dc94d65 100644
--- a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java
+++ b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java
@@ -1,20 +1,13 @@
package de.danoeh.antennapod.syndication.handler;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
import android.util.Log;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.feed.Feed;
-import de.danoeh.antennapod.syndication.namespace.NSContent;
-import de.danoeh.antennapod.syndication.namespace.NSITunes;
-import de.danoeh.antennapod.syndication.namespace.NSMedia;
-import de.danoeh.antennapod.syndication.namespace.NSRSS20;
-import de.danoeh.antennapod.syndication.namespace.NSSimpleChapters;
-import de.danoeh.antennapod.syndication.namespace.Namespace;
-import de.danoeh.antennapod.syndication.namespace.SyndElement;
+import de.danoeh.antennapod.syndication.namespace.*;
import de.danoeh.antennapod.syndication.namespace.atom.NSAtom;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
/** Superclass for all SAX Handlers which process Syndication formats */
public class SyndHandler extends DefaultHandler {
@@ -84,28 +77,28 @@ public class SyndHandler extends DefaultHandler {
state.defaultNamespaces.push(new NSAtom());
} else if (prefix.equals(NSAtom.NSTAG)) {
state.namespaces.put(uri, new NSAtom());
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Recognized Atom namespace");
}
} else if (uri.equals(NSContent.NSURI)
&& prefix.equals(NSContent.NSTAG)) {
state.namespaces.put(uri, new NSContent());
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Recognized Content namespace");
} else if (uri.equals(NSITunes.NSURI)
&& prefix.equals(NSITunes.NSTAG)) {
state.namespaces.put(uri, new NSITunes());
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Recognized ITunes namespace");
} else if (uri.equals(NSSimpleChapters.NSURI)
&& prefix.matches(NSSimpleChapters.NSTAG)) {
state.namespaces.put(uri, new NSSimpleChapters());
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Recognized SimpleChapters namespace");
} else if (uri.equals(NSMedia.NSURI)
&& prefix.equals(NSMedia.NSTAG)) {
state.namespaces.put(uri, new NSMedia());
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Recognized media namespace");
}
}
diff --git a/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java b/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java
index d2454f2b9..0ac1b7ae2 100644
--- a/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java
+++ b/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java
@@ -1,18 +1,17 @@
package de.danoeh.antennapod.syndication.handler;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.Reader;
-
+import android.util.Log;
+import de.danoeh.antennapod.BuildConfig;
+import de.danoeh.antennapod.feed.Feed;
import org.apache.commons.io.input.XmlStreamReader;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
-import android.util.Log;
-import de.danoeh.antennapod.AppConfig;
-import de.danoeh.antennapod.feed.Feed;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.Reader;
/** Gets the type of a specific feed by reading the root element. */
public class TypeGetter {
@@ -40,7 +39,7 @@ public class TypeGetter {
String tag = xpp.getName();
if (tag.equals(ATOM_ROOT)) {
feed.setType(Feed.TYPE_ATOM1);
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Recognized type Atom");
return Type.ATOM;
} else if (tag.equals(RSS_ROOT)) {
@@ -50,12 +49,12 @@ public class TypeGetter {
if (strVersion.equals("2.0")) {
feed.setType(Feed.TYPE_RSS2);
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Recognized type RSS 2.0");
return Type.RSS20;
} else if (strVersion.equals("0.91")
|| strVersion.equals("0.92")) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG,
"Recognized type RSS 0.91/0.92");
return Type.RSS091;
@@ -63,7 +62,7 @@ public class TypeGetter {
}
throw new UnsupportedFeedtypeException(Type.INVALID);
} else {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Type is invalid");
throw new UnsupportedFeedtypeException(Type.INVALID);
}
@@ -78,7 +77,7 @@ public class TypeGetter {
e.printStackTrace();
}
}
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Type is invalid");
throw new UnsupportedFeedtypeException(Type.INVALID);
}
diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSContent.java b/src/de/danoeh/antennapod/syndication/namespace/NSContent.java
index 7f2a3e87d..9ad3026be 100644
--- a/src/de/danoeh/antennapod/syndication/namespace/NSContent.java
+++ b/src/de/danoeh/antennapod/syndication/namespace/NSContent.java
@@ -1,8 +1,7 @@
package de.danoeh.antennapod.syndication.namespace;
-import org.xml.sax.Attributes;
-
import de.danoeh.antennapod.syndication.handler.HandlerState;
+import org.xml.sax.Attributes;
public class NSContent extends Namespace {
public static final String NSTAG = "content";
diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSMedia.java b/src/de/danoeh/antennapod/syndication/namespace/NSMedia.java
index 053a81270..cc23167c1 100644
--- a/src/de/danoeh/antennapod/syndication/namespace/NSMedia.java
+++ b/src/de/danoeh/antennapod/syndication/namespace/NSMedia.java
@@ -1,14 +1,13 @@
package de.danoeh.antennapod.syndication.namespace;
-import java.util.concurrent.TimeUnit;
-
-import org.xml.sax.Attributes;
-
import android.util.Log;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.syndication.handler.HandlerState;
import de.danoeh.antennapod.syndication.util.SyndTypeUtils;
+import org.xml.sax.Attributes;
+
+import java.util.concurrent.TimeUnit;
/** Processes tags from the http://search.yahoo.com/mrss/ namespace. */
public class NSMedia extends Namespace {
@@ -38,7 +37,7 @@ public class NSMedia extends Namespace {
try {
size = Long.parseLong(attributes.getValue(SIZE));
} catch (NumberFormatException e) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Length attribute could not be parsed.");
}
@@ -50,7 +49,7 @@ public class NSMedia extends Namespace {
Long.parseLong(durationStr), TimeUnit.SECONDS);
}
} catch (NumberFormatException e) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Duration attribute could not be parsed");
}
diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java b/src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java
index 3eb49172d..9572f87ae 100644
--- a/src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java
+++ b/src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java
@@ -1,15 +1,14 @@
package de.danoeh.antennapod.syndication.namespace;
-import org.xml.sax.Attributes;
-
import android.util.Log;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.feed.FeedImage;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.syndication.handler.HandlerState;
import de.danoeh.antennapod.syndication.util.SyndDateUtils;
import de.danoeh.antennapod.syndication.util.SyndTypeUtils;
+import org.xml.sax.Attributes;
/**
* SAX-Parser for reading RSS-Feeds
@@ -57,7 +56,7 @@ public class NSRSS20 extends Namespace {
try {
size = Long.parseLong(attributes.getValue(ENC_LEN));
} catch (NumberFormatException e) {
- if (AppConfig.DEBUG)
+ if (BuildConfig.DEBUG)
Log.d(TAG, "Length attribute could not be parsed.");
}
state.getCurrentItem().setMedia(
diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java b/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java
index 55c26e812..3f983ee88 100644
--- a/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java
+++ b/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java
@@ -1,13 +1,12 @@
package de.danoeh.antennapod.syndication.namespace;
-import java.util.ArrayList;
-
-import org.xml.sax.Attributes;
-
import de.danoeh.antennapod.feed.Chapter;
import de.danoeh.antennapod.feed.SimpleChapter;
import de.danoeh.antennapod.syndication.handler.HandlerState;
import de.danoeh.antennapod.syndication.util.SyndDateUtils;
+import org.xml.sax.Attributes;
+
+import java.util.ArrayList;
public class NSSimpleChapters extends Namespace {
public static final String NSTAG = "psc|sc";
diff --git a/src/de/danoeh/antennapod/syndication/namespace/Namespace.java b/src/de/danoeh/antennapod/syndication/namespace/Namespace.java
index 9eafef71e..910131feb 100644
--- a/src/de/danoeh/antennapod/syndication/namespace/Namespace.java
+++ b/src/de/danoeh/antennapod/syndication/namespace/Namespace.java
@@ -1,8 +1,7 @@
package de.danoeh.antennapod.syndication.namespace;
-import org.xml.sax.Attributes;
-
import de.danoeh.antennapod.syndication.handler.HandlerState;
+import org.xml.sax.Attributes;
public abstract class Namespace {
diff --git a/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java b/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java
index fec20de2f..86b80d2ed 100644
--- a/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java
+++ b/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java
@@ -1,9 +1,8 @@
package de.danoeh.antennapod.syndication.namespace.atom;
-import org.apache.commons.lang3.StringEscapeUtils;
-
import de.danoeh.antennapod.syndication.namespace.Namespace;
import de.danoeh.antennapod.syndication.namespace.SyndElement;
+import org.apache.commons.lang3.StringEscapeUtils;
/** Represents Atom Element which contains text (content, title, summary). */
public class AtomText extends SyndElement {
diff --git a/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java b/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java
index bc68d6f6a..383b29fc8 100644
--- a/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java
+++ b/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java
@@ -1,7 +1,7 @@
package de.danoeh.antennapod.syndication.namespace.atom;
import android.util.Log;
-import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.feed.FeedImage;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
@@ -84,7 +84,7 @@ public class NSAtom extends Namespace {
size = Long.parseLong(strSize);
}
} catch (NumberFormatException e) {
- if (AppConfig.DEBUG) Log.d(TAG, "Length attribute could not be parsed.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Length attribute could not be parsed.");
}
String type = attributes.getValue(LINK_TYPE);
if (SyndTypeUtils.enclosureTypeValid(type)
diff --git a/src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java b/src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java
index a1ed01354..2c1cff914 100644
--- a/src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java
+++ b/src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java
@@ -1,12 +1,12 @@
package de.danoeh.antennapod.syndication.util;
+import android.util.Log;
+
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
-import android.util.Log;
-
/** Parses several date formats. */
public class SyndDateUtils {
private static final String TAG = "DateUtils";
diff --git a/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java b/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java
index fe7836d37..d0fa3a5fc 100644
--- a/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java
+++ b/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java
@@ -1,8 +1,7 @@
package de.danoeh.antennapod.syndication.util;
-import org.apache.commons.io.FilenameUtils;
-
import android.webkit.MimeTypeMap;
+import org.apache.commons.io.FilenameUtils;
/** Utility class for handling MIME-Types of enclosures */
public class SyndTypeUtils {