1.来电通知栏电话号码+号显示在右侧的修改

位置:packages/apps/InCallUI/src/com/android/incallui/StatusBarNotifier.java

刚开始修改的时候,在方法buildAndSendNotification()中添加:

//add by chensenquan20160727

Configuration con =mContext.getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(contentTitle.charAt(0)=='+'){

String newChar =contentTitle.toString().substring(1)+"+";

contentTitle =contentTitle.toString().replace(contentTitle, newChar);

}

}

//add end

虽然这种办法可以解决+号能显示在左侧,但是当电话号码中间有空格的时候,他会显示顺序错乱问题

后来经分析,是有一个属性可以专门解决这种问题:setTextDirection(View.TEXT_DIRECTION_LTR)

经修改为:

Configuration con =mContext.getResources().getConfiguration();

String l = con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(contentTitle.charAt(0)=='+'){

contentTitle =BidiFormatter.getInstance().unicodeWrap(contactInfo.number.toString(),TextDirectionHeuristics.LTR);

}

}

这是判断如果有+号的号码,才会做一次LTR属性布局,验证没问题,快速代码提交

最后一次修改,这也是我无意中发现的问题,当有+号的号码显示没有问题,如果没有+号的号码且没有添加LTR这种属性该如何显示,后来经验证,这种判断+号的做法是不可取的,只是解决了+号的问题,并没有解决号码顺序错乱的问题

又经修改为:

private String getContentTitle(ContactCacheEntrycontactInfo, Call call) {

if (call.isConferenceCall()&& !call.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)) {

/// M: [VoLTEconference]incoming volte conference @{

/*

* Googlecode:

returnmContext.getResources().getString(R.string.card_title_conf_call);

*/

if(!isIncomingVolteConference(call)) {

return mContext.getResources().getString(R.string.card_title_conf_call);

}

/// @}

}

if(TextUtils.isEmpty(contactInfo.name)) {

returnTextUtils.isEmpty(contactInfo.number) ? null

: BidiFormatter.getInstance().unicodeWrap(

contactInfo.number.toString(),TextDirectionHeuristics.LTR);

}

returnBidiFormatter.getInstance().unicodeWrap(

contactInfo.number.toString(),TextDirectionHeuristics.LTR);

}

在getContentTitle里面直接返回可以设置LTR布局属性的名称。问题解决。终于捏了一把汗

其他的+号显示问题如下:

2.未接来电号码+号显示在右侧及顺序错乱

代码位置:packages/services/Telecomm/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java

方法:showMissedCallNotification()

同上,最后修改为:

在方法:getNameForCall()

if (mMissedCallCount == 1) {

BidiFormatterbidiFormatter = BidiFormatter.getInstance();

returnbidiFormatter.unicodeWrap(name, TextDirectionHeuristics.LTR);

}

3.呼叫记录和通话记录号码+号显示在右侧

位置:packages/apps/Dialer/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java

方法:setPhoneCallDetails()

同上,最后修改为:

CharSequence nameText;

final CharSequence displayNumber = details.displayNumber;

if (TextUtils.isEmpty(details.name)) {

nameText = displayNumber;

// We have a real phone number as "nameView" somake it always LTR

views.nameView.setTextDirection(View.TEXT_DIRECTION_LTR);

} else {

nameText = details.name;

views.nameView.setTextDirection(View.LAYOUT_DIRECTION_LOCALE);//addby chensenquan 20160801

}

4.通话记录电话详细号码+号显示在右侧

位置:packages/apps/Dialer/src/com/android/dialer/CallDetailActivity.java

方法:onGetCallDetails()

同上,最后修改为:
if (!TextUtils.isEmpty(firstDetails.name)) {

//add by chensenquan 20160727

mCallerName.setTextDirection(View.LAYOUT_DIRECTION_LOCALE);

mCallerName.setText(firstDetails.name);

mCallerNumber.setText(callLocationOrType +" " + getPhoneNumber(displayNumberStr));

} else {

mCallerName.setTextDirection(View.TEXT_DIRECTION_LTR);

mCallerName.setText(getPhoneNumber(displayNumberStr));

//add end

if (!TextUtils.isEmpty(callLocationOrType)){

mCallerNumber.setText(callLocationOrType);

mCallerNumber.setVisibility(View.VISIBLE);

} else {

mCallerNumber.setVisibility(View.GONE);

}

}

如果号码中有字串连接,需如下处理:

private String getPhoneNumber(String phoneNumber){

Configuration con = mContext.getResources().getConfiguration();

String l = con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(phoneNumber.charAt(0)=='+'){

if(mCallerName==null){

String newChar =phoneNumber.toString().substring(1)+"+";

phoneNumber= phoneNumber.toString().replace(phoneNumber, newChar);

}

}

}

return phoneNumber;

}

5.通话界面号码+号显示在右侧

位置:packages/apps/InCallUI/src/com/android/incallui/CallCardFragment.java

方法:setPrimaryName()

同上,最后修改为:

//Set direction of the name field

intnameDirection = View.LAYOUT_DIRECTION_LOCALE;

if(nameIsNumber) {

nameDirection = View.TEXT_DIRECTION_LTR;

}

mPrimaryName.setTextDirection(nameDirection);

6.呼叫记录和通话记录长按弹出菜单框号码+号显示在右侧

位置:packages/apps/Dialer/src/com/android/dialer/calllog/CallLogAdapter.java

privatefinal View.OnCreateContextMenuListener mOnCreateContextMenuListener =

