解决: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 ...
随机推荐
- nohup 日志切割
最近遇到日志切割的问题,即程序是通过命令: nohup python *.py & 放到后台执行的,这样程序的日志输出到了nohup自动生成的nohup.out文件. 问题就来了,nohup. ...
- spring boot 无法读取application.properties问题
spring boot 无法读取application.properties问题 https://bbs.csdn.net/topics/392374488 Spring Boot 之注解@Compo ...
- linux下模拟FTP服务器(笔记)
要在linux下做一个模仿ftp的小型服务器,后来在百度文库中找到一份算是比较完整的实现,就在原代码一些重要部分上备注自己的理解(可能有误,千万不要轻易相信). 客户端: 客户端要从服务器端中读取数据 ...
- 原始的生成对抗网络GAN
论文地址:https://arxiv.org/pdf/1406.2661.pdf 1.简介: GAN的两个模型 判别模型:就是图中右半部分的网络,直观来看就是一个简单的神经网络结构,输入就是一副图像, ...
- meta 标签
<meta http-equiv="Refresh" content="5;url=http://www.w3school.com.cn" /> & ...
- Android JNI学习(三)——Java与Native相互调用
本系列文章如下: Android JNI(一)——NDK与JNI基础 Android JNI学习(二)——实战JNI之“hello world” Android JNI学习(三)——Java与Nati ...
- mint18
ubuntu16.04用了一段时间,果然遇到祖传内部错误.然后虚拟机遇到2次重启后卡死在黑屏闪光标位置.但是用系统盘准备重装,执行到分区这步放弃,重启,居然有能启动. 作为开发机,实在有点胆战心惊,虽 ...
- Codeforces 525A - Vitaliy and Pie
525A - Vitaliy and Pie 思路:贪心+hashing. 代码: #include<bits/stdc++.h> using namespace std; string ...
- 枚举1--求小于n的最大素数
枚举1--求小于n的最大素数 总结: 素数是不能被比它小的素数整除. /* 枚举就是基于已有知识镜像答案猜测的一种问题求解策略 问题:求小于n的最大素数 分析: 找不到一个数学公式,使得根据N就可以计 ...
- [.NET开发] C#实现的SQL备份与还原功能示例
本文实例讲述了C#实现的SQL备份与还原功能.分享给大家供大家参考,具体如下: //记得加 folderBrowserDialog1 openFileDialog1 控件 using System.D ...