diff options
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | res/xml/preferences.xml | 7 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesFragment.java | 19 |
3 files changed, 25 insertions, 3 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index bdcfa61d..6dd47839 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -193,4 +193,6 @@ <string name="labels">Labels</string> <string name="article_img_view_caption">View Caption</string> <string name="light_theme_is_not_supported_on_honeycomb">Light theme is not supported on Honeycomb</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 99ac42aa..e05fc5b6 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -92,13 +92,16 @@ android:key="headlines_show_content"
android:summary="@string/pref_headlines_show_content_long"
android:title="@string/pref_headlines_show_content" />
-
<CheckBoxPreference
android:defaultValue="false"
android:key="oldest_first"
android:summary="@string/requires_api5"
android:title="@string/offline_oldest_first" />
-
+ <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 d61a2244..bc31f0d8 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -62,6 +62,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, private ArticleListAdapter m_adapter;
private ArticleList m_articles = GlobalState.getInstance().m_loadedArticles;
private ArticleList m_selectedArticles = new ArticleList();
+ private ArticleList m_readArticles = new ArticleList();
private HeadlinesEventListener m_listener;
private OnlineActivity m_activity;
@@ -797,11 +798,27 @@ 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) && firstVisibleItem > 0) {
+ Article a = m_articles.get(firstVisibleItem - 1);
+
+ if (a != null && a.unread) {
+ a.unread = false;
+ m_readArticles.add(a);
+ m_feed.unread--;
+ }
+ }
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
- // no-op
+ if (scrollState == SCROLL_STATE_IDLE && m_prefs.getBoolean("headlines_mark_read_scroll", false)) {
+ if (!m_readArticles.isEmpty()) {
+ m_activity.toggleArticlesUnread(m_readArticles);
+ m_activity.refresh(false);
+ m_readArticles.clear();
+ }
+ }
}
public Article getActiveArticle() {
|