Merge branch 'master' of git://github.com/dalingrin/Tiny-Tiny-RSS-for-Honeycomb

Conflicts:
	res/values/strings.xml
	res/xml/preferences.xml
This commit is contained in:
Andrew Dolgov 2013-04-18 16:37:38 +04:00
commit aadfbbc18b
3 changed files with 25 additions and 3 deletions

View File

@ -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>

View File

@ -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

View File

@ -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() {