Error handling for getMediaSize observable

This commit is contained in:
Martin Fietz 2015-09-23 19:15:33 +02:00
parent 155eeb49b3
commit 68e7695f39
3 changed files with 15 additions and 4 deletions

View File

@ -61,6 +61,7 @@ public class AdapterUtils {
txtvPos.setText(""); txtvPos.setText("");
} }
}, error -> { }, error -> {
txtvPos.setText("");
Log.e(TAG, Log.getStackTraceString(error)); Log.e(TAG, Log.getStackTraceString(error));
}); });
} else { } else {

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -124,13 +125,17 @@ public class AllEpisodesListAdapter extends BaseAdapter {
holder.txtvDuration.setText("{fa-spinner}"); holder.txtvDuration.setText("{fa-spinner}");
Iconify.addIcons(holder.txtvDuration); Iconify.addIcons(holder.txtvDuration);
NetworkUtils.getFeedMediaSizeObservable(media) NetworkUtils.getFeedMediaSizeObservable(media)
.subscribe(size -> { .subscribe(
size -> {
if (size > 0) { if (size > 0) {
holder.txtvDuration.setText(Converter.byteToString(size)); holder.txtvDuration.setText(Converter.byteToString(size));
} else { } else {
holder.txtvDuration.setText(""); holder.txtvDuration.setText("");
} }
}); }, error -> {
holder.txtvDuration.setText("");
Log.e(TAG, Log.getStackTraceString(error));
});
} else { } else {
holder.txtvDuration.setText(""); holder.txtvDuration.setText("");
} }

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -147,13 +148,17 @@ public class QueueListAdapter extends BaseAdapter {
holder.progressLeft.setText("{fa-spinner}"); holder.progressLeft.setText("{fa-spinner}");
Iconify.addIcons(holder.progressLeft); Iconify.addIcons(holder.progressLeft);
NetworkUtils.getFeedMediaSizeObservable(media) NetworkUtils.getFeedMediaSizeObservable(media)
.subscribe(size -> { .subscribe(
size -> {
if (size > 0) { if (size > 0) {
holder.progressLeft.setText(Converter.byteToString(size)); holder.progressLeft.setText(Converter.byteToString(size));
} else { } else {
holder.progressLeft.setText(""); holder.progressLeft.setText("");
} }
}); }, error -> {
holder.progressLeft.setText("");
Log.e(TAG, Log.getStackTraceString(error));
});
} else { } else {
holder.progressLeft.setText(""); holder.progressLeft.setText("");
} }