解决:People下面选择分享可见联系人,选择多个联系人后通过短信分享,短信中只显示一个联系人
问题描述:
【操作步骤】:People下导入导出中选择分享可见联系人,选择多个联系人后通过短信分享
【测试结果】:短信中只能显示一个联系人
【预期结果】:可以显示多个联系人
经过代码分析,从compose_message_activitu.xml中的ViewStub进行定位到现实联系人名片的视图:
<ViewStub android:id="@+id/vcard_attachment_view_stub"
android:layout="@layout/vcard_attachment_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
经过上述代码,找到vcard_attachment_view的布局,并定位到现实联系人名片的预览视图:
<com.android.mms.ui.VcardAttachmentView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/vcard_attachment_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingRight="5dip"
android:background="@drawable/attachment_editor_bg">
根据ID我们定位到AttachmentEditor类的createView()方法,代码如下:
private SlideViewInterface createView() {
boolean inPortrait = inPortraitMode();
if (mSlideshow.size() > 1) {
return createSlideshowView(inPortrait);
}
SlideModel slide = mSlideshow.get(0);
if (slide.hasImage()) {
return createMediaView(
R.id.image_attachment_view_stub,
R.id.image_attachment_view,
R.id.view_image_button, R.id.replace_image_button, R.id.remove_image_button,
MSG_VIEW_IMAGE, MSG_REPLACE_IMAGE, MSG_REMOVE_ATTACHMENT);
} else if (slide.hasVideo()) {
return createMediaView(
R.id.video_attachment_view_stub,
R.id.video_attachment_view,
R.id.view_video_button, R.id.replace_video_button, R.id.remove_video_button,
MSG_PLAY_VIDEO, MSG_REPLACE_VIDEO, MSG_REMOVE_ATTACHMENT);
} else if (slide.hasAudio()) {
return createMediaView(
R.id.audio_attachment_view_stub,
R.id.audio_attachment_view,
R.id.play_audio_button, R.id.replace_audio_button, R.id.remove_audio_button,
MSG_PLAY_AUDIO, MSG_REPLACE_AUDIO, MSG_REMOVE_ATTACHMENT);
} else if (slide.hasVcard()) {
return createMediaView(R.id.vcard_attachment_view_stub,
R.id.vcard_attachment_view,
R.id.view_vcard_button,
R.id.replace_vcard_button,
R.id.remove_vcard_button,
MSG_VIEW_VCARD, MSG_REPLACE_VCARD, MSG_REMOVE_ATTACHMENT);
} else if (slide.hasUnsupport()) {
return createMediaView(R.id.unsupport_attachment_view_stub,
R.id.unsupport_attachment_view,
R.id.view_unsupport_button,
R.id.replace_unsupport_button,
R.id.remove_unsupport_button,
MSG_VIEW_VCARD, MSG_REPLACE_VCARD, MSG_REMOVE_ATTACHMENT);
} else {
throw new IllegalArgumentException();
}
}
经过分析,我们发现,通过调用createMediaView()方法,并在该方法中绑定点击时间的监听 viewButton.setOnClickListener(new MessageOnClick(view_message));通过点击发送消息给Handler,而setHandler的操作放在了ComposeMessageActivity类中。我们接着分析ComposeMessageActivity类中的Handler对象的handleMessage()方法:<TAG 1-1>
private final Handler mAttachmentEditorHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case AttachmentEditor.MSG_EDIT_SLIDESHOW: {
editSlideshow();
break;
}
case AttachmentEditor.MSG_SEND_SLIDESHOW: {
if (isPreparedForSending()) {
ComposeMessageActivity.this.confirmSendMessageIfNeeded();
}
break;
}
case AttachmentEditor.MSG_VIEW_IMAGE:
case AttachmentEditor.MSG_PLAY_VIDEO:
case AttachmentEditor.MSG_PLAY_AUDIO:
case AttachmentEditor.MSG_PLAY_SLIDESHOW:
case AttachmentEditor.MSG_VIEW_VCARD:
if (mWorkingMessage.getSlideshow() != null) {
viewMmsMessageAttachment(msg.what);
}
break;
case AttachmentEditor.MSG_REPLACE_IMAGE:
case AttachmentEditor.MSG_REPLACE_VIDEO:
case AttachmentEditor.MSG_REPLACE_AUDIO:
showAddAttachmentDialog(true);
break;
//AddBy:yabin.huang BugID:SWBUG00029664 Date:20140528
case AttachmentEditor.MSG_REPLACE_VCARD:
pickContacts(MultiPickContactsActivity.MODE_VCARD,REQUEST_CODE_ATTACH_ADD_CONTACT_VCARD);
break;
case AttachmentEditor.MSG_REMOVE_ATTACHMENT:
mWorkingMessage.removeAttachment(true);
mAttachFileUri = null;
mIsSendMultiple = false;
break;
default:
break;
}
}
};
上述代码中<TAG 1-1>,调用viewMmsMessageAttachment()方法:
public static void viewSimpleSlideshow(Context context, SlideshowModel slideshow) {
if (!slideshow.isSimple()) {
throw new IllegalArgumentException(
"viewSimpleSlideshow() called on a non-simple slideshow");
}
SlideModel slide = slideshow.get(0);
MediaModel mm = null;
if (slide.hasImage()) {
mm = slide.getImage();
} else if (slide.hasVideo()) {
mm = slide.getVideo();
} else if (slide.hasVcard()) {
mm = slide.getVcard();
String lookupUri = ((VcardModel) mm).getLookupUri();
Intent intent = new Intent(Intent.ACTION_VIEW);
if (!TextUtils.isEmpty(lookupUri) && lookupUri.contains("contacts")) {
// if the uri is from the contact, we suggest to view the contact.
intent.setData(Uri.parse(lookupUri));
} else {
// we need open the saved part.
intent.setDataAndType(mm.getUri(), ContentType.TEXT_VCARD.toLowerCase());
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
// distinguish view vcard from mms or contacts.
intent.putExtra(VIEW_VCARD, true);
context.startActivity(intent);
return;
}
上述加粗标红代码进行注释,则问题解决。这么处理的原因,无论当前lookruUri中包含几个联系人或者无论从那里跳转查看名片附件的内容都跳转到mm.getUri()所表示的uri去。当然这样的处理还有待改善,由于时间问题这里暂作处理,以后如果有时间进行完善。
解决:People下面选择分享可见联系人,选择多个联系人后通过短信分享,短信中只显示一个联系人的更多相关文章
- Excel在任务栏中只显示一个窗口的解决办法
Excel在任务栏中只显示一个窗口的解决办法 以前朋友遇到过这个问题,这次自己又遇到了,习惯了以前的那种在任务栏中显示全部窗口,方便用Alt+Tab键进行切换. 如果同时打开许多Excel工作簿, ...
- win7系统的右键菜单只显示一个白色框不显示菜单项 解决办法
如上图所示,桌面或其他大部分地方点击右键菜单,都只显示一个白色框,鼠标移上去才有菜单项看,并且效果很丑 解决办法: 计算机-右键-属性-高级-性能-设置-视觉效果-淡入淡出或滑动菜单到视图,将其前面的 ...
- 虚拟机中安装完Lunix系统后,开机黑屏,只显示一个-,解决方法
1,查看设置->硬盘是不是SCSI,如果是,先关闭虚拟机,移除该硬盘(实际数据不会删除) 2,添加一个新的虚拟硬盘,最后位置选IDE设备 3,确定,重启虚拟机即可
- 解决ListView在界面只显示一个item
ListView只显示一条都是scrollview嵌套listView造成的,将listView的高度设置为固定高度之后,三个条目虽然都完全显示.但是这个地方是动态显示的,不能写死.故采用遍历各个子条 ...
- 如何在VBS脚本中显示“选择文件对话框”或“选择目录对话框”
.选择文件[XP操作系统,不能用于Win2000或98],使用“UserAccounts.CommonDialog”对象向用户显示一个标准的“文件打开”对话框 Set objDialog = Crea ...
- 解决Windows照片查看器中图片显示发黄的问题
这其实是ICC颜色配置的问题,发生在Windows7自动更新下载了显示器的驱动后,自动安装后显示器的颜色配额制文件自动改为新下载的配置,导致显卡和显示器颜色配置不兼容的问题,不过不用担心,非常容易解决 ...
- 【Android Developers Training】 101. 显示快速联系人挂件(Quick Contact Badge)
注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...
- 【转】【已解决】Android中ActionBar中不显示overflow(就是三个点的那个按钮)--不错
原文网址:http://www.crifan.com/android_actionbar_three_dot_overflow_not_show/ [问题] 折腾: [记录]继续尝试给Android程 ...
- iOS-调用系统的短信和发送邮件功能,实现短信分享和邮件分享
一.邮件分享 1.iOS系统自带邮件设置邮箱(此处以QQ邮箱为例)(http://jingyan.baidu.com/album/6181c3e084cb7d152ef153b5.html?picin ...
随机推荐
- Web前端代码规范
新增:http://materliu.github.io/code-guide/#project-naming HTML 原则1.规范 .保证您的代码规范,保证结构表现行为相互分离.2.简洁.保证代码 ...
- UVa 1411 Ants(分治)
https://vjudge.net/problem/UVA-1411 题意:n只蚂蚁和n颗苹果树,一一配对并且不能交叉. 思路:这就是巨人与鬼的问题.用分治法就行了. #include<ios ...
- jQuery.page 分页控件
分享一下自己在项目中引用的Jquery分页控件 index.html内容 <!DOCTYPE html> <html lang="zh-cn" xmlns=&qu ...
- 【NOI2013】向量内积
定义两个$d$维向量${A=[a_1,a_2....a_n]}$,${B=[b_1,b_2....b_n]}$的内积为其相对应维度的权值的乘积和: $${\left \langle A,B \righ ...
- Codeforces Round #323 (Div. 2) C. GCD Table map
题目链接:http://codeforces.com/contest/583/problem/C C. GCD Table time limit per test 2 seconds memory l ...
- Cassandra学习笔记
CASSANDRA在工作中用过,但是用的项目少,能用却了解的不全面.今天来稍加学习下: http://zqhxuyuan.github.io/2015/10/15/Cassandra-Daily/ ...
- C#异常信息获取
try { ; / i; } catch (Exception ex) { /** * 1.异常消息 * 2.异常模块名称 * 3.异常方法名称 * 4.异常行号 */ String str = &q ...
- js如何创建JSON对象
js如何创建JSON对象 一.总结 一句话总结:直接创建js数组和js对象即可,然后JSON.stringify就可以获取json字符串,js中的一切都是对象,而且js中的对象都是json对象 js ...
- WPF 的 数据源属性 和 数据源
(一)数据源(数据对象)属性 :path 或 path的值(path=VM.Property或M.Property),通常具有通知功能(特例除外). (二)path不能孤立而存在,它一定具有所归属的 ...
- Linux 强制安装rpm 包
Linux 强制安装rpm 包 2014年12月12日 10:21 [root@ilearndb1 Server]# rpm -ivh unixODBC-devel-2.* --nodeps -- ...