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

短信转彩信限制页数

时间:2014-05-26 15:10:16      阅读:274      评论:0      收藏:0      [点我收藏+]

标签:android   c   class   java   ext   a   

需求

Message->option->settings->Txt Message(SMS)->Sms size limit for converting to mms - Over 10 segment

Options:
- over 3 pages
- over 6 pages
- over 10 pages
- Never

方法:

packages/apps/Mms/xml/multicardpreferences.xml
packages/apps/Mms/xml/preferences.xml
packages/apps/Mms/xml/smsmulticardpreferences.xml
packages/apps/Mms/xml/smspreferences.xml

在上诉文件中添加列表项

<ListPreference
            android:key="pref_key_sms_mms_max"
            android:title="@string/sms_input_Maximum_title"
            android:defaultValue="4"
            android:entries="@array/pref_sms_input_Maximum_choice"
            android:entryValues="@array/pref_sms_input_Maximum_values"
            android:dialogTitle="@string/sms_input_Maximum_dialog_title"
            android:summary="@string/sms_input_Maximum_summary"/>

定义字符串

/trunk/packages/apps/Mms/res/values/mtk_arrays.xml
/trunk/packages/apps/Mms/res/values/mtk_strings.xml

 <string-array name="pref_sms_input_Maximum_choice">
        <item>over 3 pages</item>
        <item>over 6 pages</item>
        <item>over 10 pages</item>
    <item>never</item>
    </string-array>
    <string-array name="pref_sms_input_Maximum_values" translatable="false">
        <item>4</item>
        <item>7</item>
        <item>11</item>
    <item>999</item>
    </string-array>

 

<string name="sms_input_Maximum_title">Converting to MMS</string>
    <string name="sms_input_Maximum_dialog_title">SMS size limit for converting to MMS</string>
    <string name="sms_input_Maximum_summary">When SMS size is over the given value, SMS converts to MMS</string>


3,/trunk/packages/apps/Mms/src/com/android/mms/ui/SmsPreferenceActivity.java

在java中添加菜单项

 private void addSmsToMmsPreference() {
    if (true) {
            mSmsInputMax = (ListPreference) findPreference(SMS_INPUT_MAX);
        if (mSmsInputMax != null) {
                 mSmsInputMax.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
            
            @Override
            public boolean onPreferenceChange(Preference preference, Object newValue) {
                // TODO Auto-generated method stub
                Log.i("wangdandan", "newValue = "+newValue);
                String str = (String) newValue;
                int value = Integer.valueOf(str);
                MmsConfig.setSmsToMmsText(value);
                return true;
            }
        });     
        
            }
        }
    }

在private void restoreDefaultPreferences()方法中重新赋值

 editor.putString(SMS_INPUT_MAX, "11");
            MmsConfig.setSmsToMmsText(11);

3,/trunk/packages/apps/Mms/src/com/android/mms/MmsConfig.java

 

 else if ("smsToMmsTextThreshold".equalsIgnoreCase(value)) {
                            /// M: Operator Plugin

                if (FeatureOption.SAGEREAL_SMSTOMMS_LIMIT){  //工程中添加的宏控
                     SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
                    String vaule = sp.getString(SmsPreferenceActivity.SMS_INPUT_MAX, "11");
                    Log.i("wangdandan", "loadMmsSettings.vaule = "+vaule);
                    mMmsConfigPlugin.setSmsToMmsTextThreshold(Integer.parseInt(vaule));
                            } else {
                                mMmsConfigPlugin.setSmsToMmsTextThreshold(Integer.parseInt(text));
                }

                        }

 

 public static void setSmsToMmsText(int value) {
        mMmsConfigPlugin.setSmsToMmsTextThreshold(value);
    }

 

短信转彩信限制页数,布布扣,bubuko.com

短信转彩信限制页数

标签:android   c   class   java   ext   a   

原文地址:http://www.cnblogs.com/plpdan/p/3746336.html

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