From 85778b4aaa4a4cd2ae7fde80bb01afdc3632d123 Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Fri, 30 Jan 2015 10:40:15 -0500 Subject: [PATCH 1/2] Added option to empty/clear the queue. Used the word 'clear' because it seems more active than 'empty'. For issue #593 --- .../java/de/danoeh/antennapod/fragment/QueueFragment.java | 3 +++ app/src/main/res/menu/queue.xml | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index ca8543b4c..e71c425e0 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -175,6 +175,9 @@ public class QueueFragment extends Fragment { DBTasks.refreshAllFeeds(getActivity(), feeds); } return true; + case R.id.clear_queue: + DBWriter.clearQueue(getActivity()); + return true; case R.id.queue_sort_alpha_asc: QueueSorter.sort(getActivity(), QueueSorter.Rule.ALPHA_ASC, true); return true; diff --git a/app/src/main/res/menu/queue.xml b/app/src/main/res/menu/queue.xml index b85279e5a..51e47c061 100644 --- a/app/src/main/res/menu/queue.xml +++ b/app/src/main/res/menu/queue.xml @@ -10,6 +10,13 @@ custom:showAsAction="ifRoom" android:icon="?attr/navigation_refresh"/> + + From 2bea83706b37c7fe5d4b687236aaad4ccca6a0c9 Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Fri, 30 Jan 2015 12:55:38 -0500 Subject: [PATCH 2/2] added confirmation when clearing the queue. for issue #593 --- .../antennapod/fragment/QueueFragment.java | 17 +++++++++++++++-- core/src/main/res/values/strings.xml | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index e71c425e0..913b544a5 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -2,8 +2,8 @@ package de.danoeh.antennapod.fragment; import android.app.Activity; import android.content.Context; +import android.content.DialogInterface; import android.os.AsyncTask; -import android.os.Build; import android.os.Bundle; import android.os.Handler; 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.QueueListAdapter; 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.Feed; import de.danoeh.antennapod.core.feed.FeedItem; @@ -176,7 +177,19 @@ public class QueueFragment extends Fragment { } return true; case R.id.clear_queue: - DBWriter.clearQueue(getActivity()); + // 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: QueueSorter.sort(getActivity(), QueueSorter.Rule.ALPHA_ASC, true); diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 277d7d3c0..b855bddaf 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -165,6 +165,7 @@ Duration Ascending Descending + Please confirm that you want to clear the queue of ALL of the episodes in it Flattr sign-in