Merge branch 'develop' into exo-player

This commit is contained in:
ByteHamster 2018-07-13 19:26:09 +02:00
commit c2184cfab2
7 changed files with 30 additions and 17 deletions

View File

@ -317,7 +317,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
return handler.parseFeed(feed);
} catch (UnsupportedFeedtypeException e) {
Log.d(TAG, "Unsupported feed type detected");
if (TextUtils.equals("html", e.getRootElement().toLowerCase())) {
if ("html".equalsIgnoreCase(e.getRootElement())) {
showFeedDiscoveryDialog(new File(feed.getFile_url()), feed.getDownload_url());
return null;
} else {
@ -342,6 +342,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
String errorMsg = DownloadError.ERROR_PARSER_EXCEPTION.getErrorString(
OnlineFeedViewActivity.this) + " (" + error.getMessage() + ")";
showErrorDialog(errorMsg);
Log.d(TAG, "Feed parser exception: " + Log.getStackTraceString(error));
});
}

View File

@ -34,7 +34,7 @@ public class EpisodesApplyActionFragment extends Fragment {
public static final String TAG = "EpisodeActionFragment";
private static final int ACTION_QUEUE = 1;
public static final int ACTION_QUEUE = 1;
private static final int ACTION_MARK_PLAYED = 2;
private static final int ACTION_MARK_UNPLAYED = 4;
private static final int ACTION_DOWNLOAD = 8;

View File

@ -149,7 +149,7 @@ public class CompletedDownloadsFragment extends ListFragment {
switch (item.getItemId()) {
case R.id.episode_actions:
EpisodesApplyActionFragment fragment = EpisodesApplyActionFragment
.newInstance(items, EpisodesApplyActionFragment.ACTION_REMOVE);
.newInstance(items, EpisodesApplyActionFragment.ACTION_REMOVE | EpisodesApplyActionFragment.ACTION_QUEUE);
((MainActivity) getActivity()).loadChildFragment(fragment);
return true;
default:

View File

@ -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 = "";

View File

@ -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);

View File

@ -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";

View File

@ -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;
}