diff --git a/res/values/strings.xml b/res/values/strings.xml index 6dd47839..9212a1e6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -195,4 +195,5 @@ Light theme is not supported on Honeycomb Mark read on scroll Headlines will be marked read when scrolling past them + Mark %1$d article(s) as read? diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java index 6edba235..e1cacb02 100644 --- a/src/org/fox/ttrss/CommonActivity.java +++ b/src/org/fox/ttrss/CommonActivity.java @@ -7,6 +7,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity; import android.annotation.SuppressLint; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; +import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.FragmentActivity; @@ -118,7 +119,7 @@ public class CommonActivity extends SherlockFragmentActivity { initDatabase(); - m_compatMode = android.os.Build.VERSION.SDK_INT <= 10; + m_compatMode = android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB; Log.d(TAG, "m_compatMode=" + m_compatMode); diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 1815fa0d..50f1c71c 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -746,32 +746,59 @@ public class OnlineActivity extends CommonActivity { return true; case R.id.headlines_mark_as_read: if (hf != null) { - ArticleList articles = hf.getUnreadArticles(); - - for (Article a : articles) - a.unread = false; - - ApiRequest req = new ApiRequest(getApplicationContext()) { - protected void onPostExecute(JsonElement result) { - if (hf.isAdded()) { - hf.refresh(false); - } - } - }; - - final String articleIds = articlesToIdString(articles); - - @SuppressWarnings("serial") - HashMap map = new HashMap() { - { - put("sid", getSessionId()); - put("op", "updateArticle"); - put("article_ids", articleIds); - put("mode", "0"); - put("field", "2"); - } - }; - req.execute(map); + + int count = hf.getUnreadArticles().size(); + + if (count > 0) { + AlertDialog.Builder builder = new AlertDialog.Builder( + OnlineActivity.this) + .setMessage(getString(R.string.mark_num_headlines_as_read, count)) + .setPositiveButton(R.string.catchup, + new Dialog.OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + + ArticleList articles = hf.getUnreadArticles(); + + for (Article a : articles) + a.unread = false; + + ApiRequest req = new ApiRequest(getApplicationContext()) { + protected void onPostExecute(JsonElement result) { + if (hf.isAdded()) { + hf.refresh(false); + } + } + }; + + final String articleIds = articlesToIdString(articles); + + @SuppressWarnings("serial") + HashMap map = new HashMap() { + { + put("sid", getSessionId()); + put("op", "updateArticle"); + put("article_ids", articleIds); + put("mode", "0"); + put("field", "2"); + } + }; + req.execute(map); + + + } + }) + .setNegativeButton(R.string.dialog_cancel, + new Dialog.OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + + } + }); + + AlertDialog dlg = builder.create(); + dlg.show(); + } } return true; case R.id.headlines_view_mode: