summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/sim/SimSettings.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java
index 8a96ac7a6..edad591de 100644
--- a/src/com/android/settings/sim/SimSettings.java
+++ b/src/com/android/settings/sim/SimSettings.java
@@ -16,6 +16,7 @@
package com.android.settings.sim;
+import android.graphics.Color;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
@@ -463,6 +464,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
private class SimPreference extends Preference{
private SubInfoRecord mSubInfoRecord;
private int mSlotId;
+ private int[] colorArr;
public SimPreference(Context context, SubInfoRecord subInfoRecord, int slotId) {
super(context);
@@ -471,6 +473,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
mSlotId = slotId;
setKey("sim" + mSlotId);
update();
+ colorArr = context.getResources().getIntArray(R.array.sim_colors);
}
public void update() {
@@ -530,6 +533,31 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
EditText nameText = (EditText)dialogLayout.findViewById(R.id.sim_name);
nameText.setText(mSubInfoRecord.displayName);
+ final Spinner colorSpinner = (Spinner) dialogLayout.findViewById(R.id.spinner);
+ ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(),
+ R.array.color_picker, android.R.layout.simple_spinner_item);
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ colorSpinner.setAdapter(adapter);
+
+ for (int i = 0; i < colorArr.length; i++) {
+ if (colorArr[i] == mSubInfoRecord.color) {
+ colorSpinner.setSelection(i);
+ break;
+ }
+ }
+
+ colorSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view,
+ int pos, long id){
+ colorSpinner.setSelection(pos);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+ }
+ });
+
TextView numberView = (TextView)dialogLayout.findViewById(R.id.number);
numberView.setText(simPref.getFormattedPhoneNumber());
@@ -547,10 +575,14 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
mSubInfoRecord.displayName = nameText.getText().toString();
SubscriptionManager.setDisplayName(mSubInfoRecord.displayName,
mSubInfoRecord.subId);
-
findRecordBySubId(mSubInfoRecord.subId).displayName =
nameText.getText().toString();
+ final int colorSelected = colorSpinner.getSelectedItemPosition();
+ mSubInfoRecord.color = colorArr[colorSelected];
+ SubscriptionManager.setColor(colorArr[colorSelected], mSubInfoRecord.subId);
+ findRecordBySubId(mSubInfoRecord.subId).color = colorArr[colorSelected];
+
updateAllOptions();
update();
}