diff options
5 files changed, 58 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java index d97ede0ef..24991144e 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.fragment; import android.app.Activity; import android.content.Context; +import android.content.DialogInterface; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; @@ -29,6 +30,7 @@ import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.adapter.DefaultActionButtonCallback; import de.danoeh.antennapod.adapter.NewEpisodesListAdapter; 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; @@ -190,8 +192,19 @@ public class NewEpisodesFragment extends Fragment { } return true; case R.id.mark_all_read_item: - DBWriter.markAllItemsRead(getActivity()); - Toast.makeText(getActivity(), R.string.mark_all_read_msg, Toast.LENGTH_SHORT).show(); + ConfirmationDialog conDialog = new ConfirmationDialog(getActivity(), + R.string.mark_all_read_label, + R.string.mark_all_read_confirmation_msg) { + + @Override + public void onConfirmButtonPressed( + DialogInterface dialog) { + dialog.dismiss(); + DBWriter.markAllItemsRead(getActivity()); + Toast.makeText(getActivity(), R.string.mark_all_read_msg, Toast.LENGTH_SHORT).show(); + } + }; + conDialog.createNewDialog().show(); return true; case R.id.episode_filter_item: boolean newVal = !item.isChecked(); 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..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; @@ -175,6 +176,21 @@ public class QueueFragment extends Fragment { DBTasks.refreshAllFeeds(getActivity(), feeds); } 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: QueueSorter.sort(getActivity(), QueueSorter.Rule.ALPHA_ASC, true); return true; diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java index b62fd22b2..efb4adb01 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java @@ -1,6 +1,7 @@ package de.danoeh.antennapod.menuhandler; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.util.Log; @@ -10,6 +11,7 @@ import android.view.MenuItem; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.BuildConfig; +import de.danoeh.antennapod.core.dialog.ConfirmationDialog; import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; @@ -51,8 +53,8 @@ public class FeedMenuHandler { * * @throws DownloadRequestException */ - public static boolean onOptionsItemClicked(Context context, MenuItem item, - Feed selectedFeed) throws DownloadRequestException { + public static boolean onOptionsItemClicked(final Context context, final MenuItem item, + final Feed selectedFeed) throws DownloadRequestException { switch (item.getItemId()) { case R.id.refresh_item: DBTasks.refreshFeed(context, selectedFeed); @@ -61,7 +63,18 @@ public class FeedMenuHandler { DBTasks.refreshCompleteFeed(context, selectedFeed); break; case R.id.mark_all_read_item: - DBWriter.markFeedRead(context, selectedFeed.getId()); + ConfirmationDialog conDialog = new ConfirmationDialog(context, + R.string.mark_all_read_label, + R.string.mark_all_read_feed_confirmation_msg) { + + @Override + public void onConfirmButtonPressed( + DialogInterface dialog) { + dialog.dismiss(); + DBWriter.markFeedRead(context, selectedFeed.getId()); + } + }; + conDialog.createNewDialog().show(); break; case R.id.visit_website_item: Uri uri = Uri.parse(selectedFeed.getLink()); 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 @@ -11,6 +11,13 @@ 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 android:id="@+id/queue_sort" android:title="@string/sort"> diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 277d7d3c0..9b7cb3585 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -79,6 +79,8 @@ <!-- Actions on feeds --> <string name="mark_all_read_label">Mark all as read</string> <string name="mark_all_read_msg">Marked all episodes as read</string> + <string name="mark_all_read_confirmation_msg">Please confirm that you want to mark all episodes as being read.</string> + <string name="mark_all_read_feed_confirmation_msg">Please confirm that you want to mark all episodes in this feed as being read.</string> <string name="show_info_label">Show information</string> <string name="remove_feed_label">Remove podcast</string> <string name="share_link_label">Share website link</string> @@ -165,6 +167,7 @@ <string name="duration">Duration</string> <string name="ascending">Ascending</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 --> <string name="flattr_auth_label">Flattr sign-in</string> |