New interface to pick a contact as attachment

New ContactMediaChooser allows the user to pick a contact from contacts
apps as attachment.

Test: Manual

Change-Id: Idb00cd8a3164a3cac859947affd5cbcc7e41b8c2
Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
This commit is contained in:
Taesu Lee
2020-03-04 09:33:19 +09:00
parent 0fee5a1e35
commit 45d1e1d044
13 changed files with 296 additions and 46 deletions

View File

@@ -15,7 +15,6 @@
*/
package com.android.messaging.ui.mediapicker;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.net.Uri;
@@ -79,30 +78,27 @@ public class DocumentImagePicker {
* Must be called from the fragment/activity's onActivityResult().
*/
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
if (requestCode == UIIntents.REQUEST_PICK_MEDIA_FROM_DOCUMENT_PICKER
&& resultCode == Activity.RESULT_OK) {
// Sometimes called after media item has been picked from the document picker.
String url = data.getStringExtra(EXTRA_PHOTO_URL);
// Sometimes called after media item has been picked from the document picker.
String url = data.getStringExtra(EXTRA_PHOTO_URL);
if (url == null) {
// we're using the builtin photo picker which supplies the return
// url as it's "data"
url = data.getDataString();
if (url == null) {
// we're using the builtin photo picker which supplies the return
// url as it's "data"
url = data.getDataString();
if (url == null) {
final Bundle extras = data.getExtras();
if (extras != null) {
final Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM);
if (uri != null) {
url = uri.toString();
}
final Bundle extras = data.getExtras();
if (extras != null) {
final Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM);
if (uri != null) {
url = uri.toString();
}
}
}
}
// Guard against null uri cases for when the activity returns a null/invalid intent.
if (url != null) {
final Uri uri = Uri.parse(url);
prepareDocumentForAttachment(uri);
}
// Guard against null uri cases for when the activity returns a null/invalid intent.
if (url != null) {
final Uri uri = Uri.parse(url);
prepareDocumentForAttachment(uri);
}
}