aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
index 8a61e00c..fe3ed73f 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/ShareWithActivity.java
@@ -37,6 +37,8 @@ import de.thedevstack.conversationsplus.xmpp.jid.Jid;
public class ShareWithActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate {
+ private boolean mReturnToPrevious = false;
+
@Override
public void onConversationUpdate() {
refreshUi();
@@ -85,7 +87,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
resId = R.string.shared_file_with_x;
}
replaceToast(getString(resId, message.getConversation().getName()));
- if (share.uuid != null) {
+ if (mReturnToPrevious) {
finish();
} else {
switchToConversation(message.getConversation());
@@ -186,6 +188,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
if (intent == null) {
return;
}
+ this.mReturnToPrevious = ConversationsPlusPreferences.returnToPrevious();
final String type = intent.getType();
final String action = intent.getAction();
Log.d(Config.LOGTAG, "action: "+action+ ", type:"+type);
@@ -314,8 +317,28 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
selectPresence(conversation, callback);
}
} else {
- switchToConversation(conversation, this.share.text, true);
- finish();
+ if (mReturnToPrevious && this.share.text != null && !this.share.text.isEmpty() ) {
+ final OnPresenceSelected callback = new OnPresenceSelected() {
+ @Override
+ public void onPresenceSelected() {
+ Message message = new Message(conversation,share.text, conversation.getNextEncryption());
+ if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
+ message.setCounterpart(conversation.getNextCounterpart());
+ }
+ xmppConnectionService.sendMessage(message);
+ replaceToast(getString(R.string.shared_text_with_x, conversation.getName()));
+ finish();
+ }
+ };
+ if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
+ selectPresence(conversation, callback);
+ } else {
+ callback.onPresenceSelected();
+ }
+ } else {
+ switchToConversation(conversation, this.share.text, true);
+ finish();
+ }
}
}