aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java1
-rw-r--r--src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java24
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java6
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java16
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java20
5 files changed, 47 insertions, 20 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java
index d85281754..dc14fe636 100644
--- a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java
+++ b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java
@@ -137,6 +137,7 @@ public class AttachFileToConversationRunnable implements Runnable, MediaTranscod
if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
mXmppConnectionService.getPgpEngine().encrypt(message, callback);
} else {
+ mXmppConnectionService.sendMessage(message);
callback.success(message);
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java
index 6ae1d1ff0..f2d25d377 100644
--- a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java
@@ -1,5 +1,6 @@
package de.pixart.messenger.ui;
+import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -25,7 +26,9 @@ import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.entities.Account;
import de.pixart.messenger.entities.Contact;
+import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.entities.ListItem;
+import de.pixart.messenger.entities.MucOptions;
import de.pixart.messenger.xmpp.jid.Jid;
public class ChooseContactActivity extends AbstractSearchableListItemActivity {
@@ -247,4 +250,25 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity {
}
this.mKnownHosts = xmppConnectionService.getKnownHosts();
}
+
+ public static Intent create(Activity activity, Conversation conversation) {
+ final Intent intent = new Intent(activity, ChooseContactActivity.class);
+ List<String> contacts = new ArrayList<>();
+ if (conversation.getMode() == Conversation.MODE_MULTI) {
+ for (MucOptions.User user : conversation.getMucOptions().getUsers(false)) {
+ Jid jid = user.getRealJid();
+ if (jid != null) {
+ contacts.add(jid.toBareJid().toString());
+ }
+ }
+ } else {
+ contacts.add(conversation.getJid().toBareJid().toString());
+ }
+ intent.putExtra("filter_contacts", contacts.toArray(new String[contacts.size()]));
+ intent.putExtra("conversation", conversation.getUuid());
+ intent.putExtra("multiple", true);
+ intent.putExtra("show_enter_jid", true);
+ intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().toBareJid().toString());
+ return intent;
+ }
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index fef8300be..f97d5fb06 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -818,6 +818,12 @@ public class ConversationActivity extends XmppActivity implements OnConversation
}
@Override
+ public void switchToConversation(Conversation conversation) {
+ Log.d(Config.LOGTAG, "override");
+ openConversation(conversation, null);
+ }
+
+ @Override
public void onConversationRead(Conversation conversation) {
if (!mActivityPaused && pendingViewIntent.peek() == null) {
xmppConnectionService.sendReadMarker(conversation);
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index c19977c7f..fcf28da2c 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -113,6 +113,7 @@ import de.pixart.messenger.xmpp.jid.InvalidJidException;
import de.pixart.messenger.xmpp.jid.Jid;
import static de.pixart.messenger.ui.XmppActivity.EXTRA_ACCOUNT;
+import static de.pixart.messenger.ui.XmppActivity.REQUEST_INVITE_TO_CONVERSATION;
import static de.pixart.messenger.xmpp.Patches.ENCRYPTION_EXCEPTIONS;
public class ConversationFragment extends XmppFragment implements EditMessage.KeyboardListener {
@@ -958,6 +959,15 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
Uri geo = Uri.parse("geo:" + String.valueOf(latitude) + "," + String.valueOf(longitude));
attachLocationToConversation(conversation, geo);
break;
+ case REQUEST_INVITE_TO_CONVERSATION:
+ XmppActivity.ConferenceInvite invite = XmppActivity.ConferenceInvite.parse(data);
+ if (invite != null) {
+ if (invite.execute(activity)) {
+ activity.mToast = Toast.makeText(activity, R.string.creating_conference, Toast.LENGTH_LONG);
+ activity.mToast.show();
+ }
+ }
+ break;
}
}
@@ -1315,7 +1325,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
});
break;
case R.id.action_invite:
- activity.inviteToConversation(conversation);
+ startActivityForResult(ChooseContactActivity.create(activity, conversation), REQUEST_INVITE_TO_CONVERSATION);
break;
case R.id.action_clear_history:
clearHistoryDialog(conversation);
@@ -2726,6 +2736,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
setScrollPosition(scrollState);
}
}
+ ActivityResult activityResult = postponedActivityResult.pop();
+ if (activityResult != null) {
+ handleActivityResult(activityResult);
+ }
}
public void clearPending() {
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index d124b580b..19bc5e96f 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -68,7 +68,6 @@ import de.pixart.messenger.entities.Account;
import de.pixart.messenger.entities.Contact;
import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.entities.Message;
-import de.pixart.messenger.entities.MucOptions;
import de.pixart.messenger.entities.Presences;
import de.pixart.messenger.services.AvatarService;
import de.pixart.messenger.services.BarcodeProvider;
@@ -555,24 +554,7 @@ public abstract class XmppActivity extends AppCompatActivity {
}
protected void inviteToConversation(Conversation conversation) {
- Intent intent = new Intent(this, ChooseContactActivity.class);
- List<String> contacts = new ArrayList<>();
- if (conversation.getMode() == Conversation.MODE_MULTI) {
- for (MucOptions.User user : conversation.getMucOptions().getUsers(false)) {
- Jid jid = user.getRealJid();
- if (jid != null) {
- contacts.add(jid.toBareJid().toString());
- }
- }
- } else {
- contacts.add(conversation.getJid().toBareJid().toString());
- }
- intent.putExtra("filter_contacts", contacts.toArray(new String[contacts.size()]));
- intent.putExtra("conversation", conversation.getUuid());
- intent.putExtra("multiple", true);
- intent.putExtra("show_enter_jid", true);
- intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().toBareJid().toString());
- startActivityForResult(intent, REQUEST_INVITE_TO_CONVERSATION);
+ startActivityForResult(ChooseContactActivity.create(this,conversation), REQUEST_INVITE_TO_CONVERSATION);
}
protected void announcePgp(Account account, final Conversation conversation, Intent intent, final Runnable onSuccess) {