implement marking articles as unread

do not notify server to catchup article if it isn't unread when
selecting
This commit is contained in:
Andrew Dolgov 2011-11-27 15:55:22 +03:00
parent 45b7bff423
commit 6b32c5153c
4 changed files with 20 additions and 4 deletions

View File

@ -47,6 +47,10 @@
android:title="@string/toggle_marked"
android:showAsAction=""/>
<item android:id="@+id/set_unread"
android:title="@string/set_unread"
android:showAsAction=""/>
<item android:id="@+id/toggle_published"
android:icon="@drawable/ic_menu_rss"
android:title="@string/toggle_published"

View File

@ -47,4 +47,5 @@
<string name="transport_debugging">Log sent and received data</string>
<string name="toggle_marked">Toggle starred</string>
<string name="toggle_published">Toggle published</string>
<string name="set_unread">Mark unread</string>
</resources>

View File

@ -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);
}
}

View File

@ -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);