summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorSanket Padawe <sanketpadawe@google.com>2014-10-28 22:48:33 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-28 22:48:33 +0000
commit917aaf9ebd2893b9d0cebc2b08c4f7d814fa53c7 (patch)
treec569e54a1d3b593f549de827d3577b1cde119c10 /src/com
parent93c10334c8380b997554a02f6071b3bc620e7705 (diff)
parentabc505aac3b830a551284f0326bba987abfb2395 (diff)
downloadpackages_apps_Settings-917aaf9ebd2893b9d0cebc2b08c4f7d814fa53c7.tar.gz
packages_apps_Settings-917aaf9ebd2893b9d0cebc2b08c4f7d814fa53c7.tar.bz2
packages_apps_Settings-917aaf9ebd2893b9d0cebc2b08c4f7d814fa53c7.zip
Merge "Add sim color selection in settings" into lmp-mr1-dev
Diffstat (limited to 'src/com')
-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();
}