new View.OnCreateContextMenuListener() {

@Override

public voidonCreateContextMenu(ContextMenu menu, View v,

ContextMenuInfo menuInfo) {

finalCallLogListItemViewHolder vh =

(CallLogListItemViewHolder) v.getTag();

if(TextUtils.isEmpty(vh.number)) {

return;

}

//addby chensenquan 20160729

Configurationcon = mContext.getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(vh.number.charAt(0)=='+'){

String newChar = vh.number.toString().substring(1)+"+";

vh.number = vh.number.toString().replace(vh.number, newChar);

}

}

//add end

menu.setHeaderTitle(vh.number);

final MenuItemcopyItem = menu.add(

ContextMenu.NONE,

R.id.context_menu_copy_to_clipboard,

ContextMenu.NONE,

R.string.copy_text);

}

7.来电转接号码+号显示在右侧

位置:packages/services/Telephony/src/com/android/phone/CallForwardEditPreference.java

方法:updateSummaryText()

//addby chensenquan 20160727

Configurationcon = getContext().getResources().getConfiguration();

Stringl = con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(summaryOn.charAt(0)=='+'){

StringnewChar = summaryOn.toString().substring(1)+"+";

summaryOn =summaryOn.toString().replace(summaryOn, newChar);

}

}

setSummaryOn(summaryOn);

//addend

8.来电转接编辑框号码+号显示在右侧

位置:packages/services/Telephony/src/com/android/phone/EditPhoneNumberPreference.java

方法:onBindDialogView()

//add by chensenquan20160726

Configuration con = getContext().getResources().getConfiguration();

String l = con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(mPhoneNumber.charAt(0)=='+'){

String newChar =mPhoneNumber.toString().substring(1)+"+";

mPhoneNumber =mPhoneNumber.toString().replace(mPhoneNumber, newChar);

}

}

editText.setText(mPhoneNumber);

//add end

9.联系人收藏界面号码+号显示在右侧

位置:packages/apps/ContactsCommon/src/com/android/contacts/common/list/ContactTileView.java

方法:loadFromContact()

mName.setTextDirection(View.LAYOUT_DIRECTION_LOCALE);//addby chensenquan 20160801

mName.setText(getNameForView(entry.name));

备注:跟phone应用中收藏是一个界面

10.所有联系人界面号码+号显示在右侧

位置:packages/apps/ContactsCommon/src/com/android/contacts/common/list/ContactListItemView.java

方法:getNameTextView()

mNameTextView.setElegantTextHeight(false);

mNameTextView.setTextDirection(View.LAYOUT_DIRECTION_LOCALE);//addby chensenquan 20160801 for bug9453

addView(mNameTextView);

备注:跟phone应用中联系人界面是同一界面

11.短信+号应该出现在左边的数字(对话框)

位置:packages/apps/Contacts/src/com/android/contacts/activities/ShowOrCreateActivity.java

方法:onCreateDialog()

String m_Message =message.toString();

BidiFormatter.getInstance().unicodeWrap(

m_Message .toString(),TextDirectionHeuristics.LTR);

12.短信+号应该出现在左边的数字

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java

mTopTitle = (TextView)mActionBarCustomView.findViewById(R.id.tv_top_title);

//zyh add 2016-08-01(z702 bug 9450:Set the textdirection)

if(Locale.getDefault().getLanguage().equals("ar")){

mTopTitle.setTextDirection(View.TEXT_DIRECTION_LTR);

}

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ConversationListItem.java

方法:onFinishInflate()

mFromView = (TextView)findViewById(R.id.from);

//zyh add 2016-08-01(z702 bug 9450:Setthe text direction)

if(Locale.getDefault().getLanguage().equals("ar")){

mFromView.setTextDirection(TEXT_DIRECTION_LTR);

}

位置:

vendor/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/setting/SmsPreferenceActivity.java

mNumberText.setText(gotScNumber);

//zyh add 2016-08-01(z702 bug 9452:Setthe mNumberText direction)

if(Locale.getDefault().getLanguage().equals("ar")){

mNumberText.setGravity(Gravity.RIGHT);

mNumberText.setTextDirection(View.TEXT_DIRECTION_LTR);

}

13. call 来电转接编辑框内号码显示错乱且输入号码+号显示在右边

位置:packages/services/Telephony/src/com/android/phone/EditPhoneNumberPreference.java

方法:onBindDialogView()

editText.setText(mPhoneNumber);

//add by chensenquan 20160726

Configuration con =getContext().getResources().getConfiguration();

String l = con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

editText.setGravity(Gravity.RIGHT); //控制+号在左边,右边输入号码

editText.setTextDirection(View.TEXT_DIRECTION_LTR);

editText.setSelection(editText.getText().toString().length());//光标显示在号码最后面

}

//add end

14.短信+新消息弹出dialog框+号显示在右边

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/mms/ui/DialogModeActivity.java

方法:setDialogView()

//zyh add 2016-08-01(z702 bug 9451:Setthe number direction)

String str_temp = getSenderString();

if(Locale.getDefault().getLanguage().equals("ar")){

str_temp =BidiFormatter.getInstance().unicodeWrap(str_temp, TextDirectionHeuristics.LTR);

}

mSender.setText(str_temp);

15.短信号码+号应该出现在左边的数字

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java

方法:addCallAndContactMenuItems()

//zyh add2016-08-01(z702 bug 9795:Set the number direction)

String temp_uriString =uriString;

if(Locale.getDefault().getLanguage().equals("ar")){

temp_uriString =BidiFormatter.getInstance().unicodeWrap(temp_uriString,TextDirectionHeuristics.LTR);

}

String addContactString= getString(R.string.menu_add_address_to_contacts,

emp_uriString);

