when sharing text from Conversations to Conversations use quotes
This commit is contained in:
parent
219ae65ef7
commit
29d0bed38b
|
@ -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 ACTION_VIEW_CONVERSATION = "eu.siacs.conversations.action.VIEW";
|
||||||
public static final String EXTRA_CONVERSATION = "conversationUuid";
|
public static final String EXTRA_CONVERSATION = "conversationUuid";
|
||||||
public static final String EXTRA_DOWNLOAD_UUID = "eu.siacs.conversations.download_uuid";
|
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_NICK = "nick";
|
||||||
public static final String EXTRA_IS_PRIVATE_MESSAGE = "pm";
|
public static final String EXTRA_IS_PRIVATE_MESSAGE = "pm";
|
||||||
public static final String EXTRA_DO_NOT_APPEND = "do_not_append";
|
public static final String EXTRA_DO_NOT_APPEND = "do_not_append";
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
|
||||||
public String account;
|
public String account;
|
||||||
public String contact;
|
public String contact;
|
||||||
public String text;
|
public String text;
|
||||||
|
public boolean asQuote = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Share share;
|
private Share share;
|
||||||
|
@ -132,6 +133,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
|
||||||
if (Intent.ACTION_SEND.equals(action)) {
|
if (Intent.ACTION_SEND.equals(action)) {
|
||||||
final String text = intent.getStringExtra(Intent.EXTRA_TEXT);
|
final String text = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||||
final Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
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())) {
|
if (data != null && "geo".equals(data.getScheme())) {
|
||||||
this.share.uris.clear();
|
this.share.uris.clear();
|
||||||
|
@ -141,6 +143,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
|
||||||
this.share.uris.add(uri);
|
this.share.uris.add(uri);
|
||||||
} else {
|
} else {
|
||||||
this.share.text = text;
|
this.share.text = text;
|
||||||
|
this.share.asQuote = asQuote;
|
||||||
}
|
}
|
||||||
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
|
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
|
||||||
final ArrayList<Uri> uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
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) {
|
} else if (share.text != null) {
|
||||||
intent.setAction(ConversationsActivity.ACTION_VIEW_CONVERSATION);
|
intent.setAction(ConversationsActivity.ACTION_VIEW_CONVERSATION);
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, share.text);
|
intent.putExtra(Intent.EXTRA_TEXT, share.text);
|
||||||
|
intent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, share.asQuote);
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -30,16 +30,11 @@
|
||||||
package eu.siacs.conversations.ui.util;
|
package eu.siacs.conversations.ui.util;
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v4.content.ContextCompat;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
|
@ -58,9 +53,11 @@ public class ShareUtil {
|
||||||
if (message.isGeoUri()) {
|
if (message.isGeoUri()) {
|
||||||
shareIntent.putExtra(Intent.EXTRA_TEXT, message.getBody());
|
shareIntent.putExtra(Intent.EXTRA_TEXT, message.getBody());
|
||||||
shareIntent.setType("text/plain");
|
shareIntent.setType("text/plain");
|
||||||
|
shareIntent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, true);
|
||||||
} else if (!message.isFileOrImage()) {
|
} else if (!message.isFileOrImage()) {
|
||||||
shareIntent.putExtra(Intent.EXTRA_TEXT, message.getMergedBody().toString());
|
shareIntent.putExtra(Intent.EXTRA_TEXT, message.getMergedBody().toString());
|
||||||
shareIntent.setType("text/plain");
|
shareIntent.setType("text/plain");
|
||||||
|
shareIntent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, true);
|
||||||
} else {
|
} else {
|
||||||
final DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
|
final DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue