Tell player fragments to refresh
This commit is contained in:
parent
b41aaff2dd
commit
59129c6c88
|
@ -169,7 +169,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
|||
}
|
||||
if(mPagerAdapter != null && controller != null && controller.getMedia() != media) {
|
||||
media = controller.getMedia();
|
||||
mPagerAdapter.notifyDataSetChanged();
|
||||
mPagerAdapter.onMediaChanged(media);
|
||||
}
|
||||
|
||||
|
||||
|
@ -281,18 +281,20 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
|||
}
|
||||
if(controller.getMedia() != media) {
|
||||
media = controller.getMedia();
|
||||
mPagerAdapter.notifyDataSetChanged();
|
||||
mPagerAdapter.onMediaChanged(media);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void notifyMediaPositionChanged() {
|
||||
ListFragment chapterFragment = (ListFragment) mPagerAdapter.getItem(POS_CHAPTERS);
|
||||
ChaptersListAdapter adapter = (ChaptersListAdapter) chapterFragment.getListAdapter();
|
||||
if(adapter != null) {
|
||||
ChaptersFragment chaptersFragment = mPagerAdapter.getChaptersFragment();
|
||||
if(chaptersFragment != null) {
|
||||
ChaptersListAdapter adapter = (ChaptersListAdapter) chaptersFragment.getListAdapter();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReloadNotification(int notificationCode) {
|
||||
|
@ -526,7 +528,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
|||
};
|
||||
|
||||
public interface AudioplayerContentFragment {
|
||||
void onDataSetChanged(Playable media);
|
||||
void onMediaChanged(Playable media);
|
||||
}
|
||||
|
||||
private class AudioplayerPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
|
|
@ -61,7 +61,11 @@ public class ChaptersFragment extends ListFragment implements AudioplayerContent
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDataSetChanged(Playable media) {
|
||||
public void onMediaChanged(Playable media) {
|
||||
if(this.media == media) {
|
||||
return;
|
||||
}
|
||||
this.media = media;
|
||||
adapter.setMedia(media);
|
||||
adapter.notifyDataSetChanged();
|
||||
if(media.getChapters() == null) {
|
||||
|
|
|
@ -19,8 +19,8 @@ import de.danoeh.antennapod.core.util.playback.Playable;
|
|||
/**
|
||||
* Displays the cover and the title of a FeedItem.
|
||||
*/
|
||||
public class CoverFragment extends Fragment implements
|
||||
AudioplayerContentFragment {
|
||||
public class CoverFragment extends Fragment implements AudioplayerContentFragment {
|
||||
|
||||
private static final String TAG = "CoverFragment";
|
||||
private static final String ARG_PLAYABLE = "arg.playable";
|
||||
|
||||
|
@ -97,12 +97,17 @@ public class CoverFragment extends Fragment implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDataSetChanged(Playable media) {
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
// prevent memory leaks
|
||||
root = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMediaChanged(Playable media) {
|
||||
if(this.media == media) {
|
||||
return;
|
||||
}
|
||||
this.media = media;
|
||||
loadMediaInfo();
|
||||
}
|
||||
|
|
|
@ -384,7 +384,10 @@ public class ItemDescriptionFragment extends Fragment implements AudioplayerCont
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDataSetChanged(Playable media) {
|
||||
public void onMediaChanged(Playable media) {
|
||||
if(this.media == media) {
|
||||
return;
|
||||
}
|
||||
this.media = media;
|
||||
this.shownotesProvider = media;
|
||||
load();
|
||||
|
|
Loading…
Reference in New Issue