From 590c0a97ff3b7665306e14da9a999212da5f06b9 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Thu, 22 Jan 2009 00:13:44 -0800 Subject: auto import from //branches/cupcake/...@127436 --- AndroidManifest.xml | 10 + res/drawable/ic_menu_add.png | Bin 0 -> 2017 bytes res/layout/dialog_edittext.xml | 29 +++ res/layout/list_content_with_empty_view.xml | 35 +++ res/values-cs/arrays.xml | 14 ++ res/values-cs/strings.xml | 30 +++ res/values-de/arrays.xml | 14 ++ res/values-de/strings.xml | 30 +++ res/values-es/arrays.xml | 14 ++ res/values-es/strings.xml | 30 +++ res/values-fr/arrays.xml | 14 ++ res/values-fr/strings.xml | 30 +++ res/values-it/arrays.xml | 14 ++ res/values-it/strings.xml | 30 +++ res/values-ja/arrays.xml | 14 ++ res/values-ja/strings.xml | 30 +++ res/values-nl/arrays.xml | 14 ++ res/values-nl/strings.xml | 30 +++ res/values-pl/arrays.xml | 14 ++ res/values-pl/strings.xml | 30 +++ res/values-ru/arrays.xml | 14 ++ res/values-ru/strings.xml | 30 +++ res/values-zh-rCN/arrays.xml | 14 ++ res/values-zh-rCN/strings.xml | 30 +++ res/values-zh-rTW/arrays.xml | 14 ++ res/values-zh-rTW/strings.xml | 30 +++ res/values/strings.xml | 18 ++ res/xml/language_settings.xml | 7 + .../android/settings/UserDictionarySettings.java | 242 +++++++++++++++++++++ .../bluetooth/BluetoothEventRedirector.java | 51 ++--- .../settings/bluetooth/LocalBluetoothDevice.java | 86 ++++---- .../bluetooth/LocalBluetoothDeviceManager.java | 13 +- .../settings/bluetooth/LocalBluetoothManager.java | 2 +- .../settings/bluetooth/SettingsBtStatus.java | 18 +- 34 files changed, 894 insertions(+), 101 deletions(-) create mode 100755 res/drawable/ic_menu_add.png create mode 100644 res/layout/dialog_edittext.xml create mode 100644 res/layout/list_content_with_empty_view.xml create mode 100644 src/com/android/settings/UserDictionarySettings.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index e50dacd..9e39c9f 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -28,6 +28,8 @@ + + @@ -150,6 +152,14 @@ + + + + + + + diff --git a/res/drawable/ic_menu_add.png b/res/drawable/ic_menu_add.png new file mode 100755 index 0000000..6752bfd Binary files /dev/null and b/res/drawable/ic_menu_add.png differ 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 @@ + + + + + + + + \ 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 @@ + + + + + + + + + + + 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 @@ + 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 @@ + "Neznámé" @@ -632,6 +646,22 @@ "Znak „.“ lze vložit dvěma stisky klávesy Mezerník." "Zobrazování hesel" "Zadávané heslo je zobrazováno" + + + + + + + + + + + + + + + + "Testování" "Info o telefonu" "Info o baterii" 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 @@ + 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 @@ + "Unbekannt" @@ -632,6 +646,22 @@ "Leertaste zweimal drücken, um \".\" hinzuzufügen" "Sichtbare Passwörter" "Passwort bei der Eingabe anzeigen" + + + + + + + + + + + + + + + + "Test" "Telefoninformation" "Akkuinformationen" 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 @@ + 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 @@ + "Desconocido" @@ -632,6 +646,22 @@ "Pulse la tecla Espacio dos veces para insertar el carácter \".\"." "Contraseñas visibles" "Mostrar contraseña mientras se escribe" + + + + + + + + + + + + + + + + "Prueba" "Información sobre el teléfono" "Información sobre la batería" 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 @@ + 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 @@ + "Inconnu" @@ -632,6 +646,22 @@ "Appuyez deux fois sur la touche Espace pour insérer \".\"" "Mots de passe visibles" "Afficher le mot de passe lors de la saisie" + + + + + + + + + + + + + + + + "Test" "Informations sur le téléphone" "Informations sur la batterie" 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 @@ + 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 @@ + "Sconosciuto" @@ -632,6 +646,22 @@ "Premi due volte la barra spaziatrice per inserire \".\"" "Password visibili" "Mostra la password durante la digitazione" + + + + + + + + + + + + + + + + "Verifica in corso" "Informazioni telefono" "Informazioni batteria" 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 @@ + 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 @@ + "不明" @@ -632,6 +646,22 @@ "Spaceキーを2回押して「。」を挿入" "パスワードを表示" "入力中のパスワードを表示" + + + + + + + + + + + + + + + + "テスト中" "携帯電話情報" "バッテリ情報" 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 @@ + 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 @@ + "Onbekend" @@ -632,6 +646,22 @@ "Druk twee keer op de spatiebalk om \'.\' in te voegen" "Zichtbare wachtwoorden" "Wachtwoord weergeven tijdens het typen" + + + + + + + + + + + + + + + + "Testen" "Telefooninformatie" "Accu-informatie" 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 @@ + 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 @@ + "Nieznany" @@ -632,6 +646,22 @@ "Naciśnij klawisz spacji dwukrotnie, aby wstawić „.”" "Widoczne hasła" "Pokazuj hasło podczas wpisywania" + + + + + + + + + + + + + + + + "Testowanie" "Informacje o telefonie" "Informacje o baterii" 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 @@ + 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 @@ + "Неизвестно" @@ -632,6 +646,22 @@ "Чтобы вставить символ \".\", дважды нажмите пробел." "Показывать пароли" "Показывать пароль при вводе" + + + + + + + + + + + + + + + + "Тестирование" "Сведения о телефоне" "Сведения о батарее" 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 @@ + 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 @@ + "未知" @@ -632,6 +646,22 @@ "按两次空格键来插入“。”" "可见的密码" "键入时显示密码" + + + + + + + + + + + + + + + + "测试" "手机信息" "电池信息" 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 @@ + 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 @@ + "未知的" @@ -632,6 +646,22 @@ "按空白鍵兩次可插入「.」" "密碼可見" "顯示輸入的密碼" + + + + + + + + + + + + + + + + "測試中" "手機資訊" "電池資訊" 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. Visible passwords Show password as you type + + + + User dictionary + + User dictionary + + Add & remove words from user dictionary + + Add + + Add to dictionary + + Edit + + Delete + + You do not have any words in the user dictionary. You can add a word through the menu. Testing 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" /> + + + { private boolean mVisible; - private int mPairingStatus; + private int mBondState; private final LocalBluetoothManager mLocalManager; @@ -85,13 +85,13 @@ public class LocalBluetoothDevice implements Comparable { } 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 { } 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 { } } - 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 { } } - if (getPairingStatus() == SettingsBtStatus.PAIRING_STATUS_PAIRING) { + if (getBondState() == BluetoothDevice.BOND_BONDING) { return true; } @@ -374,9 +373,8 @@ public class LocalBluetoothDevice implements Comparable { return SettingsBtStatus.getConnectionStatusSummary(connectionStatus); } } - - int pairingStatus = getPairingStatus(); - return SettingsBtStatus.getPairingStatusSummary(pairingStatus); + + return SettingsBtStatus.getPairingStatusSummary(getBondState()); } /** @@ -430,7 +428,7 @@ public class LocalBluetoothDevice implements Comparable { // 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 { 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 { 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; -- cgit v1.1