Merge pull request #1218 from mfietz/issue/1217-onError-handling

Error handling for getMediaSize observable
This commit is contained in:
Tom Hennen 2015-09-26 08:59:39 -04:00
commit fc4d9225bf
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("");
}