offline: fix wrong excerpt maximum length and headline font size not
being respected
This commit is contained in:
parent
056cbebfe3
commit
68ea91c567
@ -26,6 +26,8 @@ public class CommonActivity extends SherlockFragmentActivity {
|
||||
public final static String FRAG_FEEDS = "feeds";
|
||||
public final static String FRAG_CATS = "cats";
|
||||
|
||||
public static final int EXCERPT_MAX_SIZE = 200;
|
||||
|
||||
private SQLiteDatabase m_readableDb;
|
||||
private SQLiteDatabase m_writableDb;
|
||||
|
||||
|
@ -693,8 +693,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
} else {
|
||||
String excerpt = Jsoup.parse(articleContent).text();
|
||||
|
||||
if (excerpt.length() > 200)
|
||||
excerpt = excerpt.substring(0, 200) + "...";
|
||||
if (excerpt.length() > CommonActivity.EXCERPT_MAX_SIZE)
|
||||
excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_SIZE) + "...";
|
||||
|
||||
int fontSize = -1;
|
||||
|
||||
|
@ -5,6 +5,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.fox.ttrss.CommonActivity;
|
||||
import org.fox.ttrss.GlobalState;
|
||||
import org.fox.ttrss.R;
|
||||
import org.jsoup.Jsoup;
|
||||
@ -546,9 +547,24 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
||||
if (te != null) {
|
||||
String excerpt = Jsoup.parse(article.getString(article.getColumnIndex("content"))).text();
|
||||
|
||||
if (excerpt.length() > 100)
|
||||
excerpt = excerpt.substring(0, 100) + "...";
|
||||
if (excerpt.length() > CommonActivity.EXCERPT_MAX_SIZE)
|
||||
excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_SIZE) + "...";
|
||||
|
||||
int fontSize = -1;
|
||||
|
||||
switch (Integer.parseInt(m_prefs.getString("headlines_font_size", "0"))) {
|
||||
case 0:
|
||||
fontSize = 13;
|
||||
break;
|
||||
case 1:
|
||||
fontSize = 16;
|
||||
break;
|
||||
case 2:
|
||||
fontSize = 18;
|
||||
break;
|
||||
}
|
||||
|
||||
te.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
||||
te.setText(excerpt);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user