From 3e66d43c16b79e6f7348055c5a5e21efc935427e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 15 Oct 2014 19:11:18 +0400 Subject: [PATCH] more headlines webview stuff --- res/values/strings.xml | 3 + res/xml/preferences.xml | 7 ++ src/org/fox/ttrss/HeadlinesFragment.java | 150 ++++++++++++++--------- 3 files changed, 99 insertions(+), 61 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b32bee7e..8235124b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -219,4 +219,7 @@ Open in web browser Enable condensed fonts Use condensed fonts for headline titles and a few other UI elements. + Show full article content in headlines. May perform badly on old/slower devices. + Show full content + diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index dfafa560..370f77a0 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -92,6 +92,13 @@ android:key="headlines_show_content" android:summary="@string/pref_headlines_show_content_long" android:title="@string/pref_headlines_show_content" /> + + + = 1); - menu.findItem(R.id.article_set_note).setEnabled(m_activity.getApiLevel() >= 1); + menu.findItem(R.id.article_set_note).setEnabled(m_activity.getApiLevel() >= 1); super.onCreateContextMenu(menu, v, menuInfo); @@ -794,61 +791,92 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, String articleContent = article.content != null ? article.content : ""; - if (te != null) { - if (!m_prefs.getBoolean("headlines_show_content", true)) { - te.setVisibility(View.GONE); - } else { - String excerpt = Jsoup.parse(articleContent).text(); + if (m_prefs.getBoolean("headlines_full_content", false)) { + final WebView content = (WebView)v.findViewById(R.id.content); + + if (content != null) { + + Document doc = Jsoup.parse(articleContent); - if (excerpt.length() > CommonActivity.EXCERPT_MAX_SIZE) - excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_SIZE) + "..."; + if (doc != null) { + // thanks webview for crashing on