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) {
|
if(mPagerAdapter != null && controller != null && controller.getMedia() != media) {
|
||||||
media = controller.getMedia();
|
media = controller.getMedia();
|
||||||
mPagerAdapter.notifyDataSetChanged();
|
mPagerAdapter.onMediaChanged(media);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -281,18 +281,20 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
||||||
}
|
}
|
||||||
if(controller.getMedia() != media) {
|
if(controller.getMedia() != media) {
|
||||||
media = controller.getMedia();
|
media = controller.getMedia();
|
||||||
mPagerAdapter.notifyDataSetChanged();
|
mPagerAdapter.onMediaChanged(media);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyMediaPositionChanged() {
|
public void notifyMediaPositionChanged() {
|
||||||
ListFragment chapterFragment = (ListFragment) mPagerAdapter.getItem(POS_CHAPTERS);
|
ChaptersFragment chaptersFragment = mPagerAdapter.getChaptersFragment();
|
||||||
ChaptersListAdapter adapter = (ChaptersListAdapter) chapterFragment.getListAdapter();
|
if(chaptersFragment != null) {
|
||||||
if(adapter != null) {
|
ChaptersListAdapter adapter = (ChaptersListAdapter) chaptersFragment.getListAdapter();
|
||||||
|
if (adapter != null) {
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onReloadNotification(int notificationCode) {
|
protected void onReloadNotification(int notificationCode) {
|
||||||
|
@ -526,7 +528,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
|
||||||
};
|
};
|
||||||
|
|
||||||
public interface AudioplayerContentFragment {
|
public interface AudioplayerContentFragment {
|
||||||
void onDataSetChanged(Playable media);
|
void onMediaChanged(Playable media);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AudioplayerPagerAdapter extends FragmentStatePagerAdapter {
|
private class AudioplayerPagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
|
|
@ -61,7 +61,11 @@ public class ChaptersFragment extends ListFragment implements AudioplayerContent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataSetChanged(Playable media) {
|
public void onMediaChanged(Playable media) {
|
||||||
|
if(this.media == media) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.media = media;
|
||||||
adapter.setMedia(media);
|
adapter.setMedia(media);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
if(media.getChapters() == null) {
|
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.
|
* Displays the cover and the title of a FeedItem.
|
||||||
*/
|
*/
|
||||||
public class CoverFragment extends Fragment implements
|
public class CoverFragment extends Fragment implements AudioplayerContentFragment {
|
||||||
AudioplayerContentFragment {
|
|
||||||
private static final String TAG = "CoverFragment";
|
private static final String TAG = "CoverFragment";
|
||||||
private static final String ARG_PLAYABLE = "arg.playable";
|
private static final String ARG_PLAYABLE = "arg.playable";
|
||||||
|
|
||||||
|
@ -97,12 +97,17 @@ public class CoverFragment extends Fragment implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataSetChanged(Playable media) {
|
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
// prevent memory leaks
|
// prevent memory leaks
|
||||||
root = null;
|
root = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMediaChanged(Playable media) {
|
||||||
|
if(this.media == media) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.media = media;
|
this.media = media;
|
||||||
loadMediaInfo();
|
loadMediaInfo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,7 +384,10 @@ public class ItemDescriptionFragment extends Fragment implements AudioplayerCont
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataSetChanged(Playable media) {
|
public void onMediaChanged(Playable media) {
|
||||||
|
if(this.media == media) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.media = media;
|
this.media = media;
|
||||||
this.shownotesProvider = media;
|
this.shownotesProvider = media;
|
||||||
load();
|
load();
|
||||||
|
|
Loading…
Reference in New Issue