Add custom subtype settings

Bug: 4460018
Change-Id: I4919d79516dcf574be2761bbaf9adcdc381b2ddc
diff --git a/java/res/layout/additional_subtype_dialog.xml b/java/res/layout/additional_subtype_dialog.xml
new file mode 100644
index 0000000..f97c006
--- /dev/null
+++ b/java/res/layout/additional_subtype_dialog.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:columnCount="2"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_marginLeft="8dip"
+    android:layout_marginRight="8dip"
+    android:padding="8dip">
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="left|center_vertical"
+        style="?android:attr/textAppearanceSmall"
+        android:text="@string/subtype_locale" />
+    <Spinner
+        android:id="@+id/subtype_locale_spinner"
+        android:layout_width="wrap_content"
+        android:layout_marginLeft="8dip"
+        android:layout_marginBottom="8dip"
+        android:layout_marginTop="8dip"
+        android:layout_gravity="fill_horizontal|center_vertical"
+        android:prompt="@string/subtype_locale" />
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="left|center_vertical"
+        style="?android:attr/textAppearanceSmall"
+        android:text="@string/keyboard_layout_set" />
+    <Spinner
+        android:id="@+id/keyboard_layout_set_spinner"
+        android:layout_width="wrap_content"
+        android:layout_marginLeft="8dip"
+        android:layout_marginBottom="8dip"
+        android:layout_marginTop="8dip"
+        android:layout_gravity="fill_horizontal|center_vertical"
+        android:prompt="@string/keyboard_layout_set" />
+</GridLayout>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 28acd0f..93bd268 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -252,9 +252,26 @@
     <string name="subtype_en_GB">English (UK)</string>
     <!-- Description for English (United States) keyboard subtype [CHAR LIMIT=22] -->
     <string name="subtype_en_US">English (US)</string>
+    <!-- Description for language agnostic keyboard subtype [CHAR LIMIT=22] -->
+    <string name="subtype_no_language">No language</string>
     <!-- Description for language agnostic QWERTY keyboard subtype [CHAR LIMIT=22] -->
     <string name="subtype_no_language_qwerty">No language (QWERTY)</string>
 
+    <!-- Title of the preference settings for custom input styles (language and keyboard layout pairs) [CHAR LIMIT=22]-->
+    <string name="custom_input_styles_title">Custom input styles</string>
+    <!-- Title of the option menu to add a new style entry in the preference settings [CHAR_LIMIT=12] -->
+    <string name="add_style">Add style</string>
+    <!-- Title of the button to add custom style entry in the settings dialog [CHAR_LIMIT=12]  -->
+    <string name="add">Add</string>
+    <!-- Title of the button to remove a custom style entry in the settings dialog [CHAR_LIMIT=12]  -->
+    <string name="remove">Remove</string>
+    <!-- Title of the button to save a custom style entry in the settings dialog [CHAR_LIMIT=12]  -->
+    <string name="save">Save</string>
+    <!-- Title of the spinner for choosing a language of custom style in the settings dialog [CHAR_LIMIT=12]  -->
+    <string name="subtype_locale">Language</string>
+    <!-- Title of the spinner for choosing a keyboard layout of custom style in the settings dialog [CHAR_LIMIT=12]  -->
+    <string name="keyboard_layout_set">Layout</string>
+
     <!-- Title of an option for usability study mode -->
     <string name="prefs_usability_study_mode">Usability study mode</string>
     <!-- Title of the settings for keypress vibration duration -->
diff --git a/java/res/xml/additional_subtype_settings.xml b/java/res/xml/additional_subtype_settings.xml
new file mode 100644
index 0000000..ad280c1
--- /dev/null
+++ b/java/res/xml/additional_subtype_settings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+    <!-- Items will be added at runtime -->
+</PreferenceScreen>
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index ab5d44b..3598a68 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -100,6 +100,10 @@
                 android:summary="@string/include_other_imes_in_language_switch_list_summary"
                 android:persistent="true"
                 android:defaultValue="false" />
+            <PreferenceScreen
+                android:fragment="com.android.inputmethod.latin.AdditionalSubtypeSettings"
+                android:key="custom_input_styles"
+                android:title="@string/custom_input_styles_title" />
             <!-- Values for popup dismiss delay are added programatically -->
             <ListPreference
                 android:key="pref_key_preview_popup_dismiss_delay"