微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > 如何客制化长按"*","#"显示"P","W"

如何客制化长按"*","#"显示"P","W"

时间:10-02 整理:3721RD 点击:
[Version]

android4.2
[DESCRIPTION]
如何客制化长按"*","#"显示"P","W"
[SOLUTION]
1(
packages/apps/Contacts/src/com/android/contacts/dialpad/DialpadFragment.ja
va):
在DialpadFragment.java的onLongCLIck()中添加如下代码:
case R.id.star: {
removePreviousDigitIfPossible();
keyPressed(KeyEvent.KEYCODE_P);
if (mDialpadPressCount > 0) mDialpadPressCount--;
return true;
}
case R.id.pound: {
removePreviousDigitIfPossible();
keyPressed(KeyEvent.KEYCODE_W);
stopTone();
if (mDialpadPressCount > 0) mDialpadPressCount--;
return true;
}
2 (php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks\base\telephon\java\android\telephony\PhoneNumberUtils.java)修改如下函数:
public static String convertkeypadLettersToDigits(String input) {
if (input == null) {
return input;
}
int len = input.length();
if (len == 0) {
return input;
}
char[] out = input.toCharArray();
for (int i = 0; i < len; i++) {
char c = out;
// If this char isn't in KEYPAD_MAP at all, just leave it alone.
if(c=="P"||c=="W"||c==("p"||c=="w")
out = c;
else
out = (char) KEYPAD_MAP.get(c, c);
}
return new String(out);
}

学习了

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top