Added menu item to download all items in the queue
This commit is contained in:
parent
d71831e7ad
commit
ea7b7bbb73
|
@ -9,5 +9,6 @@
|
|||
<item type="id" name="deselect_all_item"/>
|
||||
<item type="id" name="search_item"/>
|
||||
<item name="enqueue_all_item" type="id"/>
|
||||
<item name="download_all_item" type="id"/>
|
||||
|
||||
</resources>
|
|
@ -367,6 +367,17 @@ public class FeedManager {
|
|||
|
||||
}
|
||||
|
||||
public void downloadAllItemsInQueue(final Context context) {
|
||||
DownloadRequester requester = DownloadRequester.getInstance();
|
||||
for (FeedItem item : queue) {
|
||||
if (item.getMedia() != null
|
||||
&& !requester.isDownloadingFile(item.getMedia())
|
||||
&& !item.getMedia().isDownloaded()) {
|
||||
requester.downloadMedia(context, item.getMedia());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void enqueueAllNewItems(final Context context) {
|
||||
if (!unreadItems.isEmpty()) {
|
||||
addQueueItem(context,
|
||||
|
|
|
@ -62,6 +62,8 @@ public class QueueFragment extends ItemlistFragment {
|
|||
super.onCreateOptionsMenu(menu, inflater);
|
||||
menu.add(Menu.NONE, R.id.clear_queue_item, Menu.NONE, getActivity()
|
||||
.getString(R.string.clear_queue_label));
|
||||
menu.add(Menu.NONE, R.id.download_all_item, Menu.NONE, getActivity()
|
||||
.getString(R.string.download_all));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,6 +72,10 @@ public class QueueFragment extends ItemlistFragment {
|
|||
case R.id.clear_queue_item:
|
||||
manager.clearQueue(getActivity());
|
||||
break;
|
||||
case R.id.download_all_item:
|
||||
manager.downloadAllItemsInQueue(getActivity());
|
||||
fila.notifyDataSetChanged();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue