Android 短信转换成彩信的消息数量(实例代码)

默认3条以上转为彩信

改为5条

路径vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/MmsConfig.java

private static int sSmsToMmsTextThreshold = 6; // 4

变量定义字面意思就可以理解 以下是代码分析

vendor/mediatek/proprietary/packages/apps/Mms/res/layout/compose_message_activity.xml

布局文件

vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java private EnhanceEditText mTextEditor; // Text editor to type your message into //消息输入框 private TextView mTextCounter; // Shows the number of characters used in text editor //剩余字数显示 private TextView mSendButtonMms; // Press to send mms //彩信发送按钮,TextView中加入图片 private ImageButton mSendButtonSms; // Press to send sms //短信发送按钮 private void updateCounter(CharSequence text, int start, int before, int count) { ... int[] params = null; int encodingType = SmsMessage.ENCODING_UNKNOWN; encodingType = mOpComposeExt.getSmsEncodingType(encodingType, ComposeMessageActivity.this); params = SmsMessage.calculateLength(text, false, encodingType); /* SmsMessage.calculateLength returns an int[4] with: * int[0] being the number of SMS's required, * int[1] the number of code units used, * int[2] is the number of code units remaining until the next message. * int[3] is the encoding type that should be used for the message. */ final int msgCount = params[0]; //已输入短信条数 final int remainingInCurrentMessage = params[2]; //剩余字数 mWorkingMessage.setLengthRequiresMms( msgCount >= MmsConfig.getSmsToMmsTextThreshold(), true); //转为彩信的短信条数 MmsLog.d(TAG, "updateCounter(): message msgCount = " + msgCount + " TextThreshold() = " + MmsConfig.getSmsToMmsTextThreshold() + " remainingInCurrentMessage = " + remainingInCurrentMessage); /// M: Show the counter /// M: Update the remaining characters and number of messages required. if (msgCount >= MmsConfig.getSmsToMmsTextThreshold()) { mTextCounter.setVisibility(View.GONE); return; } mUiHandler.postDelayed(new Runnable() { @Override public void run() { if (mOpComposeExt.updateCounterUiRun(mTextEditor, remainingInCurrentMessage, msgCount, mWorkingMessage)) { return; } MmsLog.d(TAG, "updateCounter requiresMms = " + mWorkingMessage.requiresMms() + " line count = " + mTextEditor.getLineCount()); if (mWorkingMessage.requiresMms() || mTextEditor.getLineCount() <= 1) { mTextCounter.setVisibility(View.GONE); return; } mTextCounter.setVisibility(View.VISIBLE); String counterText = remainingInCurrentMessage + "/" + msgCount; mTextCounter.setText(counterText); } }, 100); //显示短信发送按钮或彩信发送按钮 private View showSmsOrMmsSendButton(boolean isMms) { View showButton = null; View hideButton = null; // add for ipmessage if (isMms) { if (mSubCount == 0 || (isRecipientsEditorVisible() && TextUtils.isEmpty(mRecipientsEditor.getText())) /// M: fix bug ALPS00563318, show gray mms_send_button /// when haven't subject, text and attachment || ((mSubjectTextEditor == null || (mSubjectTextEditor != null && TextUtils.isEmpty(mSubjectTextEditor.getText().toString().trim()))) && mTextEditor != null && TextUtils.isEmpty(mTextEditor.getText().toString().trim()) && !mWorkingMessage.hasAttachment()) || !mIsSmsEnabled) { mSendButtonMms.setCompoundDrawablesWithIntrinsicBounds(null, null, null, getResources().getDrawable(R.drawable.ic_send_sms_unsend)); } else { mSendButtonMms.setCompoundDrawablesWithIntrinsicBounds(null, null, null, getResources().getDrawable(R.drawable.ic_send_ipmsg)); } showButton = mSendButtonMms; hideButton = mSendButtonSms; } else { if (!mIpCompose.onIpShowSmsOrMmsSendButton(isMms)) { if ((mTextEditor.getText().toString().isEmpty()) || mSubCount == 0 || (isRecipientsEditorVisible() && TextUtils.isEmpty(mRecipientsEditor.getText())) || recipientCount() > MmsConfig.getSmsRecipientLimit() || !mIsSmsEnabled) { ///@} mSendButtonSms.setImageResource(R.drawable.ic_send_sms_unsend); } else { mSendButtonSms.setImageResource(R.drawable.ic_send_ipmsg); } } showButton = mSendButtonSms; hideButton = mSendButtonMms; } if (showButton != null) { showButton.setVisibility(View.VISIBLE); } if (hideButton != null) { hideButton.setVisibility(View.GONE); } updateTextEditorHint(); return showButton; }

