aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-01-30 22:05:46 +0100
committerChristian Schneppe <christian@pix-art.de>2017-01-30 22:05:46 +0100
commit95430627c2a5079f036220feba3603cd04f88378 (patch)
tree6d60102972f3569c6dc3fdd3736ec9b952558854 /src/main/java/de/pixart/messenger/ui
parent82025c71254bb757202950d526284a8dd3ddb489 (diff)
respect lastseen preferences in conversation subtitle
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index 069985745..dadab9a72 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -14,7 +14,6 @@ import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -24,6 +23,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
+import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.provider.Settings;
import android.support.v4.widget.SlidingPaneLayout;
@@ -141,6 +141,7 @@ public class ConversationActivity extends XmppActivity
private AtomicBoolean mRedirected = new AtomicBoolean(false);
private Pair<Integer, Intent> mPostponedActivityResult;
private boolean mUnprocessedNewIntent = false;
+ private boolean showLastSeen = false;
long FirstStartTime = -1;
@@ -438,11 +439,19 @@ public class ConversationActivity extends XmppActivity
absubtitle.setSelected(true);
absubtitle.setOnClickListener(this);
} else if (state == ChatState.PAUSED) {
- absubtitle.setText(UIHelper.lastseen(getApplicationContext(), conversation.getContact().isActive(), conversation.getContact().getLastseen()));
+ if (showLastSeen && conversation.getContact().getLastseen() > 0) {
+ absubtitle.setText(UIHelper.lastseen(getApplicationContext(), conversation.getContact().isActive(), conversation.getContact().getLastseen()));
+ } else {
+ absubtitle.setText(getString(R.string.account_status_online));
+ }
absubtitle.setSelected(true);
absubtitle.setOnClickListener(this);
} else {
- absubtitle.setText(UIHelper.lastseen(getApplicationContext(), conversation.getContact().isActive(), conversation.getContact().getLastseen()));
+ if (showLastSeen && conversation.getContact().getLastseen() > 0) {
+ absubtitle.setText(UIHelper.lastseen(getApplicationContext(), conversation.getContact().isActive(), conversation.getContact().getLastseen()));
+ } else {
+ absubtitle.setText(getString(R.string.account_status_online));
+ }
absubtitle.setSelected(true);
absubtitle.setOnClickListener(this);
}
@@ -462,7 +471,7 @@ public class ConversationActivity extends XmppActivity
abtitle.setText(conversation.getJid().toBareJid().toString());
abtitle.setOnClickListener(this);
abtitle.setSelected(true);
- absubtitle.setText(null);
+ absubtitle.setText("");
absubtitle.setOnClickListener(this);
}
} else {
@@ -1256,6 +1265,8 @@ public class ConversationActivity extends XmppActivity
if (conversationList.size() >= 1) {
this.onConversationUpdate();
}
+ final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
+ this.showLastSeen = preferences.getBoolean("last_activity", false);
}
@Override