diff options
author | Andrew Dolgov <[email protected]> | 2013-05-29 20:57:00 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-05-29 20:57:00 +0400 |
commit | 68ea91c567be95b52c20f51d4ba0e58ae716ad21 (patch) | |
tree | 4bbdddc11759a56878b42438cc63b4f618b43cba | |
parent | 056cbebfe3152b98eb00c118ebcb0ef427d344e7 (diff) |
offline: fix wrong excerpt maximum length and headline font size not
being respected
-rw-r--r-- | src/org/fox/ttrss/CommonActivity.java | 2 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesFragment.java | 4 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java | 20 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java index 0b41e3ab..5edceb4e 100644 --- a/src/org/fox/ttrss/CommonActivity.java +++ b/src/org/fox/ttrss/CommonActivity.java @@ -25,6 +25,8 @@ public class CommonActivity extends SherlockFragmentActivity { public final static String FRAG_ARTICLE = "article"; 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; diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index 6ad805cc..c1499cec 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -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; diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index 242d7a16..b75af763 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -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); } |