use maxlines to limit excerpt size instead of manual ellipsizing

This commit is contained in:
Andrew Dolgov 2014-11-13 22:02:59 +03:00
parent 57942e84e3
commit a30364872c
7 changed files with 9 additions and 10 deletions

View File

@ -32,8 +32,6 @@ public class CommonActivity extends ActionBarActivity {
public final static String THEME_AMBER = "THEME_AMBER"; public final static String THEME_AMBER = "THEME_AMBER";
public final static String THEME_DEFAULT = CommonActivity.THEME_LIGHT; public final static String THEME_DEFAULT = CommonActivity.THEME_LIGHT;
public static final int EXCERPT_MAX_SIZE = 200;
private SQLiteDatabase m_readableDb; private SQLiteDatabase m_readableDb;
private SQLiteDatabase m_writableDb; private SQLiteDatabase m_writableDb;

View File

@ -795,9 +795,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
} else { } else {
String excerpt = Jsoup.parse(articleContent).text(); 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.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineFontSize);
holder.excerptView.setText(excerpt); holder.excerptView.setText(excerpt);
} }

View File

@ -36,7 +36,6 @@ import android.widget.ListView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import org.fox.ttrss.CommonActivity;
import org.fox.ttrss.GlobalState; import org.fox.ttrss.GlobalState;
import org.fox.ttrss.R; import org.fox.ttrss.R;
import org.fox.ttrss.util.TypefaceCache; import org.fox.ttrss.util.TypefaceCache;
@ -647,9 +646,6 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
} else { } else {
String excerpt = Jsoup.parse(article.getString(article.getColumnIndex("content"))).text(); 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.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineFontSize);
holder.excerptView.setText(excerpt); holder.excerptView.setText(excerpt);
} }

View File

@ -115,6 +115,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:lineSpacingExtra="2sp" android:lineSpacingExtra="2sp"
android:paddingTop="3dp" 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:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
android:textColor="?headlineExcerptTextColor" android:textColor="?headlineExcerptTextColor"
android:textSize="13sp" android:textSize="13sp"

View File

@ -116,6 +116,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:lineSpacingExtra="2sp" android:lineSpacingExtra="2sp"
android:paddingTop="3dp" 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:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
android:textColor="?headlineSelectedExcerptTextColor" android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="13sp" android:textSize="13sp"

View File

@ -117,6 +117,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:lineSpacingExtra="2sp" android:lineSpacingExtra="2sp"
android:paddingTop="3dp" 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:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
android:textColor="?headlineSelectedExcerptTextColor" android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="13sp" android:textSize="13sp"

View File

@ -116,6 +116,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:lineSpacingExtra="2sp" android:lineSpacingExtra="2sp"
android:paddingTop="3dp" 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:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
android:textColor="?headlineExcerptTextColor" android:textColor="?headlineExcerptTextColor"
android:textSize="13sp" android:textSize="13sp"