diff options
author | Georg Lukas <[email protected]> | 2018-05-10 22:36:42 +0200 |
---|---|---|
committer | Georg Lukas <[email protected]> | 2018-05-10 22:36:42 +0200 |
commit | 0ea83c048723e11bb3dfc55a854925390a91e9f1 (patch) | |
tree | 61157ea24f5094c3a5db36ae2e7b6952f1dc5527 /org.fox.ttrss/src/main/java/org/fox | |
parent | 5dfda2da1a05961b221a2f8d48f0bdcfb8354465 (diff) |
Show year instead of time for old articles
Articles that are older than six months will display the year instead of
the time, e.g. "Aug 11, 2014" instead of "Aug 11, 03:41".
Diffstat (limited to 'org.fox.ttrss/src/main/java/org/fox')
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java index e75769b3..c7d65742 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java @@ -331,7 +331,12 @@ public class ArticleFragment extends StateSavedFragment { dv.setTextSize(TypedValue.COMPLEX_UNIT_SP, m_articleSmallFontSize); Date d = new Date(m_article.updated * 1000L); - DateFormat df = new SimpleDateFormat("MMM dd, HH:mm"); + long half_a_year_ago = System.currentTimeMillis()/1000L - 182*24*60*60; + DateFormat df; + if (m_article.updated < half_a_year_ago) + df = new SimpleDateFormat("MMM dd, yyyy"); + else + df = new SimpleDateFormat("MMM dd, HH:mm"); dv.setText(df.format(d)); } |