diff options
34 files changed, 894 insertions, 101 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index e50dacd..9e39c9f 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -28,6 +28,8 @@ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.WRITE_APN_SETTINGS"/> <uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES"/> + <uses-permission android:name="android.permission.READ_USER_DICTIONARY"/> + <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY"/> <application android:label="@string/settings_label" android:icon="@drawable/ic_launcher_settings"> @@ -150,6 +152,14 @@ </intent-filter> </activity> + <activity android:name="UserDictionarySettings" android:icon="@drawable/app_settings" + android:label="@string/user_dict_settings_titlebar"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.VOICE_LAUNCH" /> + </intent-filter> + </activity> + <activity android:name="SoundAndDisplaySettings" android:label="@string/sound_and_display_settings" android:theme="@android:style/Theme.NoTitleBar"> <intent-filter> diff --git a/res/drawable/ic_menu_add.png b/res/drawable/ic_menu_add.png Binary files differnew file mode 100755 index 0000000..6752bfd --- /dev/null +++ b/res/drawable/ic_menu_add.png diff --git a/res/layout/dialog_edittext.xml b/res/layout/dialog_edittext.xml new file mode 100644 index 0000000..9ef1205 --- /dev/null +++ b/res/layout/dialog_edittext.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2006 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. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingLeft="8dip" + android:paddingRight="8dip"> + + <EditText + android:id="@+id/edittext" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + /> + +</LinearLayout>
\ No newline at end of file diff --git a/res/layout/list_content_with_empty_view.xml b/res/layout/list_content_with_empty_view.xml new file mode 100644 index 0000000..324d23f --- /dev/null +++ b/res/layout/list_content_with_empty_view.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2008 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. +--> + + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:drawSelectorOnTop="false" + /> + + <TextView android:id="@+id/empty" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:padding="5dip" + android:gravity="center" + android:visibility="gone" /> + +</FrameLayout> diff --git a/res/values-cs/arrays.xml b/res/values-cs/arrays.xml index d7a2979..57254e1 100644 --- a/res/values-cs/arrays.xml +++ b/res/values-cs/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index f692b26..75d5443 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"Neznámé"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"Znak „.“ lze vložit dvěma stisky klávesy Mezerník."</string> <string name="show_password">"Zobrazování hesel"</string> <string name="show_password_summary">"Zadávané heslo je zobrazováno"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"Testování"</string> <string name="testing_phone_info">"Info o telefonu"</string> <string name="testing_battery_info">"Info o baterii"</string> diff --git a/res/values-de/arrays.xml b/res/values-de/arrays.xml index 8152f6e..85252eb 100644 --- a/res/values-de/arrays.xml +++ b/res/values-de/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 414e1ec..563924b 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"Unbekannt"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"Leertaste zweimal drücken, um \".\" hinzuzufügen"</string> <string name="show_password">"Sichtbare Passwörter"</string> <string name="show_password_summary">"Passwort bei der Eingabe anzeigen"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"Test"</string> <string name="testing_phone_info">"Telefoninformation"</string> <string name="testing_battery_info">"Akkuinformationen"</string> diff --git a/res/values-es/arrays.xml b/res/values-es/arrays.xml index 6bfcb22..2dfbae1 100644 --- a/res/values-es/arrays.xml +++ b/res/values-es/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 2507bbc..877a3c3 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"Desconocido"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"Pulse la tecla Espacio dos veces para insertar el carácter \".\"."</string> <string name="show_password">"Contraseñas visibles"</string> <string name="show_password_summary">"Mostrar contraseña mientras se escribe"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"Prueba"</string> <string name="testing_phone_info">"Información sobre el teléfono"</string> <string name="testing_battery_info">"Información sobre la batería"</string> diff --git a/res/values-fr/arrays.xml b/res/values-fr/arrays.xml index be70632..3ed4556 100644 --- a/res/values-fr/arrays.xml +++ b/res/values-fr/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 0d88d85..9178b7d 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"Inconnu"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"Appuyez deux fois sur la touche Espace pour insérer \".\""</string> <string name="show_password">"Mots de passe visibles"</string> <string name="show_password_summary">"Afficher le mot de passe lors de la saisie"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"Test"</string> <string name="testing_phone_info">"Informations sur le téléphone"</string> <string name="testing_battery_info">"Informations sur la batterie"</string> diff --git a/res/values-it/arrays.xml b/res/values-it/arrays.xml index 7d50af2..5f7e1ae 100644 --- a/res/values-it/arrays.xml +++ b/res/values-it/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 3d079ae..20d1e2c 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"Sconosciuto"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"Premi due volte la barra spaziatrice per inserire \".\""</string> <string name="show_password">"Password visibili"</string> <string name="show_password_summary">"Mostra la password durante la digitazione"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"Verifica in corso"</string> <string name="testing_phone_info">"Informazioni telefono"</string> <string name="testing_battery_info">"Informazioni batteria"</string> diff --git a/res/values-ja/arrays.xml b/res/values-ja/arrays.xml index 1cc08ca..018a972 100644 --- a/res/values-ja/arrays.xml +++ b/res/values-ja/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index bbc10a5..06accea 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"不明"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"Spaceキーを2回押して「。」を挿入"</string> <string name="show_password">"パスワードを表示"</string> <string name="show_password_summary">"入力中のパスワードを表示"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"テスト中"</string> <string name="testing_phone_info">"携帯電話情報"</string> <string name="testing_battery_info">"バッテリ情報"</string> diff --git a/res/values-nl/arrays.xml b/res/values-nl/arrays.xml index 94cbe3d..dadf564 100644 --- a/res/values-nl/arrays.xml +++ b/res/values-nl/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index 3266f59..9ed771f 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"Onbekend"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"Druk twee keer op de spatiebalk om \'.\' in te voegen"</string> <string name="show_password">"Zichtbare wachtwoorden"</string> <string name="show_password_summary">"Wachtwoord weergeven tijdens het typen"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"Testen"</string> <string name="testing_phone_info">"Telefooninformatie"</string> <string name="testing_battery_info">"Accu-informatie"</string> diff --git a/res/values-pl/arrays.xml b/res/values-pl/arrays.xml index e964079..eea35d9 100644 --- a/res/values-pl/arrays.xml +++ b/res/values-pl/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index b677423..1723c92 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"Nieznany"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"Naciśnij klawisz spacji dwukrotnie, aby wstawić „.”"</string> <string name="show_password">"Widoczne hasła"</string> <string name="show_password_summary">"Pokazuj hasło podczas wpisywania"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"Testowanie"</string> <string name="testing_phone_info">"Informacje o telefonie"</string> <string name="testing_battery_info">"Informacje o baterii"</string> diff --git a/res/values-ru/arrays.xml b/res/values-ru/arrays.xml index dff3e58..304802e 100644 --- a/res/values-ru/arrays.xml +++ b/res/values-ru/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 6c86c12..011519a 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"Неизвестно"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"Чтобы вставить символ \".\", дважды нажмите пробел."</string> <string name="show_password">"Показывать пароли"</string> <string name="show_password_summary">"Показывать пароль при вводе"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"Тестирование"</string> <string name="testing_phone_info">"Сведения о телефоне"</string> <string name="testing_battery_info">"Сведения о батарее"</string> diff --git a/res/values-zh-rCN/arrays.xml b/res/values-zh-rCN/arrays.xml index 3f40b45..6e15287 100644 --- a/res/values-zh-rCN/arrays.xml +++ b/res/values-zh-rCN/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 50dc8ba..56745bd 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"未知"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"按两次空格键来插入“。”"</string> <string name="show_password">"可见的密码"</string> <string name="show_password_summary">"键入时显示密码"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"测试"</string> <string name="testing_phone_info">"手机信息"</string> <string name="testing_battery_info">"电池信息"</string> diff --git a/res/values-zh-rTW/arrays.xml b/res/values-zh-rTW/arrays.xml index aaa7bfe..8c498b8 100644 --- a/res/values-zh-rTW/arrays.xml +++ b/res/values-zh-rTW/arrays.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="timezone_filters"> diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index 2e075b9..95d6c73 100644 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -1,4 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright (C) 2009 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. +--> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="device_info_default">"未知的"</string> @@ -632,6 +646,22 @@ <string name="auto_punctuate_summary">"按空白鍵兩次可插入「.」"</string> <string name="show_password">"密碼可見"</string> <string name="show_password_summary">"顯示輸入的密碼"</string> + <!-- no translation found for user_dict_settings_titlebar (765659257455000490) --> + <skip /> + <!-- no translation found for user_dict_settings_title (8357027437499042191) --> + <skip /> + <!-- no translation found for user_dict_settings_summary (2460427065601355471) --> + <skip /> + <!-- no translation found for user_dict_settings_add_menu_title (4056762757149923551) --> + <skip /> + <!-- no translation found for user_dict_settings_add_dialog_title (4702613990174126482) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_edit_title (2210564879320004837) --> + <skip /> + <!-- no translation found for user_dict_settings_context_menu_delete_title (9140703913776549054) --> + <skip /> + <!-- no translation found for user_dict_settings_empty_text (6209268025109242806) --> + <skip /> <string name="testing">"測試中"</string> <string name="testing_phone_info">"手機資訊"</string> <string name="testing_battery_info">"電池資訊"</string> diff --git a/res/values/strings.xml b/res/values/strings.xml index 8e50ced..7daa165 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1524,6 +1524,24 @@ found in the list of installed applications.</string> <string name="show_password">Visible passwords</string> <!-- On Security & location settings screen, setting check box summary. Summary for the visible passwords setting. --> <string name="show_password_summary">Show password as you type</string> + + <!-- User dictionary settings --><skip /> + <!-- User dictionary settings, The titlebar text of the User dictionary settings screen. --> + <string name="user_dict_settings_titlebar">User dictionary</string> + <!-- User dictionary settings, The title of the list item to go into the User dictionary settings screen. --> + <string name="user_dict_settings_title">User dictionary</string> + <!-- User dictionary settings. The summary of the listem item to go into the User dictionary settings screen. --> + <string name="user_dict_settings_summary">Add & remove words from user dictionary</string> + <!-- User dictionary settings. The title of the menu item to add a new word to the user dictionary. --> + <string name="user_dict_settings_add_menu_title">Add</string> + <!-- User dictionary settings. The title of the dialog to add a new word to the user dictionary. --> + <string name="user_dict_settings_add_dialog_title">Add to dictionary</string> + <!-- User dictionary settings. The title of the context menu item to edit the current word --> + <string name="user_dict_settings_context_menu_edit_title">Edit</string> + <!-- User dictionary settings. The title of the context menu item to delete the current word --> + <string name="user_dict_settings_context_menu_delete_title">Delete</string> + <!-- User dictionary settings. The text to show when there are no user-defined words in the dictionary --> + <string name="user_dict_settings_empty_text">You do not have any words in the user dictionary. You can add a word through the menu.</string> <!-- This is for diagnostics screen. The title of a screen with various items realted to launching screens that will giev the user info. For example, it contains "Phone information" and "Battery information" --> <string name="testing">Testing</string> diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml index 78b61aa..ff123ed 100644 --- a/res/xml/language_settings.xml +++ b/res/xml/language_settings.xml @@ -42,6 +42,13 @@ android:targetPackage="com.android.settings" android:targetClass="com.android.settings.InputMethodsSettings" /> </PreferenceScreen> + <PreferenceScreen + android:title="@string/user_dict_settings_title" + android:summary="@string/user_dict_settings_summary"> + <intent android:action="android.intent.action.MAIN" + android:targetPackage="com.android.settings" + android:targetClass="com.android.settings.UserDictionarySettings" /> + </PreferenceScreen> <CheckBoxPreference android:key="auto_replace" android:title="@string/auto_replace" diff --git a/src/com/android/settings/UserDictionarySettings.java b/src/com/android/settings/UserDictionarySettings.java new file mode 100644 index 0000000..5d3c8ac --- /dev/null +++ b/src/com/android/settings/UserDictionarySettings.java @@ -0,0 +1,242 @@ +/** + * Copyright (C) 2007 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. + */ + +package com.android.settings; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ListActivity; +import android.content.Context; +import android.content.DialogInterface; +import android.database.Cursor; +import android.os.Bundle; +import android.provider.UserDictionary; +import android.view.ContextMenu; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ContextMenu.ContextMenuInfo; +import android.widget.AlphabetIndexer; +import android.widget.EditText; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.SectionIndexer; +import android.widget.SimpleCursorAdapter; +import android.widget.TextView; +import android.widget.AdapterView.AdapterContextMenuInfo; + +import java.util.Locale; + +public class UserDictionarySettings extends ListActivity { + + private static final String INSTANCE_KEY_DIALOG_EDITING_WORD = "DIALOG_EDITING_WORD"; + + private static final String[] QUERY_PROJECTION = { + UserDictionary.Words._ID, UserDictionary.Words.WORD + }; + + // Either the locale is empty (means the word is applicable to all locales) + // or the word equals our current locale + private static final String QUERY_SELECTION = UserDictionary.Words.LOCALE + "=? OR " + + UserDictionary.Words.LOCALE + " is null"; + + private static final String DELETE_SELECTION = UserDictionary.Words.WORD + "=?"; + + private static final int CONTEXT_MENU_EDIT = Menu.FIRST; + private static final int CONTEXT_MENU_DELETE = Menu.FIRST + 1; + + private static final int OPTIONS_MENU_ADD = Menu.FIRST; + + private static final int DIALOG_ADD_OR_EDIT = 0; + + /** The word being edited in the dialog (null means the user is adding a word). */ + private String mDialogEditingWord; + + private Cursor mCursor; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.list_content_with_empty_view); + + mCursor = createCursor(); + setListAdapter(createAdapter()); + + TextView emptyView = (TextView) findViewById(R.id.empty); + emptyView.setText(R.string.user_dict_settings_empty_text); + + ListView listView = getListView(); + listView.setFastScrollEnabled(true); + listView.setEmptyView(emptyView); + + registerForContextMenu(listView); + } + + @Override + protected void onRestoreInstanceState(Bundle state) { + super.onRestoreInstanceState(state); + mDialogEditingWord = state.getString(INSTANCE_KEY_DIALOG_EDITING_WORD); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putString(INSTANCE_KEY_DIALOG_EDITING_WORD, mDialogEditingWord); + } + + private Cursor createCursor() { + String currentLocale = Locale.getDefault().toString(); + // Case-insensitive sort + return managedQuery(UserDictionary.Words.CONTENT_URI, QUERY_PROJECTION, + QUERY_SELECTION, new String[] { currentLocale }, + "UPPER(" + UserDictionary.Words.WORD + ")"); + } + + private ListAdapter createAdapter() { + return new MyAdapter(this, + android.R.layout.simple_list_item_1, mCursor, + new String[] { UserDictionary.Words.WORD }, + new int[] { android.R.id.text1 }); + } + + @Override + protected void onListItemClick(ListView l, View v, int position, long id) { + showAddOrEditDialog(getWord(position)); + } + + @Override + public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { + if (!(menuInfo instanceof AdapterContextMenuInfo)) return; + + AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo) menuInfo; + menu.setHeaderTitle(getWord(adapterMenuInfo.position)); + menu.add(0, CONTEXT_MENU_EDIT, 0, R.string.user_dict_settings_context_menu_edit_title); + menu.add(0, CONTEXT_MENU_DELETE, 0, R.string.user_dict_settings_context_menu_delete_title); + } + + @Override + public boolean onContextItemSelected(MenuItem item) { + ContextMenuInfo menuInfo = item.getMenuInfo(); + if (!(menuInfo instanceof AdapterContextMenuInfo)) return false; + + AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo) menuInfo; + String word = getWord(adapterMenuInfo.position); + + switch (item.getItemId()) { + case CONTEXT_MENU_DELETE: + deleteWord(word); + return true; + + case CONTEXT_MENU_EDIT: + showAddOrEditDialog(word); + return true; + } + + return false; + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + menu.add(0, OPTIONS_MENU_ADD, 0, R.string.user_dict_settings_add_menu_title) + .setIcon(R.drawable.ic_menu_add); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + showAddOrEditDialog(null); + return true; + } + + private void showAddOrEditDialog(String editingWord) { + mDialogEditingWord = editingWord; + showDialog(DIALOG_ADD_OR_EDIT); + } + + private String getWord(int position) { + mCursor.moveToPosition(position); + return mCursor.getString( + mCursor.getColumnIndexOrThrow(UserDictionary.Words.WORD)); + } + + @Override + protected Dialog onCreateDialog(int id) { + View content = getLayoutInflater().inflate(R.layout.dialog_edittext, null); + final EditText editText = (EditText) content.findViewById(R.id.edittext); + + return new AlertDialog.Builder(this) + .setTitle(R.string.user_dict_settings_add_dialog_title) + .setView(content) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + onAddOrEditFinished(editText.getText().toString()); + }}) + .setNegativeButton(android.R.string.cancel, null) + .create(); + } + + @Override + protected void onPrepareDialog(int id, Dialog d) { + AlertDialog dialog = (AlertDialog) d; + EditText editText = (EditText) dialog.findViewById(R.id.edittext); + editText.setText(mDialogEditingWord); + } + + private void onAddOrEditFinished(String word) { + if (mDialogEditingWord != null) { + // The user was editing a word, so do a delete/add + deleteWord(mDialogEditingWord); + } + + // Disallow duplicates + deleteWord(word); + + // TODO: present UI for picking whether to add word to all locales, or current. + UserDictionary.Words.addWord(this, word.toString(), + 1, UserDictionary.Words.LOCALE_TYPE_ALL); + mCursor.requery(); + } + + private void deleteWord(String word) { + getContentResolver().delete(UserDictionary.Words.CONTENT_URI, DELETE_SELECTION, + new String[] { word }); + } + + private static class MyAdapter extends SimpleCursorAdapter implements SectionIndexer { + private AlphabetIndexer mIndexer; + + public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { + super(context, layout, c, from, to); + + int wordColIndex = c.getColumnIndexOrThrow(UserDictionary.Words.WORD); + String alphabet = context.getString(com.android.internal.R.string.fast_scroll_alphabet); + mIndexer = new AlphabetIndexer(c, wordColIndex, alphabet); + } + + public int getPositionForSection(int section) { + return mIndexer.getPositionForSection(section); + } + + public int getSectionForPosition(int position) { + return mIndexer.getSectionForPosition(position); + } + + public Object[] getSections() { + return mIndexer.getSections(); + } + } +} diff --git a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java index bcad206..fe64d13 100644 --- a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java +++ b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java @@ -21,13 +21,12 @@ import com.android.settings.bluetooth.LocalBluetoothManager.ExtendedBluetoothSta import android.bluetooth.BluetoothA2dp; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHeadset; +import android.bluetooth.BluetoothError; import android.bluetooth.BluetoothIntent; -import android.bluetooth.IBluetoothDeviceCallback; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.os.Handler; import android.util.Log; /** @@ -40,29 +39,6 @@ public class BluetoothEventRedirector { private static final boolean V = LocalBluetoothManager.V; private LocalBluetoothManager mManager; - private Handler mUiHandler = new Handler(); - - private IBluetoothDeviceCallback mBtDevCallback = new IBluetoothDeviceCallback.Stub() { - public void onCreateBondingResult(final String address, final int result) { - if (V) { - Log.v(TAG, "onCreateBondingResult(" + address + ", " + result + ")"); - } - - mUiHandler.post(new Runnable() { - public void run() { - boolean wasSuccess = result == BluetoothDevice.RESULT_SUCCESS; - LocalBluetoothDeviceManager deviceManager = mManager.getLocalDeviceManager(); - deviceManager.onBondingStateChanged(address, wasSuccess); - if (!wasSuccess) { - deviceManager.onBondingError(address); - } - } - }); - } - - public void onEnableResult(int result) { } - public void onGetRemoteServiceChannelResult(String address, int channel) { } - }; private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override @@ -86,17 +62,21 @@ public class BluetoothEventRedirector { } else if (action.equals(BluetoothIntent.REMOTE_DEVICE_FOUND_ACTION)) { short rssi = intent.getShortExtra(BluetoothIntent.RSSI, Short.MIN_VALUE); - mManager.getLocalDeviceManager().onDeviceAppeared(address, rssi); + mManager.getLocalDeviceManager().onDeviceAppeared(address, rssi); } else if (action.equals(BluetoothIntent.REMOTE_DEVICE_DISAPPEARED_ACTION)) { mManager.getLocalDeviceManager().onDeviceDisappeared(address); } else if (action.equals(BluetoothIntent.REMOTE_NAME_UPDATED_ACTION)) { mManager.getLocalDeviceManager().onDeviceNameUpdated(address); - - } else if (action.equals(BluetoothIntent.BONDING_CREATED_ACTION)) { - mManager.getLocalDeviceManager().onBondingStateChanged(address, true); - } else if (action.equals(BluetoothIntent.BONDING_REMOVED_ACTION)) { - mManager.getLocalDeviceManager().onBondingStateChanged(address, false); - + } else if (action.equals(BluetoothIntent.BOND_STATE_CHANGED_ACTION)) { + int bondState = intent.getIntExtra(BluetoothIntent.BOND_STATE, + BluetoothError.ERROR); + mManager.getLocalDeviceManager().onBondingStateChanged(address, bondState); + if (bondState == BluetoothDevice.BOND_NOT_BONDED) { + int reason = intent.getIntExtra(BluetoothIntent.REASON, BluetoothError.ERROR); + Log.w(TAG, address + " unbonded with reason " + reason + + ", TODO: handle this nicely in the UI"); //TODO + mManager.getLocalDeviceManager().onBondingError(address); + } } else if (action.equals(BluetoothIntent.HEADSET_STATE_CHANGED_ACTION)) { mManager.getLocalDeviceManager().onProfileStateChanged(address); @@ -139,8 +119,7 @@ public class BluetoothEventRedirector { filter.addAction(BluetoothIntent.REMOTE_NAME_UPDATED_ACTION); // Pairing broadcasts - filter.addAction(BluetoothIntent.BONDING_CREATED_ACTION); - filter.addAction(BluetoothIntent.BONDING_REMOVED_ACTION); + filter.addAction(BluetoothIntent.BOND_STATE_CHANGED_ACTION); // Fine-grained state broadcasts filter.addAction(BluetoothA2dp.SINK_STATE_CHANGED_ACTION); @@ -152,8 +131,4 @@ public class BluetoothEventRedirector { public void stop() { mManager.getContext().unregisterReceiver(mBroadcastReceiver); } - - public IBluetoothDeviceCallback getBluetoothDeviceCallback() { - return mBtDevCallback; - } } diff --git a/src/com/android/settings/bluetooth/LocalBluetoothDevice.java b/src/com/android/settings/bluetooth/LocalBluetoothDevice.java index 77522f3..26ddbf2 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothDevice.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothDevice.java @@ -60,7 +60,7 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> { private boolean mVisible; - private int mPairingStatus; + private int mBondState; private final LocalBluetoothManager mLocalManager; @@ -85,13 +85,13 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> { } public void onClicked() { - int pairingStatus = getPairingStatus(); + int bondState = getBondState(); if (isConnected()) { askDisconnect(); - } else if (pairingStatus == SettingsBtStatus.PAIRING_STATUS_PAIRED) { + } else if (bondState == BluetoothDevice.BOND_BONDED) { connect(); - } else if (pairingStatus == SettingsBtStatus.PAIRING_STATUS_UNPAIRED) { + } else if (bondState == BluetoothDevice.BOND_NOT_BONDED) { pair(); } } @@ -195,55 +195,54 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> { } private boolean ensurePaired() { - if (getPairingStatus() == SettingsBtStatus.PAIRING_STATUS_UNPAIRED) { + if (getBondState() == BluetoothDevice.BOND_NOT_BONDED) { pair(); return false; } else { return true; } } - + public void pair() { BluetoothDevice manager = mLocalManager.getBluetoothManager(); - - // Pairing doesn't work if scanning, so cancel + + // Pairing is unreliable while scanning, so cancel discovery if (manager.isDiscovering()) { manager.cancelDiscovery(); } - + if (mLocalManager.createBonding(mAddress)) { - setPairingStatus(SettingsBtStatus.PAIRING_STATUS_PAIRING); + //TODO: consider removing this line - UI will update through Intent + setBondState(BluetoothDevice.BOND_BONDING); } } - + public void unpair() { BluetoothDevice manager = mLocalManager.getBluetoothManager(); - - switch (getPairingStatus()) { - case SettingsBtStatus.PAIRING_STATUS_PAIRED: - manager.removeBonding(mAddress); - break; - - case SettingsBtStatus.PAIRING_STATUS_PAIRING: - manager.cancelBondingProcess(mAddress); - break; + + switch (getBondState()) { + case BluetoothDevice.BOND_BONDED: + manager.removeBond(mAddress); + break; + + case BluetoothDevice.BOND_BONDING: + manager.cancelBondProcess(mAddress); + break; } } - + private void fillData() { BluetoothDevice manager = mLocalManager.getBluetoothManager(); - - fetchName(); + + fetchName(); mBtClass = manager.getRemoteClass(mAddress); LocalBluetoothProfileManager.fill(mBtClass, mProfiles); - - mPairingStatus = manager.hasBonding(mAddress) - ? SettingsBtStatus.PAIRING_STATUS_PAIRED - : SettingsBtStatus.PAIRING_STATUS_UNPAIRED; - + + mBondState = manager.getBondState(mAddress); + mVisible = false; - + dispatchAttributesChanged(); } @@ -283,17 +282,17 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> { } } - public int getPairingStatus() { - return mPairingStatus; + public int getBondState() { + return mBondState; } - void setPairingStatus(int pairingStatus) { - if (mPairingStatus != pairingStatus) { - mPairingStatus = pairingStatus; + void setBondState(int bondState) { + if (mBondState != bondState) { + mBondState = bondState; dispatchAttributesChanged(); } } - + void setRssi(short rssi) { if (mRssi != rssi) { mRssi = rssi; @@ -327,7 +326,7 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> { } } - if (getPairingStatus() == SettingsBtStatus.PAIRING_STATUS_PAIRING) { + if (getBondState() == BluetoothDevice.BOND_BONDING) { return true; } @@ -374,9 +373,8 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> { return SettingsBtStatus.getConnectionStatusSummary(connectionStatus); } } - - int pairingStatus = getPairingStatus(); - return SettingsBtStatus.getPairingStatusSummary(pairingStatus); + + return SettingsBtStatus.getPairingStatusSummary(getBondState()); } /** @@ -430,7 +428,7 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> { // No context menu if there are no profiles if (mProfiles.size() == 0) return; - int pairingStatus = getPairingStatus(); + int bondState = getBondState(); boolean isConnected = isConnected(); menu.setHeaderTitle(getName()); @@ -439,13 +437,13 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> { menu.add(0, CONTEXT_ITEM_DISCONNECT, 0, R.string.bluetooth_device_context_disconnect); } else { // For connection action, show either "Connect" or "Pair & connect" - int connectString = pairingStatus == SettingsBtStatus.PAIRING_STATUS_UNPAIRED + int connectString = (bondState == BluetoothDevice.BOND_NOT_BONDED) ? R.string.bluetooth_device_context_pair_connect : R.string.bluetooth_device_context_connect; menu.add(0, CONTEXT_ITEM_CONNECT, 0, connectString); } - if (pairingStatus == SettingsBtStatus.PAIRING_STATUS_PAIRED) { + if (bondState == BluetoothDevice.BOND_BONDED) { // For unpair action, show either "Unpair" or "Disconnect & unpair" int unpairString = isConnected ? R.string.bluetooth_device_context_disconnect_unpair @@ -540,8 +538,8 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> { if (comparison != 0) return comparison; // Paired above not paired - comparison = (another.mPairingStatus == SettingsBtStatus.PAIRING_STATUS_PAIRED ? 1 : 0) - - (mPairingStatus == SettingsBtStatus.PAIRING_STATUS_PAIRED ? 1 : 0); + comparison = (another.mBondState == BluetoothDevice.BOND_BONDED ? 1 : 0) - + (mBondState == BluetoothDevice.BOND_BONDED ? 1 : 0); if (comparison != 0) return comparison; // Visible above not visible diff --git a/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java b/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java index 48a41f1..a751656 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothDeviceManager.java @@ -47,7 +47,7 @@ public class LocalBluetoothDeviceManager { private synchronized void readPairedDevices() { BluetoothDevice manager = mLocalManager.getBluetoothManager(); - String[] bondedAddresses = manager.listBondings(); + String[] bondedAddresses = manager.listBonds(); if (bondedAddresses == null) return; for (String address : bondedAddresses) { @@ -97,7 +97,7 @@ public class LocalBluetoothDeviceManager { } private void checkForDeviceRemoval(LocalBluetoothDevice device) { - if (device.getPairingStatus() == SettingsBtStatus.PAIRING_STATUS_UNPAIRED && + if (device.getBondState() == BluetoothDevice.BOND_NOT_BONDED && !device.isVisible()) { // If device isn't paired, remove it altogether mDevices.remove(device); @@ -154,19 +154,18 @@ public class LocalBluetoothDeviceManager { } } - public synchronized void onBondingStateChanged(String address, boolean created) { + public synchronized void onBondingStateChanged(String address, int bondState) { LocalBluetoothDevice device = findDevice(address); if (device == null) { Log.e(TAG, "Got bonding state changed for " + address + ", but we have no record of that device."); return; } - - device.setPairingStatus(created ? SettingsBtStatus.PAIRING_STATUS_PAIRED - : SettingsBtStatus.PAIRING_STATUS_UNPAIRED); + + device.setBondState(bondState); //TODO: might be unecessary checkForDeviceRemoval(device); - if (created) { + if (bondState == BluetoothDevice.BOND_BONDED) { // Auto-connect after pairing device.connect(); } diff --git a/src/com/android/settings/bluetooth/LocalBluetoothManager.java b/src/com/android/settings/bluetooth/LocalBluetoothManager.java index 9db9e77..f8275b5 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothManager.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothManager.java @@ -227,7 +227,7 @@ public class LocalBluetoothManager { } public boolean createBonding(String address) { - return mManager.createBonding(address, mEventRedirector.getBluetoothDeviceCallback()); + return mManager.createBond(address); } public void showError(String address, int titleResId, int messageResId) { diff --git a/src/com/android/settings/bluetooth/SettingsBtStatus.java b/src/com/android/settings/bluetooth/SettingsBtStatus.java index 051d666..d2cbef5 100644 --- a/src/com/android/settings/bluetooth/SettingsBtStatus.java +++ b/src/com/android/settings/bluetooth/SettingsBtStatus.java @@ -16,6 +16,8 @@ package com.android.settings.bluetooth; +import android.bluetooth.BluetoothDevice; + import com.android.settings.R; /** @@ -64,19 +66,13 @@ public class SettingsBtStatus { || connectionStatus == CONNECTION_STATUS_DISCONNECTING; } - // Pairing status - - public static final int PAIRING_STATUS_UNPAIRED = 0; - public static final int PAIRING_STATUS_PAIRED = 1; - public static final int PAIRING_STATUS_PAIRING = 2; - - public static final int getPairingStatusSummary(int pairingStatus) { - switch (pairingStatus) { - case PAIRING_STATUS_PAIRED: + public static final int getPairingStatusSummary(int bondState) { + switch (bondState) { + case BluetoothDevice.BOND_BONDED: return R.string.bluetooth_paired; - case PAIRING_STATUS_PAIRING: + case BluetoothDevice.BOND_BONDING: return R.string.bluetooth_pairing; - case PAIRING_STATUS_UNPAIRED: + case BluetoothDevice.BOND_NOT_BONDED: return R.string.bluetooth_not_connected; default: return 0; |