menu.add(0,MENU_ADD_ADDRESS_TO_CONTACTS, 0, addContactString)

.setOnMenuItemClickListener(l)

.setIntent(intent);
位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/MessageUtils.java

方法:getTextMessageDetails()

//zyh add2016-08-01(z702 bug 9795:Set the number direction)

String temp_mAddress =msgItem.mAddress;

if(Locale.getDefault().getLanguage().equals("ar")){

temp_mAddress =BidiFormatter.getInstance().unicodeWrap(temp_mAddress,TextDirectionHeuristics.LTR);

}

details.append(temp_mAddress);

//zyh add 2016-08-01(z702bug 9795:Set the number direction)

if(msgItem.mServiceCenter== null){

details.append("");

}else{

String str_temp =msgItem.mServiceCenter;

if(Locale.getDefault().getLanguage().equals("ar")){

str_temp =BidiFormatter.getInstance().unicodeWrap(str_temp, TextDirectionHeuristics.LTR);

}

details.append(str_temp);

}

16.阿拉伯语短信发送成功后返回发送报告时的号码国际字冠需靠左。(bug 9813)

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/transaction/MessagingNotification.java

方法:

private static voidupdateDeliveryNotification(final Context context,

booleanisStatusMessage,

finalCharSequence message,

final longtimeMillis) {

if (!isStatusMessage) {

return;

}

if (!NotificationPreferenceActivity.getNotificationEnabled(context)) {

return;

}

sToastHandler.post(new Runnable() {

@Override

public void run() {

if(SystemProperties.getBoolean("ro.custom.sms_report", false)){

//zyh add 2016-08-12 update

//CharSequence ticker="Deliveryreport";

CharSequence ticker =context.getResources().getString(R.string.delivery_report_activity);

Notification notification = new Notification(R.drawable.stat_notify_sms,message, System.currentTimeMillis());

notification.flags |= Notification.FLAG_SHOW_LIGHTS;

notification.flags |= Notification.FLAG_AUTO_CANCEL;

notification.ledARGB = 0xff00ff00;

notification.ledOnMS = 500;

notification.ledOffMS = 2000;

Intent intent = new Intent();

notification.defaults |=Notification.DEFAULT_ALL;

PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,intent,

PendingIntent.FLAG_UPDATE_CURRENT);

notification.setLatestEventInfo(context, ticker, message, pendingIntent);

NotificationManager nm = (NotificationManager)

context.getSystemService(context.NOTIFICATION_SERVICE);

nm.notify(NOTIFICATION_ID, notification);

//zyh add 2016-08-10(z702/z703 bug 9813:Set thetext direction)

//if(Locale.getDefault().getLanguage().equals("ar")){

// String str_temp = message.toString();

// str_temp=BidiFormatter.getInstance().unicodeWrap(str_temp,TextDirectionHeuristics.LTR);

// Toast.makeText(context, str_temp,(int)timeMillis).show();

//}else{

Toast.makeText(context, message, (int)timeMillis).show();

//}

}else{

Toast.makeText(context, message,(int)timeMillis).show();

}

}

});

}

17.设置阿拉伯语/打开短信发送报告/发送 一条短信/查看短信回执报告 +号显示在数字右边。(bug 9813)

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/transaction/MessagingNotification.java

方法:getSmsNewDeliveryInfo()

//zyhadd 2016-08-12(z702/z703 bug 9813:Set the text direction)

if(Locale.getDefault().getLanguage().equals("ar")){

name=BidiFormatter.getInstance().unicodeWrap(name,TextDirectionHeuristics.LTR);

}

returnnew MmsSmsDeliveryInfo(context.getString(R.string.delivery_toast_body, name),

timeMillis);

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ConversationListItem.java

// set mSubjectViewtext before mIpConvListItem.onIpBind()

if (mConversation.hasUnreadMessages()) {

String subject = conversation.getSnippet();

SpannableStringBuilder buf = new SpannableStringBuilder(subject);

buf.setSpan(STYLE_BOLD, 0, buf.length(),

Spannable.SPAN_INCLUSIVE_EXCLUSIVE);

//zyh add 2016-08-10(z702/z703 bug 9797:Set thetext direction)

String str_temp = buf.toString();

if(Locale.getDefault().getLanguage().equals("ar")){

str_temp =BidiFormatter.getInstance().unicodeWrap(str_temp, TextDirectionHeuristics.LTR);

}

mSubjectView.setText(str_temp);

//mSubjectView.setText(buf);

} else {

//zyh add 2016-08-10(z702/z703 bug 9797:Set thetext direction)

String subject = conversation.getSnippet();

Configuration con = mContext.getResources().getConfiguration();

if(Locale.getDefault().getLanguage().equals("ar")){

subject =BidiFormatter.getInstance().unicodeWrap(subject, TextDirectionHeuristics.LTR);

}

mSubjectView.setText(subject);

}

18.短信添加联系人列表号码+号显示在数字右边。(bug 9791)

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java

//zyh add2016-08-13(z702/z703 bug 9795:Set the number direction)

if(Locale.getDefault().getLanguage().equals("ar")){

mTopSubtitle.setText(BidiFormatter.getInstance().unicodeWrap(

subTitle,TextDirectionHeuristics.LTR));

}else{

mTopSubtitle.setText(subTitle);

}

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/setting/NotificationPreferenceActivity.java

