summaryrefslogtreecommitdiff
path: root/src/de/danoeh
diff options
context:
space:
mode:
authorTom Hennen <tom.hennen@gmail.com>2013-08-16 14:39:54 -0400
committerTom Hennen <tom.hennen@gmail.com>2013-08-16 14:39:54 -0400
commit2d83b39c27a32f51776dac14b032a72e0c3fbef8 (patch)
treef3d88f7920d1c37b8b6609902b6e87783f0af4a8 /src/de/danoeh
parent82bdfe05ac9ced9ffff2469e8ec1dacf88a3f166 (diff)
downloadAntennaPod-2d83b39c27a32f51776dac14b032a72e0c3fbef8.zip
added move to top to individual items in the episode queue. Move to bottom coming soon.
Diffstat (limited to 'src/de/danoeh')
-rw-r--r--src/de/danoeh/antennapod/storage/DBWriter.java23
-rw-r--r--src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java3
2 files changed, 21 insertions, 5 deletions
diff --git a/src/de/danoeh/antennapod/storage/DBWriter.java b/src/de/danoeh/antennapod/storage/DBWriter.java
index 9946783e9..c34f134ff 100644
--- a/src/de/danoeh/antennapod/storage/DBWriter.java
+++ b/src/de/danoeh/antennapod/storage/DBWriter.java
@@ -480,11 +480,24 @@ public class DBWriter {
.getQueue(context, adapter);
if (queue != null) {
- if (queue.remove(selectedItem)) {
- // it was removed, put it on the front
- queue.add(0, selectedItem);
- } else {
- Log.e(TAG, "moveQueueItemToTop: Could not move to top, no such item");
+ // it seems like there should be a better way to get
+ // the item we need, but iterating seems to be the
+ // only way
+ for (FeedItem item : queue) {
+ if (item.getId() == selectedItem.getId()) {
+ if (queue.remove(item)) {
+ queue.add(0, item);
+ Log.d(TAG, "moveQueueItemToTop: moved");
+ adapter.setQueue(queue);
+ if (broadcastUpdate) {
+ EventDistributor.getInstance()
+ .sendQueueUpdateBroadcast();
+ }
+ } else {
+ Log.e(TAG, "moveQueueItemToTop: Could not move to top, no such item");
+ }
+ break;
+ }
}
} else {
Log.e(TAG, "moveQueueItemToTop: Could not move to top, no queue");
diff --git a/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java b/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java
index aa029f672..4b99b47fb 100644
--- a/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java
+++ b/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java
@@ -150,6 +150,9 @@ public class FeedItemMenuHandler {
DBTasks.playMedia(context, selectedItem.getMedia(), true, true,
true);
break;
+ case R.id.move_to_top_item:
+ DBWriter.moveQueueItemToTop(context, selectedItem, true);
+ break;
case R.id.visit_website_item:
Uri uri = Uri.parse(selectedItem.getLink());
context.startActivity(new Intent(Intent.ACTION_VIEW, uri));