From a30364872cd1491880b6c8ad9796de468cc18501 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 13 Nov 2014 22:02:59 +0300 Subject: [PATCH] use maxlines to limit excerpt size instead of manual ellipsizing --- org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java | 4 +--- .../src/main/java/org/fox/ttrss/HeadlinesFragment.java | 3 --- .../java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java | 4 ---- org.fox.ttrss/src/main/res/layout/headlines_row.xml | 2 ++ org.fox.ttrss/src/main/res/layout/headlines_row_selected.xml | 2 ++ .../src/main/res/layout/headlines_row_selected_unread.xml | 2 ++ org.fox.ttrss/src/main/res/layout/headlines_row_unread.xml | 2 ++ 7 files changed, 9 insertions(+), 10 deletions(-) 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 b2765dc0..81907743 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 @@ -31,9 +31,7 @@ public class CommonActivity extends ActionBarActivity { public final static String THEME_SEPIA = "THEME_SEPIA"; public final static String THEME_AMBER = "THEME_AMBER"; public final static String THEME_DEFAULT = CommonActivity.THEME_LIGHT; - - public static final int EXCERPT_MAX_SIZE = 200; - + 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 2d0ddb22..b17dd02e 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 @@ -795,9 +795,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, } else { String excerpt = Jsoup.parse(articleContent).text(); - if (excerpt.length() > CommonActivity.EXCERPT_MAX_SIZE) - excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_SIZE) + "..."; - 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 c7f9be13..0b8ec6c1 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 @@ -36,7 +36,6 @@ import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; -import org.fox.ttrss.CommonActivity; import org.fox.ttrss.GlobalState; import org.fox.ttrss.R; import org.fox.ttrss.util.TypefaceCache; @@ -647,9 +646,6 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis } else { String excerpt = Jsoup.parse(article.getString(article.getColumnIndex("content"))).text(); - if (excerpt.length() > CommonActivity.EXCERPT_MAX_SIZE) - excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_SIZE) + "..."; - holder.excerptView.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineFontSize); holder.excerptView.setText(excerpt); } diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row.xml b/org.fox.ttrss/src/main/res/layout/headlines_row.xml index 681c024c..608161b9 100644 --- a/org.fox.ttrss/src/main/res/layout/headlines_row.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row.xml @@ -115,6 +115,8 @@ android:layout_height="match_parent" android:lineSpacingExtra="2sp" android:paddingTop="3dp" + android:maxLines="5" + android:ellipsize="end" android:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." android:textColor="?headlineExcerptTextColor" android:textSize="13sp" diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row_selected.xml b/org.fox.ttrss/src/main/res/layout/headlines_row_selected.xml index a51ee13d..5127c4dc 100644 --- a/org.fox.ttrss/src/main/res/layout/headlines_row_selected.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row_selected.xml @@ -116,6 +116,8 @@ android:layout_height="match_parent" android:lineSpacingExtra="2sp" android:paddingTop="3dp" + android:maxLines="5" + android:ellipsize="end" android:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." android:textColor="?headlineSelectedExcerptTextColor" android:textSize="13sp" diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row_selected_unread.xml b/org.fox.ttrss/src/main/res/layout/headlines_row_selected_unread.xml index 0c2a4dc8..9c3802ed 100644 --- a/org.fox.ttrss/src/main/res/layout/headlines_row_selected_unread.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row_selected_unread.xml @@ -117,6 +117,8 @@ android:layout_height="match_parent" android:lineSpacingExtra="2sp" android:paddingTop="3dp" + android:maxLines="5" + android:ellipsize="end" android:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." android:textColor="?headlineSelectedExcerptTextColor" android:textSize="13sp" diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row_unread.xml b/org.fox.ttrss/src/main/res/layout/headlines_row_unread.xml index 3128f74a..40cfc827 100644 --- a/org.fox.ttrss/src/main/res/layout/headlines_row_unread.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row_unread.xml @@ -116,6 +116,8 @@ android:layout_height="match_parent" android:lineSpacingExtra="2sp" android:paddingTop="3dp" + android:maxLines="5" + android:ellipsize="end" android:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." android:textColor="?headlineExcerptTextColor" android:textSize="13sp"