private voidrestoreDefaultPreferences() {

SharedPreferences.Editor editor =

PreferenceManager.getDefaultSharedPreferences(

NotificationPreferenceActivity.this).edit();

editor.putBoolean(NOTIFICATION_ENABLED, true);

editor.putString(NOTIFICATION_MUTE, "0");

editor.putString(NOTIFICATION_RINGTONE, DEFAULT_RINGTONE);

editor.putBoolean(NOTIFICATION_VIBRATE, true);

//zyh update 2016-08-13(z702/z703 bug 9835:sms popup default close)

editor.putBoolean(POPUP_NOTIFICATION, false);//true

editor.apply();

setPreferenceScreen(null);

setMessagePreferences();

setListPrefSummary();

}

public static booleanisPopupNotificationEnable() {

if (!isNotificationEnable()) {

return false;

}

SharedPreferences prefs

=PreferenceManager.getDefaultSharedPreferences(MmsApp.getApplication());

//zyh update 2016-08-13(z702/z703 bug 9835:sms popup default close)

boolean enable =prefs.getBoolean(NotificationPreferenceActivity.POPUP_NOTIFICATION,false);//true

return enable;

}

19.修改短信选择联系人列表对话框选项时号码+号显示在数字右边。(bug 9791)

位置:vendor/mediatek/proprietary/packages/apps/Mms/res/layout-ar/mms_chips_recipient_dropdown_item.xml

添加对应的android:textDirection="ltr"

20.阿拉伯语下,收到一个MMS,detail里面号码的显示错误。(bug 10657)

位置:vendor/mediatek/proprietary/packages/apps/Mms/res/layout-ar-finger-1080X720/compose_message_activity.xml

添加对应的android:textDirection="ltr"

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java

//zyh add2016-08-01(z703 bug 10654:Set the text direction)

if(Locale.getDefault().getLanguage().equals("ar")){

mTextEditor.setTextDirection(View.TEXT_DIRECTION_LTR);

mTextEditor.setGravity(Gravity.RIGHT|Gravity.CENTER_VERTICAL);

}

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/MessageUtils.java

private static voidinitializeMsgDetails(Context context,

StringBuilder details, Resources res, MultimediaMessagePdumsg) {

details.append(res.getString(R.string.message_type_label));

details.append(res.getString(R.string.multimedia_message));

if (msg instanceof RetrieveConf) {

// From: ***

String from = extractEncStr(context, ((RetrieveConf)msg).getFrom());

//zyh add 2016-08-23(z702/z703 bug 10657:Set thenumber direction)

if(Locale.getDefault().getLanguage().equals("ar")&& !TextUtils.isEmpty(from)){

from = BidiFormatter.getInstance().unicodeWrap(from,TextDirectionHeuristics.LTR);

}

details.append('\n');

details.append(res.getString(R.string.from_label));

details.append(!TextUtils.isEmpty(from)? from:

res.getString(R.string.hidden_sender_address));

}

// To: ***

details.append('\n');

details.append(res.getString(R.string.to_address_label));

EncodedStringValue[] to = msg.getTo();

if (to != null) {

String str_temp = EncodedStringValue.concat(to);

//zyh add 2016-08-23(z702/z703 bug 10657:Setthe number direction)

if(Locale.getDefault().getLanguage().equals("ar")){

str_temp =BidiFormatter.getInstance().unicodeWrap(str_temp, TextDirectionHeuristics.LTR);

}

//details.append(EncodedStringValue.concat(to));

details.append(str_temp);

}

else {

Log.w(TAG, "recipient list is empty!");

}

// Bcc: ***

if (msg instanceof SendReq) {

EncodedStringValue[] values = ((SendReq) msg).getBcc();

if ((values != null) && (values.length > 0)) {

details.append('\n');

details.append(res.getString(R.string.bcc_label));

details.append(EncodedStringValue.concat(values));

}

}

}

21.修改短信通知,新消息+号应该显示在左侧 (bug 9813)

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/transaction/MessagingNotification.java

方法:updateNotification()

添加跟号码有关的处理,如:

//add by chensenquan20160808 for bug9813

String message=BidiFormatter.getInstance().unicodeWrap(

mostRecentNotification.formatBigMessage(context).toString(),TextDirectionHeuristics.LTR);

noti.setContentText(message);

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/mms/ui/DialogModeActivity.java

//add by chensenquan20160808 for bug9813

mSmsContentText.setText(BidiFormatter.getInstance().unicodeWrap(content,TextDirectionHeuristics.LTR));

//add end

//add bychensenquan 20160808 for bug9813

mSmsContentText.setText(BidiFormatter.getInstance().unicodeWrap(

buf.toString(),TextDirectionHeuristics.LTR));

mSmsContentText.setVisibility(View.VISIBLE);

//add end

22.处理拨号盘内搜索列表号码+号应该显示在左侧

位置:packages/apps/Dialer/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java

//add by chensenquan20160810

Configuration con =mContext.getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

displayName=mBidiFormatter.unicodeWrap(displayName.toString(),TextDirection

Heuristics.LTR);

}

//add end

viewHolder.name.setText(displayName);

23.修改阿拉伯语下,SMS里面添加一个保存的联系人,+86显示错误(BUG 10650)

位置:frameworks/ex/chips/res/layout/chips_recipient_dropdown_item.xml

添加对应的android:textDirection="ltr"

24.信息内插入联系人号码后,+号显示在数字的右边。(bug 10896)

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/mms/ui/VCardAttachment.java

