DO NOT MERGE. Port "respond via SMS message" feature to new Telecomm. (2/4)

Bug: 15275904
Bug: 15196474
Change-Id: I3e2ee62b3e32ad5715457fee1b0e714f88ecea8e
diff --git a/res/menu/respond_via_message_settings_menu.xml b/res/menu/respond_via_message_settings_menu.xml
new file mode 100644
index 0000000..6f5e246
--- /dev/null
+++ b/res/menu/respond_via_message_settings_menu.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 Google Inc.
+
+     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.
+-->
+
+<!-- Menu for Respond-via-Message settings screen. -->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/respond_via_message_reset"
+          android:title="@string/respond_via_sms_menu_reset_default_activity" />
+</menu>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0c46053..747eca7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -49,4 +49,30 @@
     <!-- Content description of the speakerphone enabled notification icon for
          accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
     <string name="accessibility_speakerphone_enabled">Speakerphone enabled.</string>
+
+    <!-- Canned response for the "Respond via SMS" feature for incoming calls. [CHAR LIMIT=35] -->
+    <string name="respond_via_sms_canned_response_1">Can\'t talk now. What\'s up?</string>
+    <!-- Canned response for the "Respond via SMS" feature for incoming calls. [CHAR LIMIT=35] -->
+    <string name="respond_via_sms_canned_response_2">I\'ll call you right back.</string>
+    <!-- Canned response for the "Respond via SMS" feature for incoming calls. [CHAR LIMIT=35] -->
+    <string name="respond_via_sms_canned_response_3">I\'ll call you later.</string>
+    <!-- Canned response for the "Respond via SMS" feature for incoming calls. [CHAR LIMIT=35] -->
+    <string name="respond_via_sms_canned_response_4">Can\'t talk now. Call me later?</string>
+
+    <!-- Title of settings screen for managing the "Respond via SMS" feature. [CHAR LIMIT=30] -->
+    <string name="respond_via_sms_setting_title">Quick responses</string>
+    <!-- Slightly more verbose title of settings screen for managing the
+         "Respond via SMS" feature. [CHAR LIMIT=30] -->
+    <string name="respond_via_sms_setting_title_2">Edit quick responses</string>
+    <!-- Settings summary string for the "Respond via SMS" feature. [CHAR LIMIT=40] -->
+    <string name="respond_via_sms_setting_summary"></string>
+    <!-- Dialog title when changing a string for the "Respond via SMS" feature. [CHAR LIMIT=30] -->
+    <string name="respond_via_sms_edittext_dialog_title">Quick response</string>
+    <!-- Menu option in  "Respond via SMS" that allows user to reset the default
+         activity used to handle "Respond via SMS" [CHAR LIMIT=30] -->
+    <string name="respond_via_sms_menu_reset_default_activity">Reset default app</string>
+
+    <!-- "Respond via SMS": Confirmation message shown after sending
+        a text response. [CHAR LIMIT=40] -->
+    <string name="respond_via_sms_confirmation_format">Message sent to <xliff:g id="phone_number">%s</xliff:g>.</string>
 </resources>
diff --git a/res/xml/respond_via_sms_settings.xml b/res/xml/respond_via_sms_settings.xml
new file mode 100644
index 0000000..a8eb46c
--- /dev/null
+++ b/res/xml/respond_via_sms_settings.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+
+<!-- Settings screen that lets the user manage the canned responses
+     for the "Respond via SMS" feature; see RespondViaSmsManager.java -->
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+     android:title="@string/respond_via_sms_setting_title_2">
+
+    <!-- Ultra-simple implementation for now: just provide 4 fixed slots
+         with customizable strings. -->
+
+    <!-- TODO: Potential UI improvements:
+         (1) Allow editing the strings in place, rather than having to tap
+             each one and edit it via the popup dialog.
+         (2) Allow reordering the strings by drag-and-drop.
+         (3) Provide an "Add new string..." option? -->
+
+    <!-- The defaultValues here must agree with the values used with
+         prefs.getString() in RespondViaSmsManager.loadCannedResponses(). -->
+
+    <!-- Use MultiLineTitleEditTextPreference instead of the standard
+         EditTextPreference here, to allow the preference "title" to wrap
+         onto multiple lines if the customized messages are long enough. -->
+
+    <com.android.telecomm.MultiLineTitleEditTextPreference
+        android:key="canned_response_pref_1"
+        android:defaultValue="@string/respond_via_sms_canned_response_1"
+        android:dialogTitle="@string/respond_via_sms_edittext_dialog_title" />
+
+    <com.android.telecomm.MultiLineTitleEditTextPreference
+        android:key="canned_response_pref_2"
+        android:defaultValue="@string/respond_via_sms_canned_response_2"
+        android:dialogTitle="@string/respond_via_sms_edittext_dialog_title" />
+
+    <com.android.telecomm.MultiLineTitleEditTextPreference
+        android:key="canned_response_pref_3"
+        android:defaultValue="@string/respond_via_sms_canned_response_3"
+        android:dialogTitle="@string/respond_via_sms_edittext_dialog_title" />
+
+    <com.android.telecomm.MultiLineTitleEditTextPreference
+        android:key="canned_response_pref_4"
+        android:defaultValue="@string/respond_via_sms_canned_response_4"
+        android:dialogTitle="@string/respond_via_sms_edittext_dialog_title" />
+
+</PreferenceScreen>