From 104df9df30a7f5e547d2f8879ca7cfee214407fd Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 28 Nov 2014 20:23:58 +0400 Subject: [PATCH] reduce headlines list lag --- org.fox.ttrss/src/main/AndroidManifest.xml | 4 ++-- .../main/java/org/fox/ttrss/CommonActivity.java | 2 ++ .../main/java/org/fox/ttrss/HeadlinesFragment.java | 14 +++++--------- .../ttrss/offline/OfflineHeadlinesFragment.java | 11 +++++++++-- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/org.fox.ttrss/src/main/AndroidManifest.xml b/org.fox.ttrss/src/main/AndroidManifest.xml index 344b7c02..39c8a890 100644 --- a/org.fox.ttrss/src/main/AndroidManifest.xml +++ b/org.fox.ttrss/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="289" + android:versionName="1.80" > 20) - ft.setText(article.feed_title.substring(0, 20) + "..."); - else */ - holder.feedTitleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize); holder.feedTitleView.setText(article.feed_title); @@ -841,7 +834,10 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, if (!m_prefs.getBoolean("headlines_show_content", true)) { holder.excerptView.setVisibility(View.GONE); } else { - String excerpt = Jsoup.parse(articleContent).text(); + String tmp = articleContent.length() > CommonActivity.EXCERPT_MAX_LENGTH ? + articleContent.substring(0, CommonActivity.EXCERPT_MAX_LENGTH) + "…" : articleContent; + + String excerpt = Jsoup.parse(tmp).text(); holder.excerptView.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineFontSize); holder.excerptView.setText(excerpt); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index 3af3c237..3918f966 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -39,6 +39,7 @@ import android.widget.TextView; import com.amulyakhare.textdrawable.TextDrawable; import com.amulyakhare.textdrawable.util.ColorGenerator; +import org.fox.ttrss.CommonActivity; import org.fox.ttrss.GlobalState; import org.fox.ttrss.R; import org.fox.ttrss.util.TypefaceCache; @@ -693,12 +694,18 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis }); } + String articleContent = article.getString(article.getColumnIndex("content")); + if (articleContent == null) articleContent = ""; + if (holder.excerptView != null) { if (!m_prefs.getBoolean("headlines_show_content", true)) { holder.excerptView.setVisibility(View.GONE); } else { - String excerpt = Jsoup.parse(article.getString(article.getColumnIndex("content"))).text(); - + String tmp = articleContent.length() > CommonActivity.EXCERPT_MAX_LENGTH ? + articleContent.substring(0, CommonActivity.EXCERPT_MAX_LENGTH) + "…" : articleContent; + + String excerpt = Jsoup.parse(tmp).text(); + holder.excerptView.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineFontSize); holder.excerptView.setText(excerpt); }