Merge pull request #2096 from domingos86/fix-cover-fragment
fix cover fragment onMediaChanged
This commit is contained in:
commit
8da8bf6af6
|
@ -69,16 +69,18 @@ public class ChaptersFragment extends ListFragment implements MediaplayerInfoCon
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMediaChanged(Playable media) {
|
public void onMediaChanged(Playable media) {
|
||||||
if(this.media == media || adapter == null) {
|
if(this.media == media) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.media = media;
|
this.media = media;
|
||||||
adapter.setMedia(media);
|
if (adapter != null) {
|
||||||
adapter.notifyDataSetChanged();
|
adapter.setMedia(media);
|
||||||
if(media == null || media.getChapters() == null || media.getChapters().size() == 0) {
|
adapter.notifyDataSetChanged();
|
||||||
setEmptyText(getString(R.string.no_items_label));
|
if(media == null || media.getChapters() == null || media.getChapters().size() == 0) {
|
||||||
} else {
|
setEmptyText(getString(R.string.no_items_label));
|
||||||
setEmptyText(null);
|
} else {
|
||||||
|
setEmptyText(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,22 +33,15 @@ public class CoverFragment extends Fragment implements MediaplayerInfoContentFra
|
||||||
|
|
||||||
public static CoverFragment newInstance(Playable item) {
|
public static CoverFragment newInstance(Playable item) {
|
||||||
CoverFragment f = new CoverFragment();
|
CoverFragment f = new CoverFragment();
|
||||||
if (item != null) {
|
f.media = item;
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putParcelable(ARG_PLAYABLE, item);
|
|
||||||
f.setArguments(args);
|
|
||||||
}
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
Bundle args = getArguments();
|
if (media == null) {
|
||||||
if (args != null) {
|
Log.e(TAG, TAG + " was called without media");
|
||||||
media = args.getParcelable(ARG_PLAYABLE);
|
|
||||||
} else {
|
|
||||||
Log.e(TAG, TAG + " was called with invalid arguments");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,11 +91,13 @@ public class CoverFragment extends Fragment implements MediaplayerInfoContentFra
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMediaChanged(Playable media) {
|
public void onMediaChanged(Playable media) {
|
||||||
if(!isAdded() || this.media == media) {
|
if(this.media == media) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.media = media;
|
this.media = media;
|
||||||
loadMediaInfo();
|
if (isAdded()) {
|
||||||
|
loadMediaInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,8 +185,10 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
if (args.containsKey(ARG_PLAYABLE)) {
|
if (args.containsKey(ARG_PLAYABLE)) {
|
||||||
media = args.getParcelable(ARG_PLAYABLE);
|
if (media == null) {
|
||||||
shownotesProvider = media;
|
media = args.getParcelable(ARG_PLAYABLE);
|
||||||
|
shownotesProvider = media;
|
||||||
|
}
|
||||||
load();
|
load();
|
||||||
} else if (args.containsKey(ARG_FEEDITEM_ID)) {
|
} else if (args.containsKey(ARG_FEEDITEM_ID)) {
|
||||||
long id = getArguments().getLong(ARG_FEEDITEM_ID);
|
long id = getArguments().getLong(ARG_FEEDITEM_ID);
|
||||||
|
@ -377,12 +379,14 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMediaChanged(Playable media) {
|
public void onMediaChanged(Playable media) {
|
||||||
if(this.media == media || webvDescription == null) {
|
if(this.media == media) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.media = media;
|
this.media = media;
|
||||||
this.shownotesProvider = media;
|
this.shownotesProvider = media;
|
||||||
load();
|
if (webvDescription != null) {
|
||||||
|
load();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue