首页 > 代码库 > 怎么去掉联系人、通话记录、拨号列表界面中的电话号码中间的空格?
怎么去掉联系人、通话记录、拨号列表界面中的电话号码中间的空格?
1. 注解掉格式化处理
FILE: PhoneNumberFormatter.java
Before KK1
PATH: alps/packages/apps/contacts/src/com/android/contacts/Util
After KK1
PATH: alps/packages/apps/contactscommon/src/com/android/contacts/common/Util
public void afterTextChanged(Editable s) {
mSelfChanged = true;
/**不去调用父类format逻辑
*super.afterTextChanged(s);
**/
mSelfChanged = false;
}
2. 改动formatNumber方法直接返回原始号码,不会其进行格式化
FILE: PhoneNumberUtils.java
PATH: alps/frameworks/base/telephony/java/android/Telephony
* Format a phone number.
* <p>
* If the given number doesn‘t have the country code, the phone will be
* formatted to the default country‘s convention.
*
* @param phoneNumber
* the number to be formatted.
* @param defaultCountryIso
* the ISO 3166-1 two letters country code whose convention will
* be used if the given number doesn‘t have the country code.
* @return the formatted number, or null if the given number is not valid.
*
* @hide
*/
public static String formatNumber(String phoneNumber, String defaultCountryIso) {
// Before modified
// // Do not attempt to format numbers that start with a hash or star symbol.
// if (phoneNumber.startsWith("#") || phoneNumber.startsWith("*")) {
// return phoneNumber;
// }
// PhoneNumberUtil util = PhoneNumberUtil.getInstance();
// String result = null;
// try {
// PhoneNumber pn = util.parseAndKeepRawInput(phoneNumber, defaultCountryIso);
// result = util.formatInOriginalFormat(pn, defaultCountryIso);
// } catch (NumberParseException e) {
// }
// return result;
// After modified
return phoneNumber; // Just return, don‘t format the phoneNumber
}
3. 去掉导入号码时的格式化处理代码
Before JB5
FILE: AbstractStartSIMService.java
PATH: alps/packages/apps/contacts/src/com/mediatek/contacts/Simcontact
After JB5
FILE: SIMImportProcessor.java
PATH: alps/packages/apps/contacts/src/com/mediatek/contacts/simservice
(1) 去掉 actuallyImportOneSimContact() 方法中对 phoneNumber 的格式化处理代码 :
/*
* Bug Fix by Mediatek Begin. Original Android‘s code: xxx
* CR ID: ALPS00289127 Descriptions:
*/
Log.i(TAG, "[actuallyImportOneSimContact] phoneNumber before : " + phoneNumber);
// AsYouTypeFormatter mFormatter = PhoneNumberUtil.getInstance()
// .getAsYouTypeFormatter(countryCode);
// char[] cha = phoneNumber.toCharArray();
// int ii = cha.length;
// for (int num = 0; num < ii; num++) {
// phoneNumber = mFormatter.inputDigit(cha[num]);
// }
Log.i(TAG, "[actuallyImportOneSimContact] phoneNumber after : " + phoneNumber);
/*
* Bug Fix by Mediatek End.
*/
(2) 去掉 actuallyImportOneSimContact() 方法中对 additionalNumber 的格式化处理代码:
/*
* Bug Fix by Mediatek Begin. Original Android‘s code:
* xxx CR ID: ALPS00289127 Descriptions:
*/
Log.i(TAG, "[actuallyImportOneSimContact] additionalNumber before : "
+ additionalNumber);
// AsYouTypeFormatter mFormatter = PhoneNumberUtil.getInstance()
// .getAsYouTypeFormatter(countryCode);
// char[] cha = additionalNumber.toCharArray();
// int ii = cha.length;
// for (int num = 0; num < ii; num++) {
// additionalNumber = mFormatter.inputDigit(cha[num]);
// }
Log.i(TAG, "[actuallyImportOneSimContact] additionalNumber after : "
+ additionalNumber);
/*
* Bug Fix by Mediatek End.
*/
FILE: PhoneNumberFormatter.java
Before KK1
PATH: alps/packages/apps/contacts/src/com/android/contacts/Util
After KK1
PATH: alps/packages/apps/contactscommon/src/com/android/contacts/common/Util
public void afterTextChanged(Editable s) {
mSelfChanged = true;
/**不去调用父类format逻辑
*super.afterTextChanged(s);
**/
mSelfChanged = false;
}
2. 改动formatNumber方法直接返回原始号码,不会其进行格式化
FILE: PhoneNumberUtils.java
PATH: alps/frameworks/base/telephony/java/android/Telephony
* Format a phone number.
* <p>
* If the given number doesn‘t have the country code, the phone will be
* formatted to the default country‘s convention.
*
* @param phoneNumber
* the number to be formatted.
* @param defaultCountryIso
* the ISO 3166-1 two letters country code whose convention will
* be used if the given number doesn‘t have the country code.
* @return the formatted number, or null if the given number is not valid.
*
* @hide
*/
public static String formatNumber(String phoneNumber, String defaultCountryIso) {
// Before modified
// // Do not attempt to format numbers that start with a hash or star symbol.
// if (phoneNumber.startsWith("#") || phoneNumber.startsWith("*")) {
// return phoneNumber;
// }
// PhoneNumberUtil util = PhoneNumberUtil.getInstance();
// String result = null;
// try {
// PhoneNumber pn = util.parseAndKeepRawInput(phoneNumber, defaultCountryIso);
// result = util.formatInOriginalFormat(pn, defaultCountryIso);
// } catch (NumberParseException e) {
// }
// return result;
// After modified
return phoneNumber; // Just return, don‘t format the phoneNumber
}
3. 去掉导入号码时的格式化处理代码
Before JB5
FILE: AbstractStartSIMService.java
PATH: alps/packages/apps/contacts/src/com/mediatek/contacts/Simcontact
After JB5
FILE: SIMImportProcessor.java
PATH: alps/packages/apps/contacts/src/com/mediatek/contacts/simservice
(1) 去掉 actuallyImportOneSimContact() 方法中对 phoneNumber 的格式化处理代码 :
/*
* Bug Fix by Mediatek Begin. Original Android‘s code: xxx
* CR ID: ALPS00289127 Descriptions:
*/
Log.i(TAG, "[actuallyImportOneSimContact] phoneNumber before : " + phoneNumber);
// AsYouTypeFormatter mFormatter = PhoneNumberUtil.getInstance()
// .getAsYouTypeFormatter(countryCode);
// char[] cha = phoneNumber.toCharArray();
// int ii = cha.length;
// for (int num = 0; num < ii; num++) {
// phoneNumber = mFormatter.inputDigit(cha[num]);
// }
Log.i(TAG, "[actuallyImportOneSimContact] phoneNumber after : " + phoneNumber);
/*
* Bug Fix by Mediatek End.
*/
(2) 去掉 actuallyImportOneSimContact() 方法中对 additionalNumber 的格式化处理代码:
/*
* Bug Fix by Mediatek Begin. Original Android‘s code:
* xxx CR ID: ALPS00289127 Descriptions:
*/
Log.i(TAG, "[actuallyImportOneSimContact] additionalNumber before : "
+ additionalNumber);
// AsYouTypeFormatter mFormatter = PhoneNumberUtil.getInstance()
// .getAsYouTypeFormatter(countryCode);
// char[] cha = additionalNumber.toCharArray();
// int ii = cha.length;
// for (int num = 0; num < ii; num++) {
// additionalNumber = mFormatter.inputDigit(cha[num]);
// }
Log.i(TAG, "[actuallyImportOneSimContact] additionalNumber after : "
+ additionalNumber);
/*
* Bug Fix by Mediatek End.
*/
怎么去掉联系人、通话记录、拨号列表界面中的电话号码中间的空格?
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。