summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fietz <Martin.Fietz@gmail.com>2016-01-26 11:50:12 +0100
committerMartin Fietz <Martin.Fietz@gmail.com>2016-01-26 11:50:12 +0100
commit59129c6c88f8168b2b20c8543e68e5775a1c2a7f (patch)
tree791e51393949da09107223794168840dbf539298
parentb41aaff2ddac3faca4c03c8931fbaec899f4f25c (diff)
downloadAntennaPod-59129c6c88f8168b2b20c8543e68e5775a1c2a7f.zip
Tell player fragments to refresh
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java16
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java6
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java11
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java5
4 files changed, 26 insertions, 12 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java
index 21c81f9e4..0ec24134d 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java
@@ -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,16 +281,18 @@ 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) {
- adapter.notifyDataSetChanged();
+ ChaptersFragment chaptersFragment = mPagerAdapter.getChaptersFragment();
+ if(chaptersFragment != null) {
+ ChaptersListAdapter adapter = (ChaptersListAdapter) chaptersFragment.getListAdapter();
+ if (adapter != null) {
+ adapter.notifyDataSetChanged();
+ }
}
}
@@ -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 {
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java
index 513e2f449..51e4d801a 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java
@@ -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) {
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java
index e1265d2d3..a851358a0 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java
@@ -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();
}
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
index 9790e66b3..1bfba4632 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
@@ -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();