Fixed then icons of SIMs in the call dialog.

Bug: 18672758
Change-Id: I812e79a48b048f8449cc07fdcccab57a114cdd24
This commit is contained in:
PauloftheWest
2014-12-12 09:09:40 -08:00
parent 8a21ab00e5
commit a886d69f9d

View File

@@ -198,16 +198,26 @@ public class SimDialogActivity extends Activity {
} }
}; };
ArrayList<SubscriptionInfo> callsSubInfoList = new ArrayList<SubscriptionInfo>();
if (id == CALLS_PICK) { if (id == CALLS_PICK) {
final TelecomManager telecomManager = TelecomManager.from(context); final TelecomManager telecomManager = TelecomManager.from(context);
final Iterator<PhoneAccountHandle> phoneAccounts = final Iterator<PhoneAccountHandle> phoneAccounts =
telecomManager.getCallCapablePhoneAccounts().listIterator(); telecomManager.getCallCapablePhoneAccounts().listIterator();
list.add(getResources().getString(R.string.sim_calls_ask_first_prefs_title)); list.add(getResources().getString(R.string.sim_calls_ask_first_prefs_title));
callsSubInfoList.add(null);
while (phoneAccounts.hasNext()) { while (phoneAccounts.hasNext()) {
final PhoneAccount phoneAccount = final PhoneAccount phoneAccount =
telecomManager.getPhoneAccount(phoneAccounts.next()); telecomManager.getPhoneAccount(phoneAccounts.next());
list.add((String)phoneAccount.getLabel()); list.add((String)phoneAccount.getLabel());
if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) {
final String phoneAccountId = phoneAccount.getAccountHandle().getId();
final SubscriptionInfo sir = Utils.findRecordBySubId(context,
Integer.parseInt(phoneAccountId));
callsSubInfoList.add(sir);
} else {
callsSubInfoList.add(null);
}
} }
} else { } else {
for (int i = 0; i < selectableSubInfoLength; ++i) { for (int i = 0; i < selectableSubInfoLength; ++i) {
@@ -225,7 +235,7 @@ public class SimDialogActivity extends Activity {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
ListAdapter adapter = new SelectAccountListAdapter( ListAdapter adapter = new SelectAccountListAdapter(
subInfoList, id == CALLS_PICK ? callsSubInfoList : subInfoList,
builder.getContext(), builder.getContext(),
R.layout.select_account_list_item, R.layout.select_account_list_item,
arr, id); arr, id);
@@ -274,7 +284,6 @@ public class SimDialogActivity extends Activity {
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView; View rowView;
final ViewHolder holder; final ViewHolder holder;
SubscriptionInfo sir;
if (convertView == null) { if (convertView == null) {
// Cache views for faster scrolling // Cache views for faster scrolling
@@ -289,14 +298,14 @@ public class SimDialogActivity extends Activity {
holder = (ViewHolder) rowView.getTag(); holder = (ViewHolder) rowView.getTag();
} }
if (mDialogId == CALLS_PICK) { final SubscriptionInfo sir = mSubInfoList.get(position);
if (sir == null) {
holder.title.setText(getItem(position)); holder.title.setText(getItem(position));
holder.summary.setText(""); holder.summary.setText("");
holder.icon.setImageDrawable(getResources() holder.icon.setImageDrawable(getResources()
.getDrawable(R.drawable.ic_live_help)); .getDrawable(R.drawable.ic_live_help));
holder.icon.setAlpha(OPACITY); holder.icon.setAlpha(OPACITY);
} else { } else {
sir = mSubInfoList.get(position);
holder.title.setText(sir.getDisplayName()); holder.title.setText(sir.getDisplayName());
holder.summary.setText(sir.getNumber()); holder.summary.setText(sir.getNumber());
holder.icon.setImageBitmap(sir.createIconBitmap(mContext)); holder.icon.setImageBitmap(sir.createIconBitmap(mContext));