aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java4
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationsActivity.java62
2 files changed, 25 insertions, 41 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
index 15f5b0058..a8ba62556 100644
--- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
@@ -306,7 +306,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
} else {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
this.showDynamicTags = preferences.getBoolean(SettingsActivity.SHOW_DYNAMIC_TAGS, false);
- this.showLastSeen = preferences.getBoolean("last_activity", false);
+ this.showLastSeen = preferences.getBoolean("last_activity", getResources().getBoolean(R.bool.last_activity));
}
binding.mediaWrapper.setVisibility(Compatibility.hasStoragePermission(this) ? View.VISIBLE : View.GONE);
mMediaAdapter.setAttachments(Collections.emptyList());
@@ -539,7 +539,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
binding.detailsLastseen.setVisibility(View.VISIBLE);
binding.detailsLastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.isActive(), contact.getLastseen()));
} else {
- binding.detailsLastseen.setVisibility(View.GONE);
+ binding.detailsLastseen.setText(getString(R.string.account_status_online));
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
index 43ed14a13..81b3b7e99 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
@@ -76,7 +76,6 @@ import de.pixart.messenger.entities.Account;
import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.entities.Conversational;
import de.pixart.messenger.entities.MucOptions;
-import de.pixart.messenger.entities.Presence;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.ui.interfaces.OnBackendConnected;
import de.pixart.messenger.ui.interfaces.OnConversationArchived;
@@ -90,6 +89,7 @@ import de.pixart.messenger.ui.util.PendingItem;
import de.pixart.messenger.utils.EmojiWrapper;
import de.pixart.messenger.utils.ExceptionHelper;
import de.pixart.messenger.utils.MenuDoubleTabUtil;
+import de.pixart.messenger.utils.Namespace;
import de.pixart.messenger.utils.SignupUtils;
import de.pixart.messenger.utils.UIHelper;
import de.pixart.messenger.utils.XmppUri;
@@ -118,7 +118,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
Intent.ACTION_SEND_MULTIPLE
);
- private boolean showLastSeen = false;
+ private boolean showLastSeen;
long FirstStartTime = -1;
String PREF_FIRST_START = "FirstStart";
@@ -601,7 +601,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
}
mRedirectInProcess.set(false);
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
- this.showLastSeen = preferences.getBoolean("last_activity", false);
+ this.showLastSeen = preferences.getBoolean("last_activity", getResources().getBoolean(R.bool.last_activity));
super.onStart();
}
@@ -695,7 +695,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
final Conversation conversation = ((ConversationFragment) mainFragment).getConversation();
if (conversation != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
- View view = getLayoutInflater().inflate(R.layout.ab_title, null);
+ final View view = getLayoutInflater().inflate(R.layout.ab_title, null);
getSupportActionBar().setCustomView(view);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
@@ -716,10 +716,11 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
abtitle.setSelected(true);
if (conversation.getMode() == Conversation.MODE_SINGLE && !conversation.withSelf()) {
ChatState state = conversation.getIncomingChatState();
- if (conversation.getContact().getShownStatus() == Presence.Status.OFFLINE) {
- absubtitle.setText(getString(R.string.account_status_offline));
+ if (state == ChatState.COMPOSING) {
+ absubtitle.setText(getString(R.string.is_typing));
+ absubtitle.setTypeface(null, Typeface.BOLD_ITALIC);
absubtitle.setSelected(true);
- absubtitle.setOnClickListener(view12 -> {
+ absubtitle.setOnClickListener(view13 -> {
if (conversation.getMode() == Conversation.MODE_SINGLE) {
switchToContactDetails(conversation.getContact());
} else if (conversation.getMode() == Conversation.MODE_MULTI) {
@@ -731,40 +732,23 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
}
});
} else {
- if (state == ChatState.COMPOSING) {
- absubtitle.setText(getString(R.string.is_typing));
- absubtitle.setTypeface(null, Typeface.BOLD_ITALIC);
- absubtitle.setSelected(true);
- absubtitle.setOnClickListener(view13 -> {
- if (conversation.getMode() == Conversation.MODE_SINGLE) {
- switchToContactDetails(conversation.getContact());
- } else if (conversation.getMode() == Conversation.MODE_MULTI) {
- Intent intent = new Intent(ConversationsActivity.this, ConferenceDetailsActivity.class);
- intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
- intent.putExtra("uuid", conversation.getUuid());
- startActivity(intent);
- overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
- }
- });
+ if (showLastSeen && conversation.getContact().getLastseen() > 0 && conversation.getContact().getPresences().allOrNonSupport(Namespace.IDLE)) {
+ absubtitle.setText(UIHelper.lastseen(getApplicationContext(), conversation.getContact().isActive(), conversation.getContact().getLastseen()));
} else {
- 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(view14 -> {
- if (conversation.getMode() == Conversation.MODE_SINGLE) {
- switchToContactDetails(conversation.getContact());
- } else if (conversation.getMode() == Conversation.MODE_MULTI) {
- Intent intent = new Intent(ConversationsActivity.this, ConferenceDetailsActivity.class);
- intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
- intent.putExtra("uuid", conversation.getUuid());
- startActivity(intent);
- overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
- }
- });
+ absubtitle.setText(getString(R.string.account_status_online));
}
+ absubtitle.setSelected(true);
+ absubtitle.setOnClickListener(view14 -> {
+ if (conversation.getMode() == Conversation.MODE_SINGLE) {
+ switchToContactDetails(conversation.getContact());
+ } else if (conversation.getMode() == Conversation.MODE_MULTI) {
+ Intent intent = new Intent(ConversationsActivity.this, ConferenceDetailsActivity.class);
+ intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
+ intent.putExtra("uuid", conversation.getUuid());
+ startActivity(intent);
+ overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
+ }
+ });
}
} else {
ChatState state = ChatState.COMPOSING;