reduce headlines list lag

This commit is contained in:
Andrew Dolgov 2014-11-28 20:23:58 +04:00
parent 1b5a57f55c
commit 104df9df30
4 changed files with 18 additions and 13 deletions

View File

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

View File

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

View File

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

View File

@ -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,11 +694,17 @@ 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);