Merge pull request #616 from TomHennen/empty_queue_command_593

Empty queue command 593
This commit is contained in:
Tom Hennen 2015-02-23 18:46:37 -05:00
commit 2316a260bb
3 changed files with 25 additions and 1 deletions

View File

@ -2,8 +2,8 @@ package de.danoeh.antennapod.fragment;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -30,6 +30,7 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.DefaultActionButtonCallback; import de.danoeh.antennapod.adapter.DefaultActionButtonCallback;
import de.danoeh.antennapod.adapter.QueueListAdapter; import de.danoeh.antennapod.adapter.QueueListAdapter;
import de.danoeh.antennapod.core.asynctask.DownloadObserver; import de.danoeh.antennapod.core.asynctask.DownloadObserver;
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
import de.danoeh.antennapod.core.feed.EventDistributor; import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
@ -175,6 +176,21 @@ public class QueueFragment extends Fragment {
DBTasks.refreshAllFeeds(getActivity(), feeds); DBTasks.refreshAllFeeds(getActivity(), feeds);
} }
return true; return true;
case R.id.clear_queue:
// make sure the user really wants to clear the queue
ConfirmationDialog conDialog = new ConfirmationDialog(getActivity(),
R.string.clear_queue_label,
R.string.clear_queue_confirmation_msg) {
@Override
public void onConfirmButtonPressed(
DialogInterface dialog) {
dialog.dismiss();
DBWriter.clearQueue(getActivity());
}
};
conDialog.createNewDialog().show();
return true;
case R.id.queue_sort_alpha_asc: case R.id.queue_sort_alpha_asc:
QueueSorter.sort(getActivity(), QueueSorter.Rule.ALPHA_ASC, true); QueueSorter.sort(getActivity(), QueueSorter.Rule.ALPHA_ASC, true);
return true; return true;

View File

@ -10,6 +10,13 @@
custom:showAsAction="ifRoom" custom:showAsAction="ifRoom"
android:icon="?attr/navigation_refresh"/> android:icon="?attr/navigation_refresh"/>
<item
android:id="@+id/clear_queue"
android:title="Clear Queue"
android:menuCategory="container"
custom:showAsAction="collapseActionView"
android:icon="?attr/navigation_accept"/>
<item <item
android:id="@+id/queue_sort" android:id="@+id/queue_sort"
android:title="@string/sort"> android:title="@string/sort">

View File

@ -167,6 +167,7 @@
<string name="duration">Duration</string> <string name="duration">Duration</string>
<string name="ascending">Ascending</string> <string name="ascending">Ascending</string>
<string name="descending">Descending</string> <string name="descending">Descending</string>
<string name="clear_queue_confirmation_msg">Please confirm that you want to clear the queue of ALL of the episodes in it</string>
<!-- Flattr --> <!-- Flattr -->
<string name="flattr_auth_label">Flattr sign-in</string> <string name="flattr_auth_label">Flattr sign-in</string>