From 9da4f1e5f7dcac93176795b65b24cde9a0a901ea Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 9 Sep 2013 13:52:16 +0400 Subject: [PATCH] confirm if necessary catching up feed from context menu --- res/values/strings.xml | 1 + src/org/fox/ttrss/FeedCategoriesFragment.java | 34 +++++++++++++++++-- src/org/fox/ttrss/FeedsFragment.java | 33 ++++++++++++++++-- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index a05188d8..e4ef4831 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -200,4 +200,5 @@ by %1$s %1$d unread articles Headline text size + Mark all articles in %1$s as read? diff --git a/src/org/fox/ttrss/FeedCategoriesFragment.java b/src/org/fox/ttrss/FeedCategoriesFragment.java index 559a72d4..f2c6d522 100644 --- a/src/org/fox/ttrss/FeedCategoriesFragment.java +++ b/src/org/fox/ttrss/FeedCategoriesFragment.java @@ -13,7 +13,10 @@ import org.fox.ttrss.types.FeedCategoryList; import android.annotation.SuppressLint; import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Bundle; @@ -125,9 +128,36 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe return true; case R.id.catchup_category: if (true) { - FeedCategory cat = getCategoryAtPosition(info.position); + final FeedCategory cat = getCategoryAtPosition(info.position); if (cat != null) { - m_activity.catchupFeed(new Feed(cat.id, cat.title, true)); + + if (m_prefs.getBoolean("confirm_headlines_catchup", true)) { + AlertDialog.Builder builder = new AlertDialog.Builder( + m_activity) + .setMessage(getString(R.string.context_confirm_catchup, cat.title)) + .setPositiveButton(R.string.catchup, + new Dialog.OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + + m_activity.catchupFeed(new Feed(cat.id, cat.title, true)); + + } + }) + .setNegativeButton(R.string.dialog_cancel, + new Dialog.OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + + } + }); + + AlertDialog dlg = builder.create(); + dlg.show(); + } else { + m_activity.catchupFeed(new Feed(cat.id, cat.title, true)); + } + } } return true; diff --git a/src/org/fox/ttrss/FeedsFragment.java b/src/org/fox/ttrss/FeedsFragment.java index fc5996f0..cc851cd4 100644 --- a/src/org/fox/ttrss/FeedsFragment.java +++ b/src/org/fox/ttrss/FeedsFragment.java @@ -19,7 +19,10 @@ import org.fox.ttrss.types.FeedList; import android.annotation.SuppressLint; import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.graphics.Bitmap; @@ -156,9 +159,35 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh return true; case R.id.catchup_feed: if (true) { - Feed feed = getFeedAtPosition(info.position); + final Feed feed = getFeedAtPosition(info.position); + if (feed != null) { - m_activity.catchupFeed(feed); + if (m_prefs.getBoolean("confirm_headlines_catchup", true)) { + AlertDialog.Builder builder = new AlertDialog.Builder( + m_activity) + .setMessage(getString(R.string.context_confirm_catchup, feed.title)) + .setPositiveButton(R.string.catchup, + new Dialog.OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + + m_activity.catchupFeed(feed); + + } + }) + .setNegativeButton(R.string.dialog_cancel, + new Dialog.OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + + } + }); + + AlertDialog dlg = builder.create(); + dlg.show(); + } else { + m_activity.catchupFeed(feed); + } } } return true;