diff options
author | Erik Hardesty <[email protected]> | 2013-04-01 10:36:27 -0500 |
---|---|---|
committer | Erik Hardesty <[email protected]> | 2013-04-01 10:36:27 -0500 |
commit | 7d7022e0267989d70f551268327052389707fc2a (patch) | |
tree | 2aff600462099d5c2b420267905d87b49a885fad /src | |
parent | b7e5436576be1b84225b9e2e8c7ca32dfb55822c (diff) |
Process read articles in batches
Accumulate read articles while scrolling and upload changes to tt-rss only when done scrolling
Diffstat (limited to 'src')
-rw-r--r-- | src/org/fox/ttrss/HeadlinesFragment.java | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index fce000fc..daef6914 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -797,16 +797,13 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, 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);
- }
+ if (m_prefs.getBoolean("headlines_mark_read_scroll", false) && firstVisibleItem > 0) {
+ Article a = m_articles.get(firstVisibleItem - 1);
+ if (a != null) {
+ if (a.unread) {
+ a.unread = false;
+ m_readArticles.add(a);
+ m_feed.unread--;
}
}
}
@@ -814,7 +811,13 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, @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() {
|