add mark above as read to article menu

This commit is contained in:
Andrew Dolgov 2011-12-01 08:32:17 +03:00
parent f44bd5e47d
commit 98cd1762e5
2 changed files with 35 additions and 2 deletions

View File

@ -100,6 +100,11 @@
android:icon="@android:drawable/ic_menu_close_clear_cancel"
android:showAsAction="ifRoom"
android:title="@string/close_article"/>
<item
android:id="@+id/catchup_above"
android:icon="@drawable/ic_menu_tick"
android:title="@string/article_mark_read_above"/>
</group>
</group>

View File

@ -674,6 +674,24 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
updateHeadlines();
}
return true;
case R.id.catchup_above:
if (hf != null) {
if (m_selectedArticle != null) {
ArticleList articles = hf.getAllArticles();
ArticleList tmp = new ArticleList();
for (Article a : articles) {
a.unread = false;
tmp.add(a);
if (m_selectedArticle.id == a.id)
break;
}
if (tmp.size() > 0) {
toggleArticlesUnread(tmp);
hf.notifyUpdated();
}
}
}
return true;
case R.id.set_unread:
if (m_selectedArticle != null) {
m_selectedArticle.unread = true;
@ -1258,8 +1276,18 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
if (hf != null) {
Article article = hf.getArticleAtPosition(info.position);
if (article != null) {
// TODO implement
ArticleList articles = hf.getAllArticles();
ArticleList tmp = new ArticleList();
for (Article a : articles) {
a.unread = false;
tmp.add(a);
if (article.id == a.id)
break;
}
if (tmp.size() > 0) {
toggleArticlesUnread(tmp);
hf.notifyUpdated();
}
}
}
return true;