SetupWizard: handle skipping id in SubInfoRecords

This extends I3b4132afccc96a5d08986a3cb902bd384931f21f to actually
work.

Change-Id: I9183626b40edda6a96888dca2816ff116b64bc5e
This commit is contained in:
Pawit Pornkitprasan 2015-04-18 11:48:46 +07:00 committed by cretin45
parent dd500a1f42
commit cfc4a0db64

View File

@ -138,13 +138,14 @@ public class ChooseDataSimPage extends SetupPage {
for (int i = 0; i < simCount; i++) { for (int i = 0; i < simCount; i++) {
View simRow = inflater.inflate(R.layout.data_sim_row, null); View simRow = inflater.inflate(R.layout.data_sim_row, null);
mPageView.addView(simRow); mPageView.addView(simRow);
SubscriptionInfo subInfoRecord = mSubInfoRecords.get(i); SubscriptionInfo subInfoRecord = mSubInfoRecords.valueAt(i);
simRow.setTag(subInfoRecord); simRow.setTag(subInfoRecord);
simRow.setOnClickListener(mSetDataSimClickListener); simRow.setOnClickListener(mSetDataSimClickListener);
mNameViews.put(i, (TextView) simRow.findViewById(R.id.sim_title)); int slot = subInfoRecord.getSimSlotIndex();
mSignalViews.put(i, (ImageView) simRow.findViewById(R.id.signal)); mNameViews.put(slot, (TextView) simRow.findViewById(R.id.sim_title));
mCheckBoxes.put(i, (CheckBox) simRow.findViewById(R.id.enable_check)); mSignalViews.put(slot, (ImageView) simRow.findViewById(R.id.signal));
mPhoneStateListeners.put(i, createPhoneStateListener(subInfoRecord)); mCheckBoxes.put(slot, (CheckBox) simRow.findViewById(R.id.enable_check));
mPhoneStateListeners.put(slot, createPhoneStateListener(subInfoRecord));
mPageView.addView(inflater.inflate(R.layout.divider, null)); mPageView.addView(inflater.inflate(R.layout.divider, null));
} }
updateSignalStrengths(); updateSignalStrengths();
@ -228,7 +229,7 @@ public class ChooseDataSimPage extends SetupPage {
private void updateSignalStrengths() { private void updateSignalStrengths() {
if (mIsAttached) { if (mIsAttached) {
for (int i = 0; i < mSubInfoRecords.size(); i++) { for (int i = 0; i < mSubInfoRecords.size(); i++) {
updateSignalStrength(mSubInfoRecords.get(i)); updateSignalStrength(mSubInfoRecords.valueAt(i));
} }
} }
} }
@ -252,7 +253,7 @@ public class ChooseDataSimPage extends SetupPage {
private void updateCurrentDataSub() { private void updateCurrentDataSub() {
if (mIsAttached) { if (mIsAttached) {
for (int i = 0; i < mSubInfoRecords.size(); i++) { for (int i = 0; i < mSubInfoRecords.size(); i++) {
SubscriptionInfo subInfoRecord = mSubInfoRecords.get(i); SubscriptionInfo subInfoRecord = mSubInfoRecords.valueAt(i);
mCheckBoxes.get(i).setChecked(mSubscriptionManager.getDefaultDataPhoneId() mCheckBoxes.get(i).setChecked(mSubscriptionManager.getDefaultDataPhoneId()
== subInfoRecord.getSimSlotIndex()); == subInfoRecord.getSimSlotIndex());
} }