Add mark read on scroll for headlines

This commit is contained in:
Erik Hardesty 2013-03-30 17:58:55 -05:00
parent 5792022b55
commit b7e5436576
3 changed files with 20 additions and 0 deletions

View File

@ -186,4 +186,6 @@
<string name="headlines_starred">Starred</string>
<string name="headlines_published">Published</string>
<string name="headlines_unread">Unread</string>
<string name="pref_headlines_mark_read_scroll">Mark read on scroll</string>
<string name="pref_headlines_mark_read_scroll_long">Headlines will be marked read when scrolling past them</string>
</resources>

View File

@ -92,6 +92,10 @@
android:key="headlines_show_content"
android:summary="@string/pref_headlines_show_content_long"
android:title="@string/pref_headlines_show_content" />
<CheckBoxPreference android:key="headlines_mark_read_scroll"
android:title="@string/pref_headlines_mark_read_scroll"
android:summary="@string/pref_headlines_mark_read_scroll_long"
android:defaultValue="false"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/reading" >
<ListPreference

View File

@ -796,6 +796,20 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (!m_refreshInProgress && m_articles.findById(-1) != null && firstVisibleItem + visibleItemCount == m_articles.size()) {
refresh(true);
}
if (m_prefs.getBoolean("headlines_mark_read_scroll", false)) {
if (firstVisibleItem > 0) {
Article a = m_articles.get(firstVisibleItem - 1);
if (a != null) {
if (a.unread) {
a.unread = false;
m_activity.saveArticleUnread(a);
m_feed.unread--;
m_activity.refresh(false);
}
}
}
}
}
@Override