if(!mNumbers.isEmpty()) {

if (mNumbers.size() > 1) {

i = 1;

StringBuffer buf = newStringBuffer();

buf.append(textVCardString);

for (String number : mNumbers){

buf.append(mContext.getString(R.string.contact_tel) + i + ": " +number + "\n");

i++;

}

textVCardString = buf.toString();

} else {

String str_numbers = mNumbers.get(0);

//zyh add 2016-08-25(z702 bug10896:Set the number direction)

if(Locale.getDefault().getLanguage().equals("ar")){

str_numbers =BidiFormatter.getInstance().unicodeWrap(str_numbers,TextDirectionHeuristics.LTR);

}

textVCardString +=mContext.getString(R.string.contact_tel) + ": " +str_numbers/*mNumbers.get(0)*/

+"\n";

}

}

25.查看彩信里面的+号显示在数字的右边 (bug 10914)

主题内容:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/MessageListItem.java

private CharSequenceformatMessage(MessageItem msgItem, String body,

String subject, Pattern highlight,

String contentType) {

SpannableStringBuilder buf = new SpannableStringBuilder();

boolean hasSubject = !TextUtils.isEmpty(subject);

//zyh add 2016-08-26(z702/z703 bug 10908:Set the number direction)

if(Locale.getDefault().getLanguage().equals("ar")){

subject = BidiFormatter.getInstance().unicodeWrap(subject,TextDirectionHeuristics.LTR);

body = BidiFormatter.getInstance().unicodeWrap(body,TextDirectionHeuristics.LTR);

}

if (hasSubject) {

buf.append(mContext.getResources().getString(R.string.inline_subject,subject));

}

if (!TextUtils.isEmpty(body)) {

// Converts html to spannable if MmsContentType is"text/html".

if (contentType != null &&MmsContentType.TEXT_HTML.equals(contentType)) {

buf.append("\n");

buf.append(Html.fromHtml(body));

} else {

if (hasSubject) {

buf.append(" - ");

}

buf.append(body);

}

}

。。。

return buf;

}

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/MmsPlayerActivityAdapter.java

if(text != null) {

/// M: ALPS00619099, highlight matched search string in mms player @ {

if (mHighlight != null) {

setHighlightText(mText, text);

} else {

//zyh add 2016-08-26(z702/z703 bug10914:Set the number direction)

if(Locale.getDefault().getLanguage().equals("ar")){

text = BidiFormatter.getInstance().unicodeWrap(text,TextDirectionHeuristics.LTR);

}

SpannableString ss = new SpannableString(text);

mText.setText(ss);

}

/// @}

if (textSize != 0) {

mText.setTextSize(textSize);

}

mText.setVisibility(View.VISIBLE);

/// M: ALPS00527989, Extend TextView URL handling @ {

mOpMmsPlayerActivityAdapterExt.setExtendUrlSpan(mText);

/// @}

itemView.setCurrentTextView(mText);

}

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/SlideView.java

//zyhadd 2016-08-26(z702/z703 bug 10914:Set the number direction)

if(Locale.getDefault().getLanguage().equals("ar")){

text= BidiFormatter.getInstance().unicodeWrap(text, TextDirectionHeuristics.LTR);

}

SpannableStringss = new SpannableString(text);

mTextView.setText(ss);

mOpSlideViewExt.setText(mActivity,mTextView, mConformanceMode);

26.阿拉伯语下短信联系人输入框,输入+86号码,顺序显示错误。(bug 10654)

位置: vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java

//zyh add2016-08-01(z703 bug 10654:Set the text direction)

if(Locale.getDefault().getLanguage().equals("ar")){

mRecipientsEditor.setTextDirection(View.TEXT_DIRECTION_LTR);

mRecipientsEditor.setGravity(Gravity.RIGHT|Gravity.CENTER_VERTICAL);

}

// M: fix bugALPS00355897

//PhoneNumberFormatter.setPhoneNumberFormattingTextWatcher(this,mRecipientsEditor);

位置:frameworks/ex/chips/src/com/android/mtkex/chips/MTKRecipientEditTextView.java

添加setTextDirection属性后,联系人不能点击处理:

protected booleanisTouchPointInChip(float posX, float posY) {

boolean isInChip =true;

Layout layout =getLayout();

if (layout != null)

{

intoffsetForPosition = getOffsetForPosition(posX, posY);

intline = layout.getLineForOffset(offsetForPosition);

floatmaxX = layout.getPrimaryHorizontal(layout.getLineEnd(line) - 1);

floatcurrentX = posX - getTotalPaddingLeft();

currentX = Math.max(0.0f, currentX);

currentX = Math.min(getWidth() - getTotalPaddingRight() - 1, currentX);

currentX += getScrollX();

Configuration config = getResources().getConfiguration();

/*if(config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL && currentX< maxX) {

isInChip = false;

} elseif (currentX > maxX && config.getLayoutDirection() !=View.LAYOUT_DIRECTION_RTL) {

isInChip = false;

}*/

//zyh add2016-08-25(z702/z703 bug 10654:Set the text direction)

if(Locale.getDefault().getLanguage().equals("ar")){

if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR &&currentX < maxX) {

isInChip = false;

} else if (currentX > maxX && config.getLayoutDirection() !=View.LAYOUT_DIRECTION_LTR) {

isInChip = false;

}

}else{

if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL &&currentX < maxX) {

isInChip = false;

} else if (currentX > maxX && config.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL){

isInChip = false;

}

}

}

return isInChip;

}

27.信息输入联系人号码的时候,匹配出未保存名称的联系人时+号显示在数字的左边

位置:frameworks/ex/chips/src/com/android/mtkex/chips/BaseRecipientAdapter.java

//addby chensenquan 20160825 for bug 10919

Configurationcon =getContext().getResources().getConfiguration();

Stringl = con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(displayName.charAt(0)=='+'){

displayName=BidiFormatter.getInstance().unicodeWrap(displayName,TextDirecti

onHeuristics.LTR);

}

