diff options
author | Andrew Dolgov <[email protected]> | 2013-05-15 13:28:47 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-05-15 13:28:47 +0400 |
commit | 9e71ff1b11d66aec2ce48a7c7f90dfb82ce143cd (patch) | |
tree | 7d3816e2b7d029ecb9d92e1a1784ad438001897b /src | |
parent | a60225626db91e98691e88f1d3a60bb16ecdec8f (diff) |
confirm marking headlines as read from the actionbar
Diffstat (limited to 'src')
-rw-r--r-- | src/org/fox/ttrss/CommonActivity.java | 3 | ||||
-rw-r--r-- | src/org/fox/ttrss/OnlineActivity.java | 79 |
2 files changed, 55 insertions, 27 deletions
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<String, String> map = new HashMap<String, String>() { - { - 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<String, String> map = new HashMap<String, String>() { + { + 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: |