diff --git a/res/layout/multi_sim_dialog.xml b/res/layout/multi_sim_dialog.xml index 4f9dd6c53d5..c373edde113 100644 --- a/res/layout/multi_sim_dialog.xml +++ b/res/layout/multi_sim_dialog.xml @@ -49,6 +49,28 @@ + + + + + + + + Cached (empty) - - - @string/color_blue - @string/color_green - @string/color_purple - @string/color_red - @string/color_orange - + + + @color/Teal_700 + @color/Blue_700 + @color/Indigo_700 + @color/Purple_700 + @color/Pink_700 + @color/Red_700 + - - - @color/blue_500 - @color/green_500 - @color/purple_500 - @color/red_500 - @color/orange_500 - + + + Teal + Blue + Indigo + Purple + Pink + Red + diff --git a/res/values/colors.xml b/res/values/colors.xml index da54c3ebd64..5ccae84fdc6 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -75,11 +75,13 @@ #ffe0e0e0 - - #5677fc - #259b24 - #9c27b0 - #e51c23 - #ff9800 + + #0000796b + #003367d6 + #00303f9f + #007b1fa2 + #00c2185b + #00c53929 + diff --git a/res/values/strings.xml b/res/values/strings.xml index f6c8b761bbd..f8721c395f2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3631,6 +3631,8 @@ Default + + Color Default diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java index 8a96ac7a6d8..edad591de24 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 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(); }