displayNameView.setText(displayName);

}

//addend

28.阿拉伯语下,拨号盘内搜索号码,输入框内+号显示在数字的右边

位置:packages/apps/Dialer/src/com/android/dialer/DialtactsActivity.java

mSearchView= (EditText) searchEditTextLayout.findViewById(R.id.search_view);

mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener);

//addby chensenquan 20160825 for bug 10814

Configurationcon = resources.getConfiguration();

Stringl = con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

mSearchView.setTextDirection(View.TEXT_DIRECTION_LTR);

mSearchView.setGravity(Gravity.RIGHT);

}

//addend

29.搜索联系人,+86顺序显示错误

位置:packages/apps/Contacts/src/com/android/contacts/activities/ActionBarAdapter.java

mSearchView =(EditText) mSearchContainer.findViewById(R.id.search_view);

//add by chensenquan20160825 for bug 10814

Configuration con =mActivity.getResources().getConfiguration();

String l = con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

mSearchView.setTextDirection(View.TEXT_DIRECTION_LTR);

mSearchView.setGravity(Gravity.RIGHT);

}

//add end

mSearchView.setHint(mActivity.getString(R.string.hint_findContacts));

30.阿拉伯语,拨号盘匹配出未保存名字的联系人,+号显示在数字的左边。

位置:packages/apps/Dialer/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java

// empty name ?

if(!TextUtils.isEmpty(displayName)) {

// highlight name

String highlight =getNameHighlight(cursor);

if(!TextUtils.isEmpty(highlight)) {

SpannableStringBuilder style = highlightString(highlight, displayName);

//add bychensenquan 20160826

viewHolder.name.setText(setTextDirectionLTR(context,style.toString()));

if(isRegularSearch(cursor)) {

//add by chensenquan 20160825 for bug 10883

viewHolder.name.setText(setTextDirectionLTR(context,highlightName(highlight,displayName).toString()));

}

} else {

//add bychensenquan 20160810

viewHolder.name.setText(setTextDirectionLTR(context,displayName.toString()));

//add end

}

}

/**

* add by chensenquan20160825 for 10883

* @param context

* @param textName

* @return

*/

private StringsetTextDirectionLTR(Context context,String textName){

Configuration con =context.getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(textName.charAt(0)=='+'){

textName=mBidiFormatter.unicodeWrap(textName.toString(),TextDirectionHeuristics.LTR);

}

}

return textName;

}

31.阿拉伯语,联系人名字是号码,+号显示在数字的左边

位置:packages/apps/ContactsCommon/src/com/android/contacts/common/list/ContactListItemView.java

//add by chensenquan20160825 for bug10883

Configuration con =getContext().getResources().getConfiguration();

String l = con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(name.charAt(0)=='+'){

name=BidiFormatter.getInstance().unicodeWrap(name.toString(),TextDirectionH

euristics.LTR);

}

}

//add end

setMarqueeText(getNameTextView(),name);

32.短信设置内添加新常用语、修改常用语、保存常用语、插入常用语的时候+号显示在数字的右边。

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/MmsConfig.java

public static intupdateAllQuicktexts() {

Cursor cursor =mContext.getContentResolver().query(Telephony.MmsSms.CONTENT_URI_QUICKTEXT,

null, null, null, null);

allQuickTextIds.clear();

allQuickTexts.clear();

String[] defaultTexts= mContext.getResources().getStringArray(R.array.default_quick_texts);

int maxId =defaultTexts.length;

if (cursor != null) {

try {

while (cursor.moveToNext()) {

int qtId = cursor.getInt(0);

allQuickTextIds.add(qtId);

String qtText = cursor.getString(1);

if (qtText != null && !qtText.isEmpty()) {

allQuickTexts.add(setTextDirectionLTR(qtText));//add by chensenquan 20160825for bug 10911

} else {

allQuickTexts.add(setTextDirectionLTR(defaultTexts[qtId - 1]));//add bychensenquan 20160825 for bug 10911

}

if (qtId > maxId) {

maxId = qtId;

}

}

}finally {

cursor.close();

}

}

return maxId;

}

/**

* add by chensenquan20160825 for bug 10911

* @param textName

* @return

*/

private static StringsetTextDirectionLTR(String textName){

Configuration con=mContext.getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(textName.charAt(0)=='+'|| textName.charAt(textName.length()-1)=='+'){

textName=BidiFormatter.getInstance().unicodeWrap(

textName, TextDirectionHeuristics.LTR);

}

}

return textName;

}

位置: vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java

mSubjectTextEditor =(EditText)findViewById(R.id.subject);

//add by chensenquan20160825 for bug 10908

Configuration con=getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

mSubjectTextEditor.setTextDirection(View.TEXT_DIRECTION_LTR);

mSubjectTextEditor.setGravity(Gravity.RIGHT);

}

//add end

List<Map<String,?>> entries = new ArrayList<Map<String, ?>>();

for (String text :quickTextsList) {

HashMap<String, Object>entry = new HashMap<String, Object>();

//add by chensenquan20160825 for bug 10911

Configuration con=getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(text.charAt(0)=='+'|| text.charAt(text.length()-1)=='+'){

text=BidiFormatter.getInstance().unicodeWrap(

text, TextDirectionHeuristics.LTR);

}

}

//add end

entry.put("text",text);

entries.add(entry);

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/SmsTemplateEditActivity.java

mQuickTextId =MmsConfig.getQuicktextsId().get(Integer.valueOf((int) id));

mQuickText =MmsConfig.getQuicktexts().get(Integer.valueOf((int) id));

