diff options
Diffstat (limited to 'src/de/danoeh/antennapod/activity/DownloadLogActivity.java')
-rw-r--r-- | src/de/danoeh/antennapod/activity/DownloadLogActivity.java | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/de/danoeh/antennapod/activity/DownloadLogActivity.java b/src/de/danoeh/antennapod/activity/DownloadLogActivity.java index 11a15accb..2c19b5649 100644 --- a/src/de/danoeh/antennapod/activity/DownloadLogActivity.java +++ b/src/de/danoeh/antennapod/activity/DownloadLogActivity.java @@ -1,5 +1,9 @@ package de.danoeh.antennapod.activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.os.Bundle; import com.actionbarsherlock.app.SherlockListActivity; @@ -9,7 +13,10 @@ import com.actionbarsherlock.view.MenuItem; import de.danoeh.antennapod.adapter.DownloadLogAdapter; import de.danoeh.antennapod.feed.FeedManager; -/** Displays completed and failed downloads in a list. The data comes from the FeedManager. */ +/** + * Displays completed and failed downloads in a list. The data comes from the + * FeedManager. + */ public class DownloadLogActivity extends SherlockListActivity { private static final String TAG = "DownloadLogActivity"; @@ -27,6 +34,20 @@ public class DownloadLogActivity extends SherlockListActivity { } @Override + protected void onPause() { + super.onPause(); + unregisterReceiver(contentUpdate); + } + + @Override + protected void onResume() { + super.onResume(); + registerReceiver(contentUpdate, new IntentFilter( + FeedManager.ACTION_DOWNLOADLOG_UPDATE)); + dla.notifyDataSetChanged(); + } + + @Override public boolean onCreateOptionsMenu(Menu menu) { return true; } @@ -43,4 +64,15 @@ public class DownloadLogActivity extends SherlockListActivity { return true; } + private BroadcastReceiver contentUpdate = new BroadcastReceiver() { + + @Override + public void onReceive(Context context, Intent intent) { + if (intent.getAction() + .equals(FeedManager.ACTION_DOWNLOADLOG_UPDATE)) { + dla.notifyDataSetChanged(); + } + } + }; + } |