aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-03-23 23:34:58 +0100
committerChristian Schneppe <christian@pix-art.de>2017-03-23 23:34:58 +0100
commit95ef8fd216d31aabd089649161ac699d06f3f8cd (patch)
treec0dc3d8df681e2002c8e5d6aee79f36c51a696dd /src/main/java/de/pixart/messenger/ui
parentd8c077be6513debbb352d362390296c37c92c7fd (diff)
rework last activity logic to something that should work pretty well …
…in Conversations only enviroments
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java13
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java3
3 files changed, 7 insertions, 14 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
index 6270e4721..b0fd4cd79 100644
--- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
@@ -49,6 +49,7 @@ import de.pixart.messenger.entities.ListItem;
import de.pixart.messenger.services.XmppConnectionService.OnAccountUpdate;
import de.pixart.messenger.services.XmppConnectionService.OnRosterUpdate;
import de.pixart.messenger.utils.CryptoHelper;
+import de.pixart.messenger.utils.Namespace;
import de.pixart.messenger.utils.UIHelper;
import de.pixart.messenger.utils.XmppUri;
import de.pixart.messenger.xmpp.OnKeyStatusUpdated;
@@ -516,7 +517,9 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
lastseen.setVisibility(View.VISIBLE);
lastseen.setText(R.string.contact_blocked);
} else {
- if (showLastSeen && contact.getLastseen() > 0) {
+ if (showLastSeen
+ && contact.getLastseen() > 0
+ && contact.getPresences().allOrNonSupport(Namespace.IDLE)) {
lastseen.setVisibility(View.VISIBLE);
lastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.isActive(), contact.getLastseen()));
} else {
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index e1da663d5..fc735785c 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -9,10 +9,8 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
-import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
-import android.preference.PreferenceManager;
import android.support.v13.view.inputmethod.InputConnectionCompat;
import android.support.v13.view.inputmethod.InputContentInfoCompat;
import android.text.Editable;
@@ -1543,7 +1541,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
@Override
public void onTypingStarted() {
- final boolean broadcastLastActivity = broadcastLastActivity();
+ final boolean broadcastLastActivity = activity.xmppConnectionService.broadcastLastActivity();
Account.State status = conversation.getAccount().getStatus();
if (status == Account.State.ONLINE && conversation.setOutgoingChatState(ChatState.COMPOSING)) {
activity.xmppConnectionService.sendChatState(conversation);
@@ -1555,15 +1553,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
updateSendButton();
}
- public boolean broadcastLastActivity() {
- return getPreferences().getBoolean("last_activity", true);
- }
-
- public SharedPreferences getPreferences() {
- return PreferenceManager
- .getDefaultSharedPreferences(getActivity().getApplicationContext());
- }
-
@Override
public void onTypingStopped() {
Account.State status = conversation.getAccount().getStatus();
diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
index 6624266f7..61cf0a4af 100644
--- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
@@ -41,6 +41,7 @@ public class SettingsActivity extends XmppActivity implements
public static final String MANUALLY_CHANGE_PRESENCE = "manually_change_presence";
public static final String BLIND_TRUST_BEFORE_VERIFICATION = "btbv";
public static final String AUTOMATIC_MESSAGE_DELETION = "automatic_message_deletion";
+ public static final String BROADCAST_LAST_ACTIVITY = "last_activity";
public static final int REQUEST_WRITE_LOGS = 0xbf8701;
private SettingsFragment mSettingsFragment;
@@ -231,7 +232,7 @@ public class SettingsActivity extends XmppActivity implements
"allow_message_correction",
TREAT_VIBRATE_AS_SILENT,
MANUALLY_CHANGE_PRESENCE,
- "last_activity");
+ BROADCAST_LAST_ACTIVITY);
if (name.equals("resource")) {
String resource = preferences.getString("resource", "mobile")
.toLowerCase(Locale.US);