when sharing text from Conversations to Conversations use quotes

This commit is contained in:
Daniel Gultsch 2019-08-26 13:40:47 +02:00
parent 219ae65ef7
commit 29d0bed38b
3 changed files with 7 additions and 6 deletions

View File

@ -93,7 +93,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
public static final String ACTION_VIEW_CONVERSATION = "eu.siacs.conversations.action.VIEW";
public static final String EXTRA_CONVERSATION = "conversationUuid";
public static final String EXTRA_DOWNLOAD_UUID = "eu.siacs.conversations.download_uuid";
public static final String EXTRA_AS_QUOTE = "as_quote";
public static final String EXTRA_AS_QUOTE = "eu.siacs.conversations.as_quote";
public static final String EXTRA_NICK = "nick";
public static final String EXTRA_IS_PRIVATE_MESSAGE = "pm";
public static final String EXTRA_DO_NOT_APPEND = "do_not_append";

View File

@ -40,6 +40,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
public String account;
public String contact;
public String text;
public boolean asQuote = false;
}
private Share share;
@ -132,6 +133,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
if (Intent.ACTION_SEND.equals(action)) {
final String text = intent.getStringExtra(Intent.EXTRA_TEXT);
final Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
final boolean asQuote = intent.getBooleanExtra(ConversationsActivity.EXTRA_AS_QUOTE, false);
if (data != null && "geo".equals(data.getScheme())) {
this.share.uris.clear();
@ -141,6 +143,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
this.share.uris.add(uri);
} else {
this.share.text = text;
this.share.asQuote = asQuote;
}
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
final ArrayList<Uri> uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
@ -195,6 +198,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
} else if (share.text != null) {
intent.setAction(ConversationsActivity.ACTION_VIEW_CONVERSATION);
intent.putExtra(Intent.EXTRA_TEXT, share.text);
intent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, share.asQuote);
}
startActivity(intent);
finish();

View File

@ -30,16 +30,11 @@
package eu.siacs.conversations.ui.util;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.widget.Toast;
import java.net.URL;
import java.util.regex.Matcher;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.DownloadableFile;
import eu.siacs.conversations.entities.Message;
@ -58,9 +53,11 @@ public class ShareUtil {
if (message.isGeoUri()) {
shareIntent.putExtra(Intent.EXTRA_TEXT, message.getBody());
shareIntent.setType("text/plain");
shareIntent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, true);
} else if (!message.isFileOrImage()) {
shareIntent.putExtra(Intent.EXTRA_TEXT, message.getMergedBody().toString());
shareIntent.setType("text/plain");
shareIntent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, true);
} else {
final DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
try {