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("");
}
}, error -> {
txtvPos.setText("");
Log.e(TAG, Log.getStackTraceString(error));
});
} else {

View File

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

View File

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