//add by chensenquan20160825 for bug 10911

Configuration con=getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(mQuickText.charAt(0)=='+'|| mQuickText.charAt(mQuickText.length()-1)=='+'){

mQuickText=BidiFormatter.getInstance().unicodeWrap(

mQuickText, TextDirectionHeuristics.LTR);

}

}

//add end

showEditDialog();

mNewQuickText =(EditText) findViewById(R.id.new_quick_text);

//add by chensenquan20160825 for bug 10911

Configuration con=getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

mNewQuickText.setTextDirection(View.TEXT_DIRECTION_LTR);

mNewQuickText.setGravity(Gravity.RIGHT);

}

//add end

mNewQuickText.setHint(R.string.type_to_quick_text);

adapter.notifyDataSetChanged();

//add by chensenquan20160825 for bug 10911

Configuration con=getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

if(currentText.charAt(0)=='+'|| currentText.charAt(currentText.length()-1)=='+'){

currentText=BidiFormatter.getInstance().unicodeWrap(

currentText, TextDirectionHeuristics.LTR);

}

}

//add end

makeAToast(getString(R.string.add_quick_text_successful)+ " : \n" + currentText);

private voidshowEditDialog(String quickText) {

AlertDialog.Builderdialog = new AlertDialog.Builder(SmsTemplateEditActivity.this);

mOldQuickText = newEditText(dialog.getContext());

//add by chensenquan20160825 for bug 10911

Configuration con=getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

mOldQuickText.setTextDirection(View.TEXT_DIRECTION_LTR);

mOldQuickText.setGravity(Gravity.RIGHT);

}

//add end

mOldQuickText.setHint(R.string.type_to_quick_text);

.show();

}

33.系统语言切换为阿拉伯语后,WiFi密码输入框的光标应该显示在右边

位置:packages/apps/Settings/src/com/android/settings/wifi/WifiConfigController.java

///M: modify to solveCR:ALPS01837742 @{

if (mPasswordView ==null) {

mPasswordView =(TextView) mView.findViewById(R.id.password);

mPasswordView.addTextChangedListener(this);

setTextLTRLanguage();//addby chensenquan 20160825 for bug 10768

((CheckBox)mView.findViewById(R.id.show_password))

.setOnCheckedChangeListener(this);

}

if (mPasswordView ==null) {

mPasswordView = (TextView) mView.findViewById(R.id.password);

mPasswordView.addTextChangedListener(this);

setTextLTRLanguage();//add by chensenquan 20160825 for bug 10768

((CheckBox) mView.findViewById(R.id.show_password))

.setOnCheckedChangeListener(this);

if(mAccessPoint != null && mAccessPoint.isSaved()) {

mPasswordView.setHint(R.string.wifi_unchanged);

}

}

/**

* add by chensenquan20160825 for bug 10768

*/

private voidsetTextLTRLanguage(){

Configuration con=mContext.getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

mPasswordView.setTextDirection(View.TEXT_DIRECTION_LTR);

mPasswordView.setGravity(Gravity.RIGHT);

}

}

34.进入设置查看sim cards,账号显示,然后点击此账号查看,号码显示中+在左侧

位置:packages/apps/Settings/src/com/android/settings/sim/SimDialogActivity.java

//add by chensenquan20160825 for bug 10930

Configuration con=mContext.getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

holder.summary.setTextDirection(View.TEXT_DIRECTION_LTR);

holder.summary.setGravity(Gravity.RIGHT);

}

//add end

finalSubscriptionInfo sir = mSubInfoList.get(position);

位置:packages/apps/Settings/src/com/android/settings/sim/SimPreferenceDialog.java

numberView.setText(PhoneNumberUtils.formatNumber(rawNumber));

//add by chensenquan20160825 for bug 10930

Configuration con=mContext.getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

numberView.setTextDirection(View.TEXT_DIRECTION_LTR);

numberView.setGravity(Gravity.RIGHT);

}

//add end

}

String simCarrierName= tm.getSimOperatorNameForSubscription(mSubInfoRecord.getSubscriptionId());

35.阿拉伯语下,设置中SIM卡信息MDN号码+86显示错误

位置:packages/apps/Settings/src/com/android/settings/deviceinfo/SimStatus.java

formattedNumber =PhoneNumberUtils.formatNumber(rawNumber);

//add by chensenquan20160827 for bug10951

Configuration con =getResources().getConfiguration();

String l =con.locale.getLanguage();

if(l.equals("ar")||l.equals("fa")||l.equals("iw")){//RTLlanguage

formattedNumber=BidiFormatter.getInstance().unicodeWrap(

formattedNumber.toString(),TextDirectionHeuristics.LTR);

}

//add end

36.当联系人名字为号码时,信息内插入联系人+号显示在右边

位置:vendor/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/mms/ui/VCardAttachment.java

if (mName != null&& !mName.equals("")) {

//add by chensenquan20160827 for bug 10896

if(Locale.getDefault().getLanguage().equals("ar")){

if(mName.charAt(0)=='+'){

mName =BidiFormatter.getInstance().unicodeWrap(mName,TextDirectionHeuristi cs.LTR);

}

}

//add end

textVCardString +=mContext.getString(R.string.contact_name) + ": " + mName +"\n";

}

}

37.搜索联系人ContentDescription+号显示在右边

位置:packages/apps/ContactsCommon/src/com/android/contacts/common/list/ContactListItemView.java

/**

* Adds or updates atext view for the search snippet.

*/

