您好,登錄后才能下訂單哦!
本篇文章為大家展示了Android應(yīng)用中怎么將短信轉(zhuǎn)換成彩信,內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。
默認(rèn)3條以上轉(zhuǎn)為彩信
改為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 //剩余字?jǐn)?shù)顯示 private TextView mSendButtonMms; // Press to send mms //彩信發(fā)送按鈕,TextView中加入圖片 private ImageButton mSendButtonSms; // Press to send sms //短信發(fā)送按鈕 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]; //已輸入短信條數(shù) final int remainingInCurrentMessage = params[2]; //剩余字?jǐn)?shù) mWorkingMessage.setLengthRequiresMms( msgCount >= MmsConfig.getSmsToMmsTextThreshold(), true); //轉(zhuǎn)為彩信的短信條數(shù) 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); //顯示短信發(fā)送按鈕或彩信發(fā)送按鈕 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; }
上述內(nèi)容就是Android應(yīng)用中怎么將短信轉(zhuǎn)換成彩信,你們學(xué)到知識或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識儲備,歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。