fix onMediaChanged() for ChaptersFragment

This commit is contained in:
Domingos Lopes 2016-08-07 20:39:14 -04:00
parent c2be62f976
commit 0c2313b265
1 changed files with 9 additions and 7 deletions

View File

@ -69,16 +69,18 @@ public class ChaptersFragment extends ListFragment implements MediaplayerInfoCon
@Override
public void onMediaChanged(Playable media) {
if(this.media == media || adapter == null) {
if(this.media == media) {
return;
}
this.media = media;
adapter.setMedia(media);
adapter.notifyDataSetChanged();
if(media == null || media.getChapters() == null || media.getChapters().size() == 0) {
setEmptyText(getString(R.string.no_items_label));
} else {
setEmptyText(null);
if (adapter != null) {
adapter.setMedia(media);
adapter.notifyDataSetChanged();
if(media == null || media.getChapters() == null || media.getChapters().size() == 0) {
setEmptyText(getString(R.string.no_items_label));
} else {
setEmptyText(null);
}
}
}