Remove tab characters from last 6 files
This commit is contained in:
parent
c21edc8b79
commit
6c0f9eec62
|
@ -16,9 +16,9 @@ import de.danoeh.antennapod.core.storage.DBTasks;
|
|||
// Since the intent doesn't have the EXTRA_STATUS like the android.com article says it does
|
||||
// (though it used to)
|
||||
public class PowerConnectionReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "PowerConnectionReceiver";
|
||||
private static final String TAG = "PowerConnectionReceiver";
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
<property name="file" value="${config_loc}/suppressions.xml" />
|
||||
</module>
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="OuterTypeFilename"/>
|
||||
<module name="IllegalTokenText">
|
||||
|
|
|
@ -1,46 +1,48 @@
|
|||
package de.danoeh.antennapod.core.export.opml;
|
||||
|
||||
/** Represents a single feed in an OPML file. */
|
||||
/**
|
||||
* Represents a single feed in an OPML file.
|
||||
*/
|
||||
public class OpmlElement {
|
||||
private String text;
|
||||
private String xmlUrl;
|
||||
private String htmlUrl;
|
||||
private String type;
|
||||
private String text;
|
||||
private String xmlUrl;
|
||||
private String htmlUrl;
|
||||
private String type;
|
||||
|
||||
public OpmlElement() {
|
||||
public OpmlElement() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getXmlUrl() {
|
||||
return xmlUrl;
|
||||
}
|
||||
public String getXmlUrl() {
|
||||
return xmlUrl;
|
||||
}
|
||||
|
||||
public void setXmlUrl(String xmlUrl) {
|
||||
this.xmlUrl = xmlUrl;
|
||||
}
|
||||
public void setXmlUrl(String xmlUrl) {
|
||||
this.xmlUrl = xmlUrl;
|
||||
}
|
||||
|
||||
public String getHtmlUrl() {
|
||||
return htmlUrl;
|
||||
}
|
||||
public String getHtmlUrl() {
|
||||
return htmlUrl;
|
||||
}
|
||||
|
||||
public void setHtmlUrl(String htmlUrl) {
|
||||
this.htmlUrl = htmlUrl;
|
||||
}
|
||||
public void setHtmlUrl(String htmlUrl) {
|
||||
this.htmlUrl = htmlUrl;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,78 +12,81 @@ import java.util.ArrayList;
|
|||
|
||||
import de.danoeh.antennapod.core.BuildConfig;
|
||||
|
||||
/** Reads OPML documents. */
|
||||
/**
|
||||
* Reads OPML documents.
|
||||
*/
|
||||
public class OpmlReader {
|
||||
private static final String TAG = "OpmlReader";
|
||||
|
||||
// ATTRIBUTES
|
||||
private boolean isInOpml = false;
|
||||
private ArrayList<OpmlElement> elementList;
|
||||
private static final String TAG = "OpmlReader";
|
||||
|
||||
/**
|
||||
* Reads an Opml document and returns a list of all OPML elements it can
|
||||
* find
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws XmlPullParserException
|
||||
*/
|
||||
public ArrayList<OpmlElement> readDocument(Reader reader)
|
||||
throws XmlPullParserException, IOException {
|
||||
elementList = new ArrayList<>();
|
||||
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
XmlPullParser xpp = factory.newPullParser();
|
||||
xpp.setInput(reader);
|
||||
int eventType = xpp.getEventType();
|
||||
private boolean isInOpml = false;
|
||||
|
||||
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||
switch (eventType) {
|
||||
case XmlPullParser.START_DOCUMENT:
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Reached beginning of document");
|
||||
break;
|
||||
case XmlPullParser.START_TAG:
|
||||
if (xpp.getName().equals(OpmlSymbols.OPML)) {
|
||||
isInOpml = true;
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Reached beginning of OPML tree.");
|
||||
} else if (isInOpml && xpp.getName().equals(OpmlSymbols.OUTLINE)) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Found new Opml element");
|
||||
OpmlElement element = new OpmlElement();
|
||||
|
||||
final String title = xpp.getAttributeValue(null, OpmlSymbols.TITLE);
|
||||
if (title != null) {
|
||||
Log.i(TAG, "Using title: " + title);
|
||||
element.setText(title);
|
||||
} else {
|
||||
Log.i(TAG, "Title not found, using text");
|
||||
element.setText(xpp.getAttributeValue(null, OpmlSymbols.TEXT));
|
||||
}
|
||||
element.setXmlUrl(xpp.getAttributeValue(null, OpmlSymbols.XMLURL));
|
||||
element.setHtmlUrl(xpp.getAttributeValue(null, OpmlSymbols.HTMLURL));
|
||||
element.setType(xpp.getAttributeValue(null, OpmlSymbols.TYPE));
|
||||
if (element.getXmlUrl() != null) {
|
||||
if (element.getText() == null) {
|
||||
Log.i(TAG, "Opml element has no text attribute.");
|
||||
element.setText(element.getXmlUrl());
|
||||
}
|
||||
elementList.add(element);
|
||||
} else {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG,
|
||||
"Skipping element because of missing xml url");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
eventType = xpp.next();
|
||||
}
|
||||
/**
|
||||
* Reads an Opml document and returns a list of all OPML elements it can
|
||||
* find
|
||||
*/
|
||||
public ArrayList<OpmlElement> readDocument(Reader reader)
|
||||
throws XmlPullParserException, IOException {
|
||||
ArrayList<OpmlElement> elementList = new ArrayList<>();
|
||||
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
XmlPullParser xpp = factory.newPullParser();
|
||||
xpp.setInput(reader);
|
||||
int eventType = xpp.getEventType();
|
||||
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Parsing finished.");
|
||||
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||
switch (eventType) {
|
||||
case XmlPullParser.START_DOCUMENT:
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "Reached beginning of document");
|
||||
}
|
||||
break;
|
||||
case XmlPullParser.START_TAG:
|
||||
if (xpp.getName().equals(OpmlSymbols.OPML)) {
|
||||
isInOpml = true;
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "Reached beginning of OPML tree.");
|
||||
}
|
||||
} else if (isInOpml && xpp.getName().equals(OpmlSymbols.OUTLINE)) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "Found new Opml element");
|
||||
}
|
||||
OpmlElement element = new OpmlElement();
|
||||
|
||||
return elementList;
|
||||
}
|
||||
final String title = xpp.getAttributeValue(null, OpmlSymbols.TITLE);
|
||||
if (title != null) {
|
||||
Log.i(TAG, "Using title: " + title);
|
||||
element.setText(title);
|
||||
} else {
|
||||
Log.i(TAG, "Title not found, using text");
|
||||
element.setText(xpp.getAttributeValue(null, OpmlSymbols.TEXT));
|
||||
}
|
||||
element.setXmlUrl(xpp.getAttributeValue(null, OpmlSymbols.XMLURL));
|
||||
element.setHtmlUrl(xpp.getAttributeValue(null, OpmlSymbols.HTMLURL));
|
||||
element.setType(xpp.getAttributeValue(null, OpmlSymbols.TYPE));
|
||||
if (element.getXmlUrl() != null) {
|
||||
if (element.getText() == null) {
|
||||
Log.i(TAG, "Opml element has no text attribute.");
|
||||
element.setText(element.getXmlUrl());
|
||||
}
|
||||
elementList.add(element);
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "Skipping element because of missing xml url");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
eventType = xpp.next();
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "Parsing finished.");
|
||||
}
|
||||
|
||||
return elementList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,20 +2,22 @@ package de.danoeh.antennapod.core.export.opml;
|
|||
|
||||
import de.danoeh.antennapod.core.export.CommonSymbols;
|
||||
|
||||
/** Contains symbols for reading and writing OPML documents. */
|
||||
/**
|
||||
* Contains symbols for reading and writing OPML documents.
|
||||
*/
|
||||
final class OpmlSymbols extends CommonSymbols {
|
||||
|
||||
public static final String OPML = "opml";
|
||||
static final String OUTLINE = "outline";
|
||||
static final String TEXT = "text";
|
||||
static final String XMLURL = "xmlUrl";
|
||||
static final String HTMLURL = "htmlUrl";
|
||||
static final String TYPE = "type";
|
||||
static final String VERSION = "version";
|
||||
static final String DATE_CREATED = "dateCreated";
|
||||
|
||||
private OpmlSymbols() {
|
||||
|
||||
}
|
||||
|
||||
public static final String OPML = "opml";
|
||||
static final String OUTLINE = "outline";
|
||||
static final String TEXT = "text";
|
||||
static final String XMLURL = "xmlUrl";
|
||||
static final String HTMLURL = "htmlUrl";
|
||||
static final String TYPE = "type";
|
||||
static final String VERSION = "version";
|
||||
static final String DATE_CREATED = "dateCreated";
|
||||
|
||||
private OpmlSymbols() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import de.danoeh.antennapod.model.feed.Chapter;
|
|||
|
||||
public class ChapterStartTimeComparator implements Comparator<Chapter> {
|
||||
|
||||
@Override
|
||||
public int compare(Chapter lhs, Chapter rhs) {
|
||||
return Long.compare(lhs.getStart(), rhs.getStart());
|
||||
}
|
||||
@Override
|
||||
public int compare(Chapter lhs, Chapter rhs) {
|
||||
return Long.compare(lhs.getStart(), rhs.getStart());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,15 +5,15 @@ import java.util.Comparator;
|
|||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
|
||||
public class PlaybackCompletionDateComparator implements Comparator<FeedItem> {
|
||||
|
||||
public int compare(FeedItem lhs, FeedItem rhs) {
|
||||
if (lhs.getMedia() != null
|
||||
&& lhs.getMedia().getPlaybackCompletionDate() != null
|
||||
&& rhs.getMedia() != null
|
||||
&& rhs.getMedia().getPlaybackCompletionDate() != null) {
|
||||
return rhs.getMedia().getPlaybackCompletionDate()
|
||||
.compareTo(lhs.getMedia().getPlaybackCompletionDate());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compare(FeedItem lhs, FeedItem rhs) {
|
||||
if (lhs.getMedia() != null
|
||||
&& lhs.getMedia().getPlaybackCompletionDate() != null
|
||||
&& rhs.getMedia() != null
|
||||
&& rhs.getMedia().getPlaybackCompletionDate() != null) {
|
||||
return rhs.getMedia().getPlaybackCompletionDate()
|
||||
.compareTo(lhs.getMedia().getPlaybackCompletionDate());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue