diff options
Diffstat (limited to 'src/com/android/contacts/common/MoreContactUtils.java')
-rw-r--r-- | src/com/android/contacts/common/MoreContactUtils.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/com/android/contacts/common/MoreContactUtils.java b/src/com/android/contacts/common/MoreContactUtils.java index e0cd9cf8..9d7965f0 100644 --- a/src/com/android/contacts/common/MoreContactUtils.java +++ b/src/com/android/contacts/common/MoreContactUtils.java @@ -90,8 +90,16 @@ public class MoreContactUtils { public static final String[] MULTI_SIM_NAME = { "perferred_name_sub1", "perferred_name_sub2" }; + public static final String PREFERRED_SIM_ICON_INDEX = "preferred_sim_icon_index"; public static final String[] IPCALL_PREFIX = { "ipcall_prefix1", "ipcall_prefix2" }; + public final static int[] IC_SIM_PICTURE = { + R.drawable.ic_contact_picture_sim_1, + R.drawable.ic_contact_picture_sim_2, + R.drawable.ic_contact_picture_sim_personal, + R.drawable.ic_contact_picture_sim_business, + R.drawable.ic_contact_picture_sim_primary + }; /** * Returns true if two data with mimetypes which represent values in contact entries are * considered equal for collapsing in the GUI. For caller-id, use @@ -730,6 +738,29 @@ public class MoreContactUtils { } /** + * Get SIM card icon index by subscription + */ + public static int getCurrentSimIconIndex(Context context, int subscription) { + if (context == null || subscription < PhoneConstants.SUB1 + || subscription >= TelephonyManager.getDefault().getPhoneCount()) { + return -1; + } + + String simIconIndex = Settings.System.getString(context.getContentResolver(), + PREFERRED_SIM_ICON_INDEX); + if (TextUtils.isEmpty(simIconIndex)) { + return subscription; + } else { + String[] indexs = simIconIndex.split(","); + if (subscription >= indexs.length) { + return -1; + } + return Integer.parseInt(indexs[subscription]); + } + } + + + /** * Display IP call setting dialog */ public static void showNoIPNumberDialog(final Context mContext, final int subscription) { |