public voidsetSnippet(String text) {

if(TextUtils.isEmpty(text)) {

if(mSnippetView != null) {

mSnippetView.setVisibility(View.GONE);

}

} else {

//add by chensenquan20160828

text=setTextDirectionLTR(text);

//add end

mTextHighlighter.setPrefixText(getSnippetView(), text, mHighlightedPrefix);

mSnippetView.setVisibility(VISIBLE);

if(ContactDisplayUtils.isPossiblePhoneNumber(text)) {

// Give the text-to-speech engine a hint that it's a phone number

mSnippetView.setContentDescription(PhoneNumberUtils.createTtsSpannable(text));

} else{

mSnippetView.setContentDescription(null);

}

}

}

android 切换到阿拉伯语电话号码+号显示在右侧及顺序错乱的处理相关推荐

  1. android 时间 翻译 阿拉伯语,Re audit due date - 英语 - 阿拉伯语 翻译和实例

    英语 Re-audit due date 阿拉伯语 تاريخ إجراء إعادة المراجعة 最后更新: 2012-04-02 使用频率: 3 质量: 英语 Re-audit requir ...

  2. linux分区始柱号,找到了linux分区顺序错乱修复方法

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 我之前安装ARCH时 因为自带的CFDISK工具太烂 使用了主流的FDISK和PARTED 都远远不如DISKPART满意 功能弱不说 最重要的就是莫名奇 ...

  3. Android 系统(226)---Android 阿拉伯语适配

    Android 阿拉伯语适配 RTL 语言由来 RTL 是 Right-to-left(从右向左) 的缩写.其意为人们书写阅读习惯是从右向左,朝左继续的,常见的 RTL 语言有阿拉伯语,希伯来语等. ...

  4. Android阿拉伯语混排

    文章目录 1.Android阿拉伯语混排显示关键类 BidiFormatter 1.示例一 测试一 测试二 测试三 测试三 测试四 测试五 2. 示例二 3. 示例三 4. 示例四 2.关于实现上面功 ...

  5. Android 阿拉伯语适配

    首先推荐一个链接:https://www.jianshu.com/p/d8cd294a5c31 开始进入正题 1.sdk要求: Android 4.2 即 SDK 17 2.四个重要属性: andro ...

  6. 排列显示阿拉伯语、数字及英文时的处理方法

    这段时间参与开发沙特阿拉伯的网站模板,模板使用的语言是阿拉伯语,其显示顺序为从右到左,而中文.数字及英文的显示顺序为从左到右 ,所以当遇到一行文字内既有阿拉伯语又有数字和英文时会出现语序混乱的问题,如 ...

  7. RTL适配-阿拉伯语

    背景 公司项目需支持多种语言,其中包含阿拉伯语,而阿拉伯语适配是一个比较麻烦的事情,不止在于它的文案的适配,更多的是在于其语言习惯的变化.可以使用手机切换为阿拉伯语,看到手机界面整个都反向显示了,由从 ...

  8. php阿拉伯语字符串,按字母顺序命名阿拉伯语名称Mysql和php

    我试图用阿拉伯语对 alphabetical order 中的结果进行排序,但出于某种原因 not sorting correctly .. $ d1 = mysqli_query($ connect ...

  9. Android 系统(225)---Android 7.0切换阿拉伯语,QuickSetting界面图标左右翻转

    Android 7.0切换阿拉伯语,QuickSetting界面图标左右翻转. 切换手机语言为阿拉伯语,下拉状态栏到Quicksetting界面,快捷图标左右翻转.如下图 如果不想要这个左右翻转效果, ...

最新文章

  1. Spring bean 装配
  2. Phalanger---PHP的.NET编译器
  3. js 实现2的n次方计算函数_JS中数据结构与算法---排序算法
  4. Mac idea使用Command + p 快捷键查看一个类的构造函数需要传入什么参数
  5. angularjs获取上一个元素的id_DOM(1)-DOM概念和获取元素
  6. 有限差分法解NS方程原理
  7. dcs world f15c教学_高端DCS带电清洗用的什么清洗剂
  8. wx.getStorage异步和wx.getStorageSync同步区别
  9. 华为AC6605二层组网,配置无线漫游
  10. 工作效率的提升——如何高效沟通,有效降低沟通成本
  11. html 下划线居中,Word里下划线上内容怎么在下划线范围内居中?
  12. 单例模式如何确保线程安全
  13. 服务器系统 与win7系统,服务器系统win7
  14. HP-EVA4400故障导致的oracle数据库丢失的恢复过程
  15. 完美高仿精仿京东商城手机客户端android版源码
  16. 法线变换详解 和 3D 变换中法向量变换矩阵的推导
  17. 三、在eclipse项目中添加Junit4
  18. 塑壳断路器用考虑启动电流么_塑壳断路器和微型断路器的区别
  19. html5设计制作作品,16个精美的 HTML5 作品集网站设计案例
  20. 有线耳机和无线耳机的利弊

热门文章

  1. RSocket协议初识(一)
  2. 域安全|非约束委派攻击 Exchange 2013的安装
  3. HEU_KMS_Activator_v11.1.0
  4. Cisco IOS XRv 9000 Router Release 7.5.1 ED 下载
  5. Altium Designer(AD)多边形铺铜
  6. 该如何才能更快且有效的学习?
  7. 清华大学计算机与科学系张荷花简历,张敏(清华大学计算机科学与技术系副教授)_百度百科...
  8. 广发银行信用卡分期你真的懂?一文带你了解什么是广发分期
  9. 科达中心服务器,科达KEDACOM多媒体视频会议服务器VRS4100详细信息_产品参数_价格_联系方式_DAV数字音视工程网...
  10. ACM各种输入模式总结(C++)