From 99e5098780be9df958ed85a038448187ca7d2e6d Mon Sep 17 00:00:00 2001 From: kruks23 Date: Fri, 6 Jun 2014 16:15:15 +0200 Subject: #158 Try to solve MM/dd date in each locale --- src/eu/siacs/conversations/utils/UIHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java index 15d98d85..0730ac24 100644 --- a/src/eu/siacs/conversations/utils/UIHelper.java +++ b/src/eu/siacs/conversations/utils/UIHelper.java @@ -39,6 +39,7 @@ import android.preference.PreferenceManager; import android.provider.ContactsContract.Contacts; import android.support.v4.app.NotificationCompat; import android.support.v4.app.TaskStackBuilder; +import android.text.format.DateUtils; import android.text.Html; import android.util.DisplayMetrics; import android.view.LayoutInflater; @@ -51,6 +52,7 @@ public class UIHelper { private static final int BG_COLOR = 0xFF181818; private static final int FG_COLOR = 0xFFE5E5E5; private static final int TRANSPARENT = 0x00000000; + private static final int DATE_NO_YEAR_FLAGS = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR; public static String readableTimeDifference(Context context, long time) { if (time == 0) { @@ -66,8 +68,7 @@ public class UIHelper { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm",Locale.US); return sdf.format(date); } else { - SimpleDateFormat sdf = new SimpleDateFormat("MM/dd",Locale.US); - return sdf.format(date); + return DateUtils.formatDateTime(context, date.getTime(), DATE_NO_YEAR_FLAGS); } } -- cgit v1.2.3 From c489f368b861bdee5e438301e1cc6b6e8c067e54 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Fri, 6 Jun 2014 16:44:14 +0200 Subject: added abbrev_all to date format --- src/eu/siacs/conversations/utils/UIHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java index 0730ac24..00885f7c 100644 --- a/src/eu/siacs/conversations/utils/UIHelper.java +++ b/src/eu/siacs/conversations/utils/UIHelper.java @@ -52,7 +52,7 @@ public class UIHelper { private static final int BG_COLOR = 0xFF181818; private static final int FG_COLOR = 0xFFE5E5E5; private static final int TRANSPARENT = 0x00000000; - private static final int DATE_NO_YEAR_FLAGS = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR; + private static final int DATE_NO_YEAR_FLAGS = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR | DateUtils.FORMAT_ABBREV_ALL; public static String readableTimeDifference(Context context, long time) { if (time == 0) { -- cgit v1.2.3