added feed specific mark_all_read confirmation dialog. #596

This commit is contained in:
Tom Hennen 2015-01-30 13:43:16 -05:00
parent 49c714a5a5
commit 4b8a3c00ca
2 changed files with 17 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package de.danoeh.antennapod.menuhandler; package de.danoeh.antennapod.menuhandler;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.util.Log; import android.util.Log;
@ -10,6 +11,7 @@ import android.view.MenuItem;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.BuildConfig; 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.feed.Feed;
import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBTasks;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
@ -51,8 +53,8 @@ public class FeedMenuHandler {
* *
* @throws DownloadRequestException * @throws DownloadRequestException
*/ */
public static boolean onOptionsItemClicked(Context context, MenuItem item, public static boolean onOptionsItemClicked(final Context context, final MenuItem item,
Feed selectedFeed) throws DownloadRequestException { final Feed selectedFeed) throws DownloadRequestException {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.refresh_item: case R.id.refresh_item:
DBTasks.refreshFeed(context, selectedFeed); DBTasks.refreshFeed(context, selectedFeed);
@ -61,7 +63,18 @@ public class FeedMenuHandler {
DBTasks.refreshCompleteFeed(context, selectedFeed); DBTasks.refreshCompleteFeed(context, selectedFeed);
break; break;
case R.id.mark_all_read_item: case R.id.mark_all_read_item:
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()); DBWriter.markFeedRead(context, selectedFeed.getId());
}
};
conDialog.createNewDialog().show();
break; break;
case R.id.visit_website_item: case R.id.visit_website_item:
Uri uri = Uri.parse(selectedFeed.getLink()); Uri uri = Uri.parse(selectedFeed.getLink());

View File

@ -80,6 +80,7 @@
<string name="mark_all_read_label">Mark all as read</string> <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_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_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="show_info_label">Show information</string>
<string name="remove_feed_label">Remove podcast</string> <string name="remove_feed_label">Remove podcast</string>
<string name="share_link_label">Share website link</string> <string name="share_link_label">Share website link</string>