From 57942e84e3b5470e3b9ddc68878759793ed769dc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 13 Nov 2014 21:58:30 +0300 Subject: [PATCH] tweak compact layout --- .../main/java/org/fox/ttrss/HeadlinesFragment.java | 11 ++++++++++- .../src/main/res/layout/headlines_row_compact.xml | 8 ++++---- .../res/layout/headlines_row_selected_compact.xml | 8 ++++---- .../layout/headlines_row_selected_unread_compact.xml | 8 ++++---- .../main/res/layout/headlines_row_unread_compact.xml | 8 ++++---- 5 files changed, 26 insertions(+), 17 deletions(-) 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 145a0341..2d0ddb22 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 @@ -965,7 +965,16 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, holder.dateView.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize); Date d = new Date((long)article.updated * 1000); - DateFormat df = new SimpleDateFormat("MMM dd, HH:mm"); + Date now = new Date(); + + DateFormat df; + + if (now.getYear() == d.getYear() && now.getMonth() == d.getMonth() && now.getDay() == d.getDay()) { + df = new SimpleDateFormat("HH:mm"); + } else { + df = new SimpleDateFormat("MMM dd"); + } + df.setTimeZone(TimeZone.getDefault()); holder.dateView.setText(df.format(d)); } diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row_compact.xml b/org.fox.ttrss/src/main/res/layout/headlines_row_compact.xml index 63ff030b..eec8860f 100644 --- a/org.fox.ttrss/src/main/res/layout/headlines_row_compact.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row_compact.xml @@ -39,7 +39,7 @@ @@ -94,9 +94,9 @@ diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row_selected_compact.xml b/org.fox.ttrss/src/main/res/layout/headlines_row_selected_compact.xml index d6823d37..52ede28e 100644 --- a/org.fox.ttrss/src/main/res/layout/headlines_row_selected_compact.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row_selected_compact.xml @@ -39,7 +39,7 @@ @@ -94,9 +94,9 @@ diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row_selected_unread_compact.xml b/org.fox.ttrss/src/main/res/layout/headlines_row_selected_unread_compact.xml index 0a1bf830..f5c3d10c 100644 --- a/org.fox.ttrss/src/main/res/layout/headlines_row_selected_unread_compact.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row_selected_unread_compact.xml @@ -40,7 +40,7 @@ @@ -95,9 +95,9 @@ diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row_unread_compact.xml b/org.fox.ttrss/src/main/res/layout/headlines_row_unread_compact.xml index ac9b2b81..fef86b19 100644 --- a/org.fox.ttrss/src/main/res/layout/headlines_row_unread_compact.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row_unread_compact.xml @@ -40,7 +40,7 @@ @@ -95,9 +95,9 @@