diff options
author | Erik Hardesty <[email protected]> | 2013-03-30 17:58:55 -0500 |
---|---|---|
committer | Erik Hardesty <[email protected]> | 2013-03-30 17:58:55 -0500 |
commit | b7e5436576be1b84225b9e2e8c7ca32dfb55822c (patch) | |
tree | 3e5c58bb38e611ff41c239616ec63812ba11f899 | |
parent | 5792022b559eb3ac886f363f76b6f3857efb8d29 (diff) |
Add mark read on scroll for headlines
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | res/xml/preferences.xml | 4 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesFragment.java | 14 |
3 files changed, 20 insertions, 0 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 5e96736a..5d9c7c58 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -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> diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 74d284f9..095f52cb 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -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
diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index 924f3b52..fce000fc 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -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
|