aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/utils/UIHelper.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-06-06 11:39:17 +0200
committeriNPUTmice <daniel@gultsch.de>2014-06-06 11:39:17 +0200
commit5fe926b64586f5ac7d3eba7a64de81a710437a14 (patch)
tree84f720295ece0ede1e13f53f06bc7aaa9b044786 /src/eu/siacs/conversations/utils/UIHelper.java
parenta583471af843e1b1682d36efee04caa5767419ea (diff)
basic last seen feature. no peristancy just yet. no polish
Diffstat (limited to 'src/eu/siacs/conversations/utils/UIHelper.java')
-rw-r--r--src/eu/siacs/conversations/utils/UIHelper.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java
index 9737040b..15d98d85 100644
--- a/src/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/eu/siacs/conversations/utils/UIHelper.java
@@ -70,6 +70,19 @@ public class UIHelper {
return sdf.format(date);
}
}
+
+ public static String lastseen(Context context, long time) {
+ long difference = (System.currentTimeMillis() - time) / 1000;
+ if (difference < 60) {
+ return context.getString(R.string.just_now);
+ } else if (difference < 60 * 60) {
+ return difference / 60 + " " + context.getString(R.string.mins);
+ } else if (difference < 60 * 60 * 24) {
+ return difference / (60 * 60)+ " " + context.getString(R.string.hours);
+ } else {
+ return "days";
+ }
+ }
public static int getRealPx(int dp, Context context) {
final DisplayMetrics metrics = context.getResources().getDisplayMetrics();