summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--res/layout/multi_sim_dialog.xml22
-rw-r--r--res/values/arrays.xml34
-rw-r--r--res/values/colors.xml14
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/com/android/settings/sim/SimSettings.java34
5 files changed, 83 insertions, 23 deletions
diff --git a/res/layout/multi_sim_dialog.xml b/res/layout/multi_sim_dialog.xml
index 4f9dd6c53..c373edde1 100644
--- a/res/layout/multi_sim_dialog.xml
+++ b/res/layout/multi_sim_dialog.xml
@@ -50,6 +50,28 @@
</LinearLayout>
<LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/sim_dialog_margin_top"
+ android:paddingStart="@dimen/sim_label_padding"
+ android:text="@string/color_title"
+ style="?android:attr/textAppearanceMedium" />
+
+ <Spinner
+ android:id="@+id/spinner"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/sim_dialog_margin_top"
+ android:paddingStart="@dimen/sim_label_padding" />
+
+ </LinearLayout>
+
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 580143e12..e613617d6 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -1260,21 +1260,23 @@
<item>Cached (empty)</item>
</string-array>
- <!-- Multi-SIM titles for captioning color preference. -->
- <string-array name="sim_info_picker_color_titles" translatable="false" >
- <item>@string/color_blue</item>
- <item>@string/color_green</item>
- <item>@string/color_purple</item>
- <item>@string/color_red</item>
- <item>@string/color_orange</item>
+ <!-- Array storing rgb values of sim colors for multi-sim -->
+ <array name="sim_colors">
+ <item>@color/Teal_700</item>
+ <item>@color/Blue_700</item>
+ <item>@color/Indigo_700</item>
+ <item>@color/Purple_700</item>
+ <item>@color/Pink_700</item>
+ <item>@color/Red_700</item>
+ </array>
+
+ <!-- Array of titles for sim color for multi-sim -->
+ <string-array name="color_picker">
+ <item>Teal</item>
+ <item>Blue</item>
+ <item>Indigo</item>
+ <item>Purple</item>
+ <item>Pink</item>
+ <item>Red</item>
</string-array>
-
- <!-- Multi-SIM colors. -->
- <integer-array name="sim_info_picker_color_values" translatable="false" >
- <item>@color/blue_500</item>
- <item>@color/green_500</item>
- <item>@color/purple_500</item>
- <item>@color/red_500</item>
- <item>@color/orange_500</item>
- </integer-array>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index da54c3ebd..5ccae84fd 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -75,11 +75,13 @@
<color name="wifi_divider">#ffe0e0e0</color>
- <!-- Multi-SIM colors -->
- <color name="blue_500">#5677fc</color>
- <color name="green_500">#259b24</color>
- <color name="purple_500">#9c27b0</color>
- <color name="red_500">#e51c23</color>
- <color name="orange_500">#ff9800</color>
+ <!-- Multi-SIM colors Todo: To check whether to append 00 or FF before color values-->
+ <color name="Teal_700">#0000796b</color>
+ <color name="Blue_700">#003367d6</color>
+ <color name="Indigo_700">#00303f9f</color>
+ <color name="Purple_700">#007b1fa2</color>
+ <color name="Pink_700">#00c2185b</color>
+ <color name="Red_700">#00c53929</color>
+
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f6c8b761b..f8721c395 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3631,6 +3631,8 @@
<!-- Label for the default device locale. [CHAR LIMIT=35] -->
<string name="locale_default">Default</string>
+ <!-- Label for color selection title in sim settings [CHAR LIMIT=35] -->
+ <string name = "color_title">Color</string>
<!-- Label for default color. This lets the app pick the color. [CHAR LIMIT=35] -->
<string name="color_unspecified">Default</string>
<!-- Label for no color (transparent). [CHAR LIMIT=35] -->
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();
}