Eventdistributor listener was registered incorrectly

This commit is contained in:
daniel oeh 2013-08-30 21:53:15 +02:00
parent 3c08859517
commit 42a39b3cfc
1 changed files with 13 additions and 12 deletions

View File

@ -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);
}
@ -184,17 +197,6 @@ public class ItemlistFragment extends ListFragment {
adapterCallback, showFeedtitle);
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onDestroy() {
super.onDestroy();
EventDistributor.getInstance().unregister(contentUpdate);
}
@Override
public void onResume() {
super.onResume();
@ -206,7 +208,6 @@ public class ItemlistFragment extends ListFragment {
}
});
updateProgressBarVisibility();
EventDistributor.getInstance().register(contentUpdate);
}
@Override