OSDN Git Service

Changing sim selection dialog in Settings to use phoneAccount
authorSanket Padawe <sanketpadawe@google.com>
Wed, 19 Nov 2014 18:38:20 +0000 (10:38 -0800)
committerSanket Padawe <sanketpadawe@google.com>
Wed, 19 Nov 2014 18:45:27 +0000 (18:45 +0000)
Changing sim selection dialog in Settings UI to select Call to display icons using
 phoneAccount.

Bug: 18435598
Change-Id: Ib89344be123c77a56e04a65dbb9e297f05e204eb

src/com/android/settings/sim/SimSettings.java

index e2f56cb..682f722 100644 (file)
@@ -372,10 +372,25 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
 
             if (mDialogId == CALLS_PICK) {
                 holder.title.setText(getItem(position));
-                holder.summary.setText("");
-                holder.icon.setImageDrawable(getResources()
-                        .getDrawable(R.drawable.ic_live_help));
-                holder.icon.setAlpha(OPACITY);
+                if (position == 0) {
+                    holder.icon.setImageDrawable(getResources()
+                            .getDrawable(R.drawable.ic_live_help));
+                    holder.icon.setAlpha(OPACITY);
+                    holder.summary.setText("");
+                } else {
+                    final TelecomManager telecomManager = TelecomManager.from(getActivity());
+                    final Iterator<PhoneAccountHandle> phoneAccounts =
+                            telecomManager.getCallCapablePhoneAccounts().listIterator();
+                    while (phoneAccounts.hasNext()) {
+                        final PhoneAccount phoneAccount =
+                                telecomManager.getPhoneAccount(phoneAccounts.next());
+                        if (getItem(position).equals((String) phoneAccount.getLabel())) {
+                            holder.icon.setImageBitmap(phoneAccount.getIconBitmap());
+                            holder.summary
+                                    .setText(phoneAccount.getAddress().getSchemeSpecificPart());
+                        }
+                    }
+                }
             } else {
                 sir = mSelectableSubInfos.get(position);
                 holder.title.setText(sir.getDisplayName());