Merge "Allow intent shared subject or title to be mms subject"
This commit is contained in:
@@ -297,9 +297,11 @@ public class MessageData implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Create a message not yet associated with a particular conversation
|
* Create a message not yet associated with a particular conversation
|
||||||
*/
|
*/
|
||||||
public static MessageData createSharedMessage(final String messageText) {
|
public static MessageData createSharedMessage(final String messageText,
|
||||||
|
final String subjectText) {
|
||||||
final MessageData message = new MessageData();
|
final MessageData message = new MessageData();
|
||||||
message.mStatus = BUGLE_STATUS_OUTGOING_DRAFT;
|
message.mStatus = BUGLE_STATUS_OUTGOING_DRAFT;
|
||||||
|
message.mMmsSubject = subjectText;
|
||||||
if (!TextUtils.isEmpty(messageText)) {
|
if (!TextUtils.isEmpty(messageText)) {
|
||||||
message.mParts.add(MessagePartData.createTextMessagePart(messageText));
|
message.mParts.add(MessagePartData.createTextMessagePart(messageText));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,12 @@ public class ShareIntentActivity extends BaseBugleActivity implements
|
|||||||
public void onAttachFragment(final Fragment fragment) {
|
public void onAttachFragment(final Fragment fragment) {
|
||||||
final Intent intent = getIntent();
|
final Intent intent = getIntent();
|
||||||
final String action = intent.getAction();
|
final String action = intent.getAction();
|
||||||
|
|
||||||
|
String sharedSubject = intent.getStringExtra(Intent.EXTRA_SUBJECT);
|
||||||
|
if (sharedSubject == null) {
|
||||||
|
sharedSubject = intent.getStringExtra(Intent.EXTRA_TITLE);
|
||||||
|
}
|
||||||
|
|
||||||
if (Intent.ACTION_SEND.equals(action)) {
|
if (Intent.ACTION_SEND.equals(action)) {
|
||||||
final Uri contentUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
final Uri contentUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||||
if (UriUtil.isFileUri(contentUri)) {
|
if (UriUtil.isFileUri(contentUri)) {
|
||||||
@@ -101,11 +107,14 @@ public class ShareIntentActivity extends BaseBugleActivity implements
|
|||||||
// Try to get text string from content uri.
|
// Try to get text string from content uri.
|
||||||
sharedText = getTextStringFromContentUri(contentUri);
|
sharedText = getTextStringFromContentUri(contentUri);
|
||||||
}
|
}
|
||||||
mDraftMessage =
|
if (sharedText != null) {
|
||||||
sharedText != null ? MessageData.createSharedMessage(sharedText) : null;
|
mDraftMessage = MessageData.createSharedMessage(sharedText, sharedSubject);
|
||||||
|
} else {
|
||||||
|
mDraftMessage = null;
|
||||||
|
}
|
||||||
} else if (PendingAttachmentData.isSupportedMediaType(contentType)) {
|
} else if (PendingAttachmentData.isSupportedMediaType(contentType)) {
|
||||||
if (contentUri != null) {
|
if (contentUri != null) {
|
||||||
mDraftMessage = MessageData.createSharedMessage(null);
|
mDraftMessage = MessageData.createSharedMessage(null, sharedSubject);
|
||||||
addSharedPartToDraft(contentType, contentUri);
|
addSharedPartToDraft(contentType, contentUri);
|
||||||
} else {
|
} else {
|
||||||
mDraftMessage = null;
|
mDraftMessage = null;
|
||||||
@@ -149,7 +158,8 @@ public class ShareIntentActivity extends BaseBugleActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strBuffer.length() > 0 || !uriMap.isEmpty()) {
|
if (strBuffer.length() > 0 || !uriMap.isEmpty()) {
|
||||||
mDraftMessage = MessageData.createSharedMessage(strBuffer.toString());
|
mDraftMessage =
|
||||||
|
MessageData.createSharedMessage(strBuffer.toString(), sharedSubject);
|
||||||
for (final Map.Entry<Uri, String> e : uriMap.entrySet()) {
|
for (final Map.Entry<Uri, String> e : uriMap.entrySet()) {
|
||||||
addSharedPartToDraft(e.getValue(), e.getKey());
|
addSharedPartToDraft(e.getValue(), e.getKey());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user