diff options
author | Andrew Dolgov <[email protected]> | 2014-11-28 20:23:58 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-11-28 20:23:58 +0400 |
commit | 104df9df30a7f5e547d2f8879ca7cfee214407fd (patch) | |
tree | f395f34e09dfabf5945c372df1ddf91e01e50958 /org.fox.ttrss/src/main | |
parent | 1b5a57f55c26199a0a5d4c27736bc271deb90a53 (diff) |
reduce headlines list lag
Diffstat (limited to 'org.fox.ttrss/src/main')
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 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.fox.ttrss" - android:versionCode="288" - android:versionName="1.79" > + android:versionCode="289" + android:versionName="1.80" > <uses-sdk android:minSdkVersion="10" diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java index c67353a7..80dacea1 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java @@ -29,6 +29,8 @@ public class CommonActivity extends ActionBarActivity { public final static String THEME_AMBER = "THEME_AMBER"; public final static String THEME_DEFAULT = CommonActivity.THEME_LIGHT; + public static final int EXCERPT_MAX_LENGTH = 256; + private SQLiteDatabase m_readableDb; private SQLiteDatabase m_writableDb; diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java index ce2a7fa7..d78732cc 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java @@ -77,7 +77,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, public static final int HEADLINES_REQUEST_SIZE = 30; public static final int HEADLINES_BUFFER_MAX = 500; - + private final String TAG = this.getClass().getSimpleName(); private Feed m_feed; @@ -783,15 +783,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, adjustTitleTextView(article.score, holder.titleView, position); } - - if (holder.feedTitleView != null) { if (article.feed_title != null && (m_feed.is_cat || m_feed.id < 0)) { - - /* if (article.feed_title.length() > 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); } |