added move to top to individual items in the episode queue. Move to bottom coming soon.
This commit is contained in:
parent
82bdfe05ac
commit
2d83b39c27
|
@ -67,6 +67,10 @@
|
|||
android:showAsAction="collapseActionView"
|
||||
android:title="@string/support_label">
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/move_to_top_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
android:title="@string/move_to_top_label">
|
||||
</item>
|
||||
|
||||
</menu>
|
|
@ -250,5 +250,6 @@
|
|||
<string name="folder_not_empty_dialog_title">Folder is not empty</string>
|
||||
<string name="folder_not_empty_dialog_msg">The folder you have selected is not empty. Media downloads and other files will be placed directly in this folder. Continue anyway?</string>
|
||||
<string name="set_to_default_folder">Choose default folder</string>
|
||||
<string name="move_to_top_label">Move to top</string>
|
||||
|
||||
</resources>
|
|
@ -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");
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue