diff options
author | ByteHamster <info@bytehamster.com> | 2018-07-13 19:26:09 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2018-07-13 19:26:09 +0200 |
commit | c2184cfab20aafbed70a30ee1d8f23c67f552d2b (patch) | |
tree | a0a5232c70a54e726a6abcf6c11606c528b5f655 /core | |
parent | 626621044f0dcb77080400d86571ca4a46043b06 (diff) | |
parent | 740e202d7f1a2279c2b3e1fb5c3bdab9829818a3 (diff) | |
download | AntennaPod-c2184cfab20aafbed70a30ee1d8f23c67f552d2b.zip |
Merge branch 'develop' into exo-player
Diffstat (limited to 'core')
4 files changed, 26 insertions, 14 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java index 5eb5145e8..456d05ded 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.core.storage; import android.database.Cursor; import android.support.v4.util.ArrayMap; +import android.text.TextUtils; import android.util.Log; import java.util.ArrayList; @@ -688,7 +689,7 @@ public final class DBReader { if (cursor.moveToFirst()) { String username = cursor.getString(0); String password = cursor.getString(1); - if (username != null && password != null) { + if (!TextUtils.isEmpty(username) && password != null) { credentials = username + ":" + password; } else { credentials = ""; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java index ee0a71f30..b4c77e58d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java @@ -54,18 +54,19 @@ public class TypeGetter { return Type.ATOM; case RSS_ROOT: String strVersion = xpp.getAttributeValue(null, "version"); - if (strVersion != null) { - if (strVersion.equals("2.0")) { - feed.setType(Feed.TYPE_RSS2); - Log.d(TAG, "Recognized type RSS 2.0"); - return Type.RSS20; - } else if (strVersion.equals("0.91") - || strVersion.equals("0.92")) { - Log.d(TAG, "Recognized type RSS 0.91/0.92"); - return Type.RSS091; - } + if (strVersion == null) { + feed.setType(Feed.TYPE_RSS2); + Log.d(TAG, "Assuming type RSS 2.0"); + return Type.RSS20; + } else if (strVersion.equals("2.0")) { + feed.setType(Feed.TYPE_RSS2); + Log.d(TAG, "Recognized type RSS 2.0"); + return Type.RSS20; + } else if (strVersion.equals("0.91") || strVersion.equals("0.92")) { + Log.d(TAG, "Recognized type RSS 0.91/0.92"); + return Type.RSS091; } - throw new UnsupportedFeedtypeException(Type.INVALID); + throw new UnsupportedFeedtypeException("Unsupported rss version"); default: Log.d(TAG, "Type is invalid"); throw new UnsupportedFeedtypeException(Type.INVALID, tag); diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java index 606f93faf..fd7d0a4e1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java @@ -5,7 +5,8 @@ import de.danoeh.antennapod.core.syndication.handler.TypeGetter.Type; public class UnsupportedFeedtypeException extends Exception { private static final long serialVersionUID = 9105878964928170669L; private final TypeGetter.Type type; - private String rootElement; + private String rootElement; + private String message = null; public UnsupportedFeedtypeException(Type type) { super(); @@ -17,6 +18,11 @@ public class UnsupportedFeedtypeException extends Exception { this.rootElement = rootElement; } + public UnsupportedFeedtypeException(String message) { + this.message = message; + type = Type.INVALID; + } + public TypeGetter.Type getType() { return type; } @@ -27,7 +33,9 @@ public class UnsupportedFeedtypeException extends Exception { @Override public String getMessage() { - if (type == TypeGetter.Type.INVALID) { + if (message != null) { + return message; + } else if (type == TypeGetter.Type.INVALID) { return "Invalid type"; } else { return "Type " + type + " not supported"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java index 1c42364ea..2a537dc62 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java @@ -41,6 +41,7 @@ public class NotificationUtils { NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID_DOWNLOADING, c.getString(R.string.notification_channel_downloading), NotificationManager.IMPORTANCE_LOW); mChannel.setDescription(c.getString(R.string.notification_channel_downloading_description)); + mChannel.setShowBadge(false); return mChannel; } @@ -49,6 +50,7 @@ public class NotificationUtils { NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID_PLAYING, c.getString(R.string.notification_channel_playing), NotificationManager.IMPORTANCE_LOW); mChannel.setDescription(c.getString(R.string.notification_channel_playing_description)); + mChannel.setShowBadge(false); return mChannel; } |