Remove tab characters from last 6 files

This commit is contained in:
ByteHamster 2024-03-04 22:39:09 +01:00
parent c21edc8b79
commit 6c0f9eec62
7 changed files with 141 additions and 130 deletions

View File

@ -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 // Since the intent doesn't have the EXTRA_STATUS like the android.com article says it does
// (though it used to) // (though it used to)
public class PowerConnectionReceiver extends BroadcastReceiver { 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) { public void onReceive(Context context, Intent intent) {
final String action = intent.getAction(); final String action = intent.getAction();

View File

@ -11,6 +11,10 @@
<property name="file" value="${config_loc}/suppressions.xml" /> <property name="file" value="${config_loc}/suppressions.xml" />
</module> </module>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="TreeWalker"> <module name="TreeWalker">
<module name="OuterTypeFilename"/> <module name="OuterTypeFilename"/>
<module name="IllegalTokenText"> <module name="IllegalTokenText">

View File

@ -1,46 +1,48 @@
package de.danoeh.antennapod.core.export.opml; 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 { public class OpmlElement {
private String text; private String text;
private String xmlUrl; private String xmlUrl;
private String htmlUrl; private String htmlUrl;
private String type; private String type;
public OpmlElement() { public OpmlElement() {
} }
public String getText() { public String getText() {
return text; return text;
} }
public void setText(String text) { public void setText(String text) {
this.text = text; this.text = text;
} }
public String getXmlUrl() { public String getXmlUrl() {
return xmlUrl; return xmlUrl;
} }
public void setXmlUrl(String xmlUrl) { public void setXmlUrl(String xmlUrl) {
this.xmlUrl = xmlUrl; this.xmlUrl = xmlUrl;
} }
public String getHtmlUrl() { public String getHtmlUrl() {
return htmlUrl; return htmlUrl;
} }
public void setHtmlUrl(String htmlUrl) { public void setHtmlUrl(String htmlUrl) {
this.htmlUrl = htmlUrl; this.htmlUrl = htmlUrl;
} }
public String getType() { public String getType() {
return type; return type;
} }
public void setType(String type) { public void setType(String type) {
this.type = type; this.type = type;
} }
} }

View File

@ -12,78 +12,81 @@ import java.util.ArrayList;
import de.danoeh.antennapod.core.BuildConfig; import de.danoeh.antennapod.core.BuildConfig;
/** Reads OPML documents. */ /**
* Reads OPML documents.
*/
public class OpmlReader { public class OpmlReader {
private static final String TAG = "OpmlReader"; private static final String TAG = "OpmlReader";
// ATTRIBUTES private boolean isInOpml = false;
private boolean isInOpml = false;
private ArrayList<OpmlElement> elementList;
/** /**
* Reads an Opml document and returns a list of all OPML elements it can * Reads an Opml document and returns a list of all OPML elements it can
* find * find
* */
* @throws IOException public ArrayList<OpmlElement> readDocument(Reader reader)
* @throws XmlPullParserException throws XmlPullParserException, IOException {
*/ ArrayList<OpmlElement> elementList = new ArrayList<>();
public ArrayList<OpmlElement> readDocument(Reader reader) XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
throws XmlPullParserException, IOException { factory.setNamespaceAware(true);
elementList = new ArrayList<>(); XmlPullParser xpp = factory.newPullParser();
XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); xpp.setInput(reader);
factory.setNamespaceAware(true); int eventType = xpp.getEventType();
XmlPullParser xpp = factory.newPullParser();
xpp.setInput(reader);
int eventType = xpp.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) { while (eventType != XmlPullParser.END_DOCUMENT) {
switch (eventType) { switch (eventType) {
case XmlPullParser.START_DOCUMENT: case XmlPullParser.START_DOCUMENT:
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG) {
Log.d(TAG, "Reached beginning of document"); Log.d(TAG, "Reached beginning of document");
break; }
case XmlPullParser.START_TAG: break;
if (xpp.getName().equals(OpmlSymbols.OPML)) { case XmlPullParser.START_TAG:
isInOpml = true; if (xpp.getName().equals(OpmlSymbols.OPML)) {
if (BuildConfig.DEBUG) isInOpml = true;
Log.d(TAG, "Reached beginning of OPML tree."); if (BuildConfig.DEBUG) {
} else if (isInOpml && xpp.getName().equals(OpmlSymbols.OUTLINE)) { Log.d(TAG, "Reached beginning of OPML tree.");
if (BuildConfig.DEBUG) }
Log.d(TAG, "Found new Opml element"); } else if (isInOpml && xpp.getName().equals(OpmlSymbols.OUTLINE)) {
OpmlElement element = new OpmlElement(); if (BuildConfig.DEBUG) {
Log.d(TAG, "Found new Opml element");
}
OpmlElement element = new OpmlElement();
final String title = xpp.getAttributeValue(null, OpmlSymbols.TITLE); final String title = xpp.getAttributeValue(null, OpmlSymbols.TITLE);
if (title != null) { if (title != null) {
Log.i(TAG, "Using title: " + title); Log.i(TAG, "Using title: " + title);
element.setText(title); element.setText(title);
} else { } else {
Log.i(TAG, "Title not found, using text"); Log.i(TAG, "Title not found, using text");
element.setText(xpp.getAttributeValue(null, OpmlSymbols.TEXT)); element.setText(xpp.getAttributeValue(null, OpmlSymbols.TEXT));
} }
element.setXmlUrl(xpp.getAttributeValue(null, OpmlSymbols.XMLURL)); element.setXmlUrl(xpp.getAttributeValue(null, OpmlSymbols.XMLURL));
element.setHtmlUrl(xpp.getAttributeValue(null, OpmlSymbols.HTMLURL)); element.setHtmlUrl(xpp.getAttributeValue(null, OpmlSymbols.HTMLURL));
element.setType(xpp.getAttributeValue(null, OpmlSymbols.TYPE)); element.setType(xpp.getAttributeValue(null, OpmlSymbols.TYPE));
if (element.getXmlUrl() != null) { if (element.getXmlUrl() != null) {
if (element.getText() == null) { if (element.getText() == null) {
Log.i(TAG, "Opml element has no text attribute."); Log.i(TAG, "Opml element has no text attribute.");
element.setText(element.getXmlUrl()); element.setText(element.getXmlUrl());
} }
elementList.add(element); elementList.add(element);
} else { } else {
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG) {
Log.d(TAG, Log.d(TAG, "Skipping element because of missing xml url");
"Skipping element because of missing xml url"); }
} }
} }
break; break;
} default:
eventType = xpp.next(); break;
} }
eventType = xpp.next();
}
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG) {
Log.d(TAG, "Parsing finished."); Log.d(TAG, "Parsing finished.");
}
return elementList; return elementList;
} }
} }