以上所述是小编给大家介绍的Android 短信转换成彩信的消息数量,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

时间: 2024-09-13 03:14:32

Android 短信转换成彩信的消息数量(实例代码)的相关文章

CVE-2017-0780:一张GIF图,让最新版Android短信应用无限崩溃

本文讲的是CVE-2017-0780:一张GIF图,让最新版Android短信应用无限崩溃,有没有想过,一张看起来似乎是每个人随时都能欣赏到的GIF图,其实能够造成你的Android短信应用崩溃呢? 我们最近报告给Google的一个拒绝服务(DoS)漏洞就能实现这一点.该漏洞为CVE-2017-0780,主要目标为最新版的Nexus以及Pixel设备.通过发送格式不正确的彩信(MMS),该安全漏洞可以允许攻击者非法和远程地瓦解其受害者的Android消息应用程序,致其完全崩溃.即使设备/系统重新

详解Android短信的发送和广播接收实现短信的监听_Android

本文介绍了Android短信的发送和广播接收者实现短信的监听,要注意Android清单中权限的设置以及广播的注册监听实现,废话不多说,代码如下: 以下就是 Android清单的XML AndroidManifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.zyw.broadcastsendsms" android:versionC

语音和短信已成运营商之鸡肋

这几天运营商老大哥中国移动又一次被推向风口浪尖:为了完成让更多用户使用4G流量套餐的KPI,一些地方移动公司与老的WAP免流量套餐用户爆发了矛盾,这被CCTV高度关注并表示315晚会将关注此事.这类事情对中国移动来说应该见怪不怪,应该会圆满解决"软着陆".我想这个事情出现的根本原因还是现在运营商急了,在微信等OTT业务大举扩张的背景下正在拼命转向流量经营时代. 语音和短信已成运营商之鸡肋 中国移动在三大运营商中市场份额超过62%,因此比较具有代表性.2011年-2013年中国移动短信收

详解Android短信的发送和广播接收实现短信的监听

本文介绍了Android短信的发送和广播接收者实现短信的监听,要注意Android清单中权限的设置以及广播的注册监听实现,废话不多说,代码如下: 以下就是 Android清单的XML AndroidManifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.zyw.broadcastsendsms" android:versionC

Android短信验证码自动填充功能_Android

笔者发现在很多应用中,都有自动获取验证码的功能:点击获取验证码按钮,收到短信,当前应用不需要退出程序就可以获取到短信中的验证码,并自动填充.觉得这种用户体验很赞,无须用户在短信和App之间来回切换,这个功能是如何实现的呢?其实很简单,就是用到了Android中的一个叫ContentObserver的东西,下面手动简单实现一个~~~ 一.开发ContentObserver 主要是用来监听收件箱的内容,一旦有新消息过来,就去监听是否是我想要的那个号码发过来的短信,如果是,就直接用正则表达式截取 /*

简单实现android短信发送器

先看看效果图: activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_pare

android中String转换成16进制的方法

问题描述 android中String转换成16进制的方法 想请教一下?把一个24个字节的字符串转换成16进制,并把结果打印出来要怎么写,网上有一些方法但是没有说转换完的16进制串打印出来要用哪个参数?求指点 解决方案 byte[] b = ""字符串"".getBytes();foreach (byte i : b){if (i < 16) System.out.print(""0"" + Integer.toHexS

短信功能-android 短信未读状态变为已读状态

问题描述 android 短信未读状态变为已读状态 我的APP,想要在会话列表那儿,点一个联络人,然后进入到与该人的所有聊天对话界面,在该界面里,我希望对方发来的简讯都变为已读状态我是这样写的cur_smsdetail_qcontact = new CursorWrapper(cur_smsdetail) { public String getString(int columnIndex) { if (super.getColumnIndex(""address""

容联,云通讯 android短信验证

问题描述 容联,云通讯 android短信验证 容联,云通讯 android短信验证怎么实现 看了官方给的提示和dome还是搞不懂求告知