summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2013-08-30 21:53:15 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2013-08-30 21:53:15 +0200
commit42a39b3cfc2b696278627584c1d5fae88a0f73a0 (patch)
tree50924fd6006a8b2ed7c6bde9eb5718847648f573 /src/de/danoeh/antennapod
parent3c08859517889f865d41c86c01b0111cc29e6d1a (diff)
downloadAntennaPod-42a39b3cfc2b696278627584c1d5fae88a0f73a0.zip
Eventdistributor listener was registered incorrectly
Diffstat (limited to 'src/de/danoeh/antennapod')
-rw-r--r--src/de/danoeh/antennapod/fragment/ItemlistFragment.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
index d6ef29fdd..282bb4d5c 100644
--- a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
+++ b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
@@ -60,6 +60,8 @@ public class ItemlistFragment extends ListFragment {
/** Argument for FeeditemlistAdapter */
protected boolean showFeedtitle;
+ private AsyncTask<Long, Void, Feed> currentLoadTask;
+
public ItemlistFragment(boolean showFeedtitle) {
super();
this.showFeedtitle = showFeedtitle;
@@ -118,9 +120,19 @@ public class ItemlistFragment extends ListFragment {
@Override
public void onStart() {
super.onStart();
+ EventDistributor.getInstance().register(contentUpdate);
loadData();
}
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ EventDistributor.getInstance().unregister(contentUpdate);
+ if (currentLoadTask != null) {
+ currentLoadTask.cancel(true);
+ }
+ }
+
protected void loadData() {
final long feedId;
if (feed == null) {
@@ -168,6 +180,7 @@ public class ItemlistFragment extends ListFragment {
}
}
};
+ currentLoadTask = loadTask;
loadTask.execute(feedId);
}
@@ -185,17 +198,6 @@ public class ItemlistFragment extends ListFragment {
}
@Override
- public void onPause() {
- super.onPause();
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- EventDistributor.getInstance().unregister(contentUpdate);
- }
-
- @Override
public void onResume() {
super.onResume();
getActivity().runOnUiThread(new Runnable() {
@@ -206,7 +208,6 @@ public class ItemlistFragment extends ListFragment {
}
});
updateProgressBarVisibility();
- EventDistributor.getInstance().register(contentUpdate);
}
@Override