aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-02-22 22:28:46 +0100
committerChristian Schneppe <christian@pix-art.de>2017-02-22 22:28:46 +0100
commit1e4f06d04de38021a8cd62c386261103ebebccb6 (patch)
treebe4a6fbe011ad1d304c8916d4ea2ad910a6cf04c
parentcccbbaa8ef67347743d7984f86ab2a6e0800ae59 (diff)
send 'online' presences also while typing a message
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java15
2 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index faecf0774..3fa4f9d4c 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -3558,7 +3558,7 @@ public class XmppConnectionService extends Service {
sendPresence(account, checkListeners() && broadcastLastActivity());
}
- private void sendPresence(final Account account, final boolean includeIdleTimestamp) {
+ public void sendPresence(final Account account, final boolean includeIdleTimestamp) {
PresencePacket packet;
if (manuallyChangePresence()) {
packet = mPresenceGenerator.selfPresence(account, account.getPresenceStatus());
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 74ee1324d..2212ad6b0 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -9,8 +9,10 @@ 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;
@@ -1485,14 +1487,27 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
@Override
public void onTypingStarted() {
+ final boolean broadcastLastActivity = broadcastLastActivity();
Account.State status = conversation.getAccount().getStatus();
if (status == Account.State.ONLINE && conversation.setOutgoingChatState(ChatState.COMPOSING)) {
activity.xmppConnectionService.sendChatState(conversation);
}
+ if (broadcastLastActivity) {
+ activity.xmppConnectionService.sendPresence(conversation.getAccount(), false); //send new presence but don't include idle because we are not
+ }
activity.hideConversationsOverview();
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();