aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDaniel Gultsch <inputmice@siacs.eu>2015-01-07 00:59:42 +0100
committerDaniel Gultsch <inputmice@siacs.eu>2015-01-07 00:59:42 +0100
commitd502e57661ecc63e09692add8ae3e7c0daf93b70 (patch)
tree9449f20c75476dc5f47115ae59e03fc0c81fe2eb /src/main
parentf02f510c187a581afd27093c97eb421fc56d3221 (diff)
refactored UiHelper
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/utils/UIHelper.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
index 2f1383b8..74f0d345 100644
--- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
@@ -51,10 +51,18 @@ public class UIHelper {
}
private static boolean today(Date date) {
+ return sameDay(date,new Date(System.currentTimeMillis()));
+ }
+
+ public static boolean sameDay(long timestamp1, long timestamp2) {
+ return sameDay(new Date(timestamp1),new Date(timestamp2));
+ }
+
+ private static boolean sameDay(Date a, Date b) {
Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance();
- cal1.setTime(date);
- cal2.setTimeInMillis(System.currentTimeMillis());
+ cal1.setTime(a);
+ cal2.setTime(b);
return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
&& cal1.get(Calendar.DAY_OF_YEAR) == cal2
.get(Calendar.DAY_OF_YEAR);