aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-09-21 23:16:23 +0200
committeriNPUTmice <daniel@gultsch.de>2014-09-21 23:16:23 +0200
commit1f91ed11fa1c9b73c4b57c7ed3b28985840fe002 (patch)
tree0313437e29da300e8427334c89070cc4cb53adad /src/eu/siacs
parent98a8fd4d0585c3b3b6761fc4df210a16c08d104e (diff)
show full date in message list, fixed #328
Diffstat (limited to 'src/eu/siacs')
-rw-r--r--src/eu/siacs/conversations/ui/adapter/MessageAdapter.java2
-rw-r--r--src/eu/siacs/conversations/utils/UIHelper.java22
2 files changed, 20 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 2392bbcf..035d18c5 100644
--- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -168,7 +168,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.indicator.setVisibility(View.VISIBLE);
}
- String formatedTime = UIHelper.readableTimeDifference(getContext(),
+ String formatedTime = UIHelper.readableTimeDifferenceFull(getContext(),
message.getMergedTimeSent());
if (message.getStatus() <= Message.STATUS_RECEIVED) {
if ((filesize != null) && (info != null)) {
diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java
index 56248234..3a191b9a 100644
--- a/src/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/eu/siacs/conversations/utils/UIHelper.java
@@ -51,10 +51,21 @@ public class UIHelper {
private static final int BG_COLOR = 0xFF181818;
private static final int FG_COLOR = 0xFFFAFAFA;
private static final int TRANSPARENT = 0x00000000;
- private static final int DATE_NO_YEAR_FLAGS = DateUtils.FORMAT_SHOW_DATE
+ private static final int SHORT_DATE_FLAGS = DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_NO_YEAR | DateUtils.FORMAT_ABBREV_ALL;
+ private static final int FULL_DATE_FLAGS = DateUtils.FORMAT_SHOW_TIME
+ | DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_DATE;
public static String readableTimeDifference(Context context, long time) {
+ return readableTimeDifference(context, time, false);
+ }
+
+ public static String readableTimeDifferenceFull(Context context, long time) {
+ return readableTimeDifference(context, time, true);
+ }
+
+ private static String readableTimeDifference(Context context, long time,
+ boolean fullDate) {
if (time == 0) {
return context.getString(R.string.just_now);
}
@@ -71,8 +82,13 @@ public class UIHelper {
java.text.DateFormat df = DateFormat.getTimeFormat(context);
return df.format(date);
} else {
- return DateUtils.formatDateTime(context, date.getTime(),
- DATE_NO_YEAR_FLAGS);
+ if (fullDate) {
+ return DateUtils.formatDateTime(context, date.getTime(),
+ FULL_DATE_FLAGS);
+ } else {
+ return DateUtils.formatDateTime(context, date.getTime(),
+ SHORT_DATE_FLAGS);
+ }
}
}