diff options
Diffstat (limited to 'src/de/danoeh')
4 files changed, 32 insertions, 29 deletions
diff --git a/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java b/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java index 47635b13a..9483defc8 100644 --- a/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java +++ b/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java @@ -25,7 +25,8 @@ import de.danoeh.antennapod.feed.FeedManager; import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.util.UndoBarController; -public class OrganizeQueueActivity extends SherlockListActivity implements UndoBarController.UndoListener { +public class OrganizeQueueActivity extends SherlockListActivity implements + UndoBarController.UndoListener { private static final String TAG = "OrganizeQueueActivity"; private static final int MENU_ID_ACCEPT = 2; @@ -46,7 +47,8 @@ public class OrganizeQueueActivity extends SherlockListActivity implements UndoB adapter = new OrganizeAdapter(this); setListAdapter(adapter); - undoBarController = new UndoBarController(findViewById(R.id.undobar), this); + undoBarController = new UndoBarController(findViewById(R.id.undobar), + this); } @Override @@ -89,9 +91,10 @@ public class OrganizeQueueActivity extends SherlockListActivity implements UndoB public void remove(int which) { FeedManager manager = FeedManager.getInstance(); FeedItem item = (FeedItem) getListAdapter().getItem(which); - manager.removeQueueItem(OrganizeQueueActivity.this, item); - undoBarController.showUndoBar(false, getString(R.string.removed_from_queue), - new UndoToken(item, which)); + manager.removeQueueItem(OrganizeQueueActivity.this, item, false); + undoBarController.showUndoBar(false, + getString(R.string.removed_from_queue), new UndoToken(item, + which)); } }; @@ -111,6 +114,8 @@ public class OrganizeQueueActivity extends SherlockListActivity implements UndoB public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_ID_ACCEPT: + FeedManager.getInstance().autodownloadUndownloadedItems( + getApplicationContext()); finish(); return true; default: @@ -126,14 +131,10 @@ public class OrganizeQueueActivity extends SherlockListActivity implements UndoB int position = undoToken.getPosition(); FeedManager manager = FeedManager.getInstance(); - manager.addQueueItemAt(OrganizeQueueActivity.this, feedItem, position, false); + manager.addQueueItemAt(OrganizeQueueActivity.this, feedItem, position, + false); } - /** - * WARNING: If the PlaybackService is playing an episode from the queue, - * this list adapter will ignore the first item in the list to make sure - * that the position of the first queue item cannot be changed. - */ private static class OrganizeAdapter extends BaseAdapter { private Context context; @@ -222,16 +223,15 @@ public class OrganizeQueueActivity extends SherlockListActivity implements UndoB position = in.readInt(); } - public static final Parcelable.Creator<UndoToken> CREATOR - = new Parcelable.Creator<UndoToken>() { - public UndoToken createFromParcel(Parcel in) { - return new UndoToken(in); - } + public static final Parcelable.Creator<UndoToken> CREATOR = new Parcelable.Creator<UndoToken>() { + public UndoToken createFromParcel(Parcel in) { + return new UndoToken(in); + } - public UndoToken[] newArray(int size) { - return new UndoToken[size]; - } - }; + public UndoToken[] newArray(int size) { + return new UndoToken[size]; + } + }; public int describeContents() { return 0; diff --git a/src/de/danoeh/antennapod/feed/FeedManager.java b/src/de/danoeh/antennapod/feed/FeedManager.java index bdffdc667..2fae55436 100644 --- a/src/de/danoeh/antennapod/feed/FeedManager.java +++ b/src/de/danoeh/antennapod/feed/FeedManager.java @@ -970,7 +970,8 @@ public class FeedManager { } /** Removes a FeedItem from the queue. */ - public void removeQueueItem(final Context context, FeedItem item) { + public void removeQueueItem(final Context context, FeedItem item, + final boolean performAutoDownload) { boolean removed = queue.remove(item); if (removed) { dbExec.execute(new Runnable() { @@ -985,12 +986,14 @@ public class FeedManager { }); } - new Thread() { - @Override - public void run() { - autodownloadUndownloadedItems(context); - } - }.start(); + if (performAutoDownload) { + new Thread() { + @Override + public void run() { + autodownloadUndownloadedItems(context); + } + }.start(); + } eventDist.sendQueueUpdateBroadcast(); } diff --git a/src/de/danoeh/antennapod/service/PlaybackService.java b/src/de/danoeh/antennapod/service/PlaybackService.java index 11da79015..47c73648a 100644 --- a/src/de/danoeh/antennapod/service/PlaybackService.java +++ b/src/de/danoeh/antennapod/service/PlaybackService.java @@ -730,7 +730,7 @@ public class PlaybackService extends Service { isInQueue = media instanceof FeedMedia && manager.isInQueue(((FeedMedia) media).getItem()); if (isInQueue) { - manager.removeQueueItem(PlaybackService.this, item); + manager.removeQueueItem(PlaybackService.this, item, true); } manager.addItemToPlaybackHistory(PlaybackService.this, item); manager.setFeedMedia(PlaybackService.this, (FeedMedia) media); diff --git a/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java b/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java index 64bcb1cf2..472124bf7 100644 --- a/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java +++ b/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java @@ -140,7 +140,7 @@ public class FeedItemMenuHandler { manager.addQueueItem(context, selectedItem); break; case R.id.remove_from_queue_item: - manager.removeQueueItem(context, selectedItem); + manager.removeQueueItem(context, selectedItem, true); break; case R.id.stream_item: manager.playMedia(context, selectedItem.getMedia(), true, true, |