1. 程式人生 > >Android 在聯絡人相應介面顯示運營商名稱

Android 在聯絡人相應介面顯示運營商名稱

  1. 在“要顯示的聯絡人”介面顯示運營商名稱
    在這裡插入圖片描述
修改方法:ContactsCommon/src/com/android/contacts/common/list/ContactListFilterView.java

            case ContactListFilter.FILTER_TYPE_ACCOUNT: {
-                mAccountUserName.setVisibility(View.VISIBLE);
+                mAccountUserName.setVisibility(View.GONE);
                 mIcon.setVisibility(View.VISIBLE);
                 if (mFilter.icon != null) {
                     mIcon.setImageDrawable(mFilter.icon);
@@ -141,7 +141,7 @@ public class ContactListFilterView extends LinearLayout {
                 /// M: Add SIM Indicator feature for Android M. @{
                 if (SubInfoUtils.getActivatedSubInfoCount() == 1 &&
                         accountType.isIccCardAccount()) {
-                    mAccountType.setVisibility(View.GONE);
+                    mAccountType.setVisibility(View.VISIBLE);
                     mAccountUserName.setTextAppearance(mContext,
                             android.R.attr.textAppearanceMedium);
                     mAccountUserName.setTextSize(18);


  1. 在“匯入/匯出聯絡人”介面顯示運營商名稱
    在這裡插入圖片描述
修改方法:Contacts/src/com/mediatek/contacts/activities/ContactImportExportActivity.java

            if (accountType != null && accountType.isIccCardAccount()) {
                 icon = accountType.getDisplayIconBySubId(mContext, subId);
-                type = (String) accountType.getDisplayLabel(mContext);
+                               //DUT should show operator name instead of SIM in Import/Export
+                //type = (String) accountType.getDisplayLabel(mContext);
             } else if (accountType != null) {
                 icon = accountType.getDisplayIcon(mContext);
             }


3.在“儲存聯絡人到”介面顯示運營商名稱
在這裡插入圖片描述

修改方法:ContactsCommon/src/com/mediatek/contacts/util/AccountsListAdapterUtils.java

         if (isLocalPhone || activtedSubInfoCount <= 1) {
-            text2.setVisibility(View.GONE);
+            text2.setVisibility(View.VISIBLE);
         } else {
             text2.setVisibility(View.VISIBLE);
         }


4.在“新增聯絡人”介面顯示運營商名稱。
在這裡插入圖片描述在這裡插入圖片描述

修改方法:Contacts/src/com/android/contacts/editor/CompactRawContactsEditorView.java

第一地方修改:

        vlog("activatedSubInfoCount = " + activatedSubInfoCount
                 + ",accountType = " + accountType.accountType);
         if (AccountTypeUtils.isAccountTypeIccCard(accountType.accountType)) {
-            if(activatedSubInfoCount <= 1){
+            /*if(activatedSubInfoCount <= 1){
             mAccountNameView.setVisibility(View.GONE);
-        } else {
+        } else {*/
             if (accountInfo.first != null) {
                 int subId = AccountTypeUtils.getSubIdBySimAccountName(getContext(),
                         accountInfo.first);
                 String account_name = SubInfoUtils.getDisplaynameUsingSubId(subId);
                 mAccountNameView.setText(account_name);
             }
-        }
+        //}
         }
         /// @}

 

第二個地方修改:

             /// M: Modify for SIM indicator feature. @{
             if (AccountTypeUtils.isAccountTypeIccCard(type.accountType)) {
-                if(activatedSubInfoCount <= 1){
+                /*if(activatedSubInfoCount <= 1){
                     mAccountHeaderNameTextView.setVisibility(View.GONE);
-                } else {
+                } else {*/
                 if (accountInfo.first != null) {
                     int subId = AccountTypeUtils.getSubIdBySimAccountName(getContext(),
                             accountInfo.first);
                     String account_name = SubInfoUtils.getDisplaynameUsingSubId(subId);
                     mAccountHeaderNameTextView.setText(account_name);
                 }
-            }
+            //}
             }
           /// @}

         /// M: Modify for SIM indicator feature. @{
         if (AccountTypeUtils.isAccountTypeIccCard(type.accountType)) {
-            if(activatedSubInfoCount <= 1){
+            /*if(activatedSubInfoCount <= 1){
             mAccountSelectorNameTextView.setVisibility(View.GONE);
         } else {
                 mAccountSelectorNameTextView.setVisibility(
                         mAccountHeaderNameTextView.getVisibility());
-            }
+            }*/
+            mAccountSelectorNameTextView.setVisibility(
+                        mAccountHeaderNameTextView.getVisibility());
         }
         /// @}