View File

@ -2,20 +2,22 @@ package de.danoeh.antennapod.core.export.opml;
import de.danoeh.antennapod.core.export.CommonSymbols; 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 { final class OpmlSymbols extends CommonSymbols {
public static final String OPML = "opml"; public static final String OPML = "opml";
static final String OUTLINE = "outline"; static final String OUTLINE = "outline";
static final String TEXT = "text"; static final String TEXT = "text";
static final String XMLURL = "xmlUrl"; static final String XMLURL = "xmlUrl";
static final String HTMLURL = "htmlUrl"; static final String HTMLURL = "htmlUrl";
static final String TYPE = "type"; static final String TYPE = "type";
static final String VERSION = "version"; static final String VERSION = "version";
static final String DATE_CREATED = "dateCreated"; static final String DATE_CREATED = "dateCreated";
private OpmlSymbols() { private OpmlSymbols() {
} }
} }

View File

@ -6,9 +6,9 @@ import de.danoeh.antennapod.model.feed.Chapter;
public class ChapterStartTimeComparator implements Comparator<Chapter> { public class ChapterStartTimeComparator implements Comparator<Chapter> {
@Override @Override
public int compare(Chapter lhs, Chapter rhs) { public int compare(Chapter lhs, Chapter rhs) {
return Long.compare(lhs.getStart(), rhs.getStart()); return Long.compare(lhs.getStart(), rhs.getStart());
} }
} }

View File

@ -6,14 +6,14 @@ import de.danoeh.antennapod.model.feed.FeedItem;
public class PlaybackCompletionDateComparator implements Comparator<FeedItem> { public class PlaybackCompletionDateComparator implements Comparator<FeedItem> {
public int compare(FeedItem lhs, FeedItem rhs) { public int compare(FeedItem lhs, FeedItem rhs) {
if (lhs.getMedia() != null if (lhs.getMedia() != null
&& lhs.getMedia().getPlaybackCompletionDate() != null && lhs.getMedia().getPlaybackCompletionDate() != null
&& rhs.getMedia() != null && rhs.getMedia() != null
&& rhs.getMedia().getPlaybackCompletionDate() != null) { && rhs.getMedia().getPlaybackCompletionDate() != null) {
return rhs.getMedia().getPlaybackCompletionDate() return rhs.getMedia().getPlaybackCompletionDate()
.compareTo(lhs.getMedia().getPlaybackCompletionDate()); .compareTo(lhs.getMedia().getPlaybackCompletionDate());
} }
return 0; return 0;
} }
} }