diff --git a/res/layout/fragment_conversation.xml b/res/layout/fragment_conversation.xml
index ab9bb528f..f3d4592ca 100644
--- a/res/layout/fragment_conversation.xml
+++ b/res/layout/fragment_conversation.xml
@@ -162,7 +162,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="4dp"
- android:text="@string/last_seen"
+ android:text="@string/never_seen"
android:textColor="#e5e5e5"
android:textSize="14sp" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 48849eb47..9fcd9dfa0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -236,6 +236,9 @@
hours
mins
Missing public key announcements
- last seen %1$s ago on %2$s
+ last seen %d ago
+ last seen %d minutes ago
+ last seen %d hours ago
+ last seen %d days ago
never seen
\ No newline at end of file
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index 6ca88008e..29033891c 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -666,13 +666,7 @@ public class ConversationFragment extends Fragment {
}
if (activity.showLastseen()) {
Contact contact = conversation.getContact();
- if ((contact.lastseen.presence != null)&&(contact.lastseen.time != 0)) {
- lastSeenText.setText(getString(R.string.last_seen,
- UIHelper.lastseen(getActivity(), contact.lastseen.time),
- contact.lastseen.presence));
- } else {
- lastSeenText.setText(R.string.never_seen);
- }
+ lastSeenText.setText(UIHelper.lastseen(getActivity(), contact.lastseen.time));
}
this.messageList.clear();
this.messageList.addAll(this.conversation.getMessages());
diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java
index 00885f7c0..3d6f4ceab 100644
--- a/src/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/eu/siacs/conversations/utils/UIHelper.java
@@ -73,15 +73,18 @@ public class UIHelper {
}
public static String lastseen(Context context, long time) {
+ if (time==0) {
+ return context.getString(R.string.never_seen);
+ }
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 if (difference < 60 * 90) {
+ return context.getString(R.string.last_seen_mins,difference/60);
+ } else if (difference < 60 * 60 * 36) {
+ return context.getString(R.string.last_seen_hours,difference/(60*60));
} else {
- return "days";
+ return context.getString(R.string.last_seen_days,difference/(60*60*24));
}
}