android开发笔记之拨号界面输入特定指令进行特定操作

        在android手机的 拨号界面,我们常常输入特定指令进行特定操作,如输入*#06#,可以查看IMEI号等,那么我们也可以自定义相应的特定指令,对应用户相应的操作:

        我们查看源码:输入*#06#,可以查看IMEI号是如何实现,我们自定义相应的一个特定指令,实现相对应的操作。

     SpecialCharSequenceMgrProxy.java (packages\apps\contacts\src\com\mediatek\contacts)

1.定义特定的命令:

    private static final String MMI_IMEI_DISPLAY = "*#06#";
    private static final String MMI_IMEI_EDIT = "*#328#*";//added by Wuyh 2013-10-16
    private static final String MMI_VERNO_NUM = "*#0000#";//add by lvmingfei for verno number in 2013-12-10
    private static final String MMI_HARDWARE_NUM = "*#8818#"; //add by wangxianming for Hardware number in 2014-01-09

    private static final String ADN_PHONE_NUMBER_COLUMN_NAME = "number";
    private static final String ADN_NAME_COLUMN_NAME = "name";
    private static final String ADN_INDEX_COLUMN_NAME = "index";


2.处理输入特定指令的逻辑代码:

    static boolean handleChars(Context context, String input, boolean useSystemWindow,
            EditText textField) {
        Log.d(TAG, "handleChars() dialString:" + input);
        if (SlotUtils.isGeminiEnabled()) {
            String dialString = PhoneNumberUtils.stripSeparators(input);
            if (handleIMEIDisplay(context, dialString, useSystemWindow)
			///HY:zhangshenghua CIT @{
                || handleCIT(context, dialString)    //added by xuaping@hongyucom, at 2013-06-21.

                || handleSAR(context, dialString)  //added by chencheng@hongyucom
            ///@}
                || handlePinEntry(context, dialString)
                    || handleAdnEntry(context, dialString, textField)
                    || handleIMEIEdit(context, dialString, useSystemWindow) //added by Wuyh 2013-10-16
                    || handleShowVernoNumber(context, dialString, useSystemWindow) //added by lvmingfei 2013-12-10
                    || handleShowHardWareNumber(context, dialString, useSystemWindow) //add by wangxianming for Hardware number in 2014-01-09
                    || handleVIPFunctionPassword(context, dialString, useSystemWindow) //add by wangxianming for vipFunction password in 2014-03-12
                    || handleSecretCode(context, dialString)) {
                return true;
            }
            return false;
        } else {
            return SpecialCharSequenceMgr.handleChars(context, input, useSystemWindow, textField);
        }
    }


3.相对应的特别操作逻辑代码:

    static boolean handleIMEIDisplay(Context context, String input, boolean useSystemWindow) {
        if (SlotUtils.isGeminiEnabled()) {
           if (input.equals(MMI_IMEI_DISPLAY)) {
                showIMEIPanel(context, useSystemWindow);
                return true;
            }
            return false;
        } else {
            return SpecialCharSequenceMgr.handleIMEIDisplay(context, input,
                    useSystemWindow);
        }
    }


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hfreeman2008

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值