码迷,mamicode.com
首页 > 其他好文 > 详细

Mms编辑短信时候联系人重复或者无效则删除解决方案

时间:2017-05-31 17:30:04      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:.sh   roi   短信   ast   oid   telephony   ddr   UI   修改   

路径

packages\apps\Mms\src\com\android\mms\ui\ComposeMessageActivity.java

修改

private void updateTitle(ContactList list)
if (mConversation.isGroupChat()) {
    GroupChatModel groupChat = mConversation.getGroupChat();
    if (groupChat != null) {
        title = RcsUtils.getDisplayName(groupChat);
    } else if (!mSentMessage) {
        title = getString(R.string.new_group_chat);
    } else {
        title = getString(R.string.group_chat);
    }
    subTitle = getString(R.string.group_chat) + mConversation.getGroupChatStatusText();
} else {
    //modify start
    if(mRecipientsEditor != null && list != null && list.size() > 0) {
        int size = list.size();
        
        Contact lastContact = list.get(size - 1);  //Find the last contact
        String name = lastContact.getName();
        String number = lastContact.getNumber();
        if (!(Mms.isEmailAddress(number) || Telephony.Mms.isPhoneNumber(number))) {  //Add contact error
            list.remove(size - 1);
            mRecipientsEditor.populate(list);
            
            String title2 = getResourcesString(R.string.has_invalid_recipient, name);
            Toast.makeText(ComposeMessageActivity.this, title2, Toast.LENGTH_SHORT).show();
            return;
        }
        if(size > 1){
            for(int i = 0; i < size - 1; i++) {
                if(number.equals(list.get(i).getNumber())){  //Repeat the contact
                    list.remove(size - 1);
                    mRecipientsEditor.populate(list);
                    String title2 = getResourcesString(R.string.has_invalid_recipient, name);
                    Toast.makeText(ComposeMessageActivity.this, title2, Toast.LENGTH_SHORT).show();
                    return;
                }
            }
        }
        
    }
    //modify end

  

Mms编辑短信时候联系人重复或者无效则删除解决方案

标签:.sh   roi   短信   ast   oid   telephony   ddr   UI   修改   

原文地址:http://www.cnblogs.com/vendor/p/6924964.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!