国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

Android 短信轉換成彩信的消息數量(實例代碼)

2019-10-23 18:28:00
字體:
來源:轉載
供稿:網友

默認3條以上轉為彩信

改為5條

路徑vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/209305.html">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 短信轉換成彩信的消息數量,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VEVB武林網網站的支持!


注:相關教程知識閱讀請移步到Android開發頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 宁晋县| 宁强县| 城市| 海伦市| 定边县| 灵山县| 晋江市| 确山县| 肇源县| 曲沃县| 吴忠市| 永泰县| 同德县| 滨海县| 河源市| 秦安县| 武宁县| 安国市| 平潭县| 大石桥市| 广元市| 伊川县| 仪征市| 星座| 治多县| 当阳市| 大同县| 汤阴县| 绥芬河市| 宣汉县| 马公市| 峡江县| 阿坝| 平和县| 翁源县| 香格里拉县| 前郭尔| 宁化县| 鹿泉市| 大关县| 合肥市|