From 6b32c5153c2952dad2c4ab6e463f579a20011fc1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 27 Nov 2011 15:55:22 +0300 Subject: [PATCH] implement marking articles as unread do not notify server to catchup article if it isn't unread when selecting --- res/menu/main_menu.xml | 4 ++++ res/values/strings.xml | 1 + src/org/fox/ttrss/HeadlinesFragment.java | 8 +++++--- src/org/fox/ttrss/MainActivity.java | 11 ++++++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/res/menu/main_menu.xml b/res/menu/main_menu.xml index 216b24c5..90041b6e 100644 --- a/res/menu/main_menu.xml +++ b/res/menu/main_menu.xml @@ -47,6 +47,10 @@ android:title="@string/toggle_marked" android:showAsAction=""/> + + Log sent and received data Toggle starred Toggle published + Mark unread diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index b31b7753..94701389 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -116,11 +116,13 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener { Article article = (Article)list.getItemAtPosition(position); m_articleSelectedListener.onArticleSelected(article); - article.unread = false; + if (article.unread) { + article.unread = false; + m_articleOps.saveArticleUnread(article); + } + m_selectedArticleId = article.id; m_adapter.notifyDataSetChanged(); - - m_articleOps.saveArticleUnread(article); } } diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index 99509cde..dc1f0022 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -58,7 +58,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe put("sid", m_sessionId); put("op", "updateArticle"); put("article_ids", String.valueOf(article.id)); - put("mode", "0"); + put("mode", article.unread ? "1" : "0"); put("field", "2"); } }; @@ -387,6 +387,13 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe updateHeadlines(); } return true; + case R.id.set_unread: + if (m_selectedArticle != null) { + m_selectedArticle.unread = true; + saveArticleUnread(m_selectedArticle); + updateHeadlines(); + } + return true; case R.id.show_feeds: setUnreadOnly(!getUnreadOnly()); @@ -460,6 +467,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe m_menu.findItem(R.id.share_article).setVisible(true); m_menu.findItem(R.id.toggle_marked).setVisible(true); m_menu.findItem(R.id.toggle_published).setVisible(true); + m_menu.findItem(R.id.set_unread).setVisible(true); m_menu.findItem(R.id.update_feeds).setVisible(false); m_menu.findItem(R.id.show_feeds).setVisible(false); @@ -468,6 +476,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe m_menu.findItem(R.id.share_article).setVisible(false); m_menu.findItem(R.id.toggle_marked).setVisible(false); m_menu.findItem(R.id.toggle_published).setVisible(false); + m_menu.findItem(R.id.set_unread).setVisible(false); if (!m_smallScreenMode || m_activeFeed == null) { m_menu.findItem(R.id.show_feeds).setVisible(true);