summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndres Morales <anmorales@google.com>2014-11-17 21:54:44 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-17 21:54:45 +0000
commiteadc627caf5ff7458005d17b58a18b3c65725a6f (patch)
treee4950954e18bd3d0d489bf5ad91028d34463ca59
parent2ca2ced60d0cebbe8041c4318cff9975d3bff2c4 (diff)
parentdceae917c7aeb73dfce10ab5e2e9143fb988c4a8 (diff)
downloadandroid_packages_apps_Nfc-eadc627caf5ff7458005d17b58a18b3c65725a6f.tar.gz
android_packages_apps_Nfc-eadc627caf5ff7458005d17b58a18b3c65725a6f.tar.bz2
android_packages_apps_Nfc-eadc627caf5ff7458005d17b58a18b3c65725a6f.zip
Merge "Make BT pairing strings localizable" into lmp-mr1-dev
-rwxr-xr-xres/values/strings.xml25
-rw-r--r--src/com/android/nfc/handover/BluetoothPeripheralHandover.java35
2 files changed, 35 insertions, 25 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 923e4322..1ca995d0 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -29,14 +29,25 @@
<string name="beam_handover_not_supported">The receiver\'s device doesn\'t support large file transfer via beam.</string>
<string name="beam_try_again">Bring devices together again</string>
- <string name="connecting_peripheral">Connecting</string>
- <string name="connected_peripheral">Connected</string>
- <string name="connect_peripheral_failed">Could not connect</string>
- <string name="disconnecting_peripheral">Disconnecting</string>
- <string name="disconnected_peripheral">Disconnected</string>
- <string name="pairing_peripheral">Pairing</string>
- <string name="pairing_peripheral_failed">Could not pair</string>
+ <!-- String referring to the device being connected when there is no name for the device -->
+ <string name="device">device</string>
+ <!-- Toast string informing the user that the device is connecting [CHAR_LIMIT=35] -->
+ <string name="connecting_peripheral">Connecting <xliff:g id="device_name">%1$s</xliff:g></string>
+ <!-- Toast string informing the user that the device is connected [CHAR_LIMIT=35] -->
+ <string name="connected_peripheral">Connected <xliff:g id="device_name">%1$s</xliff:g></string>
+ <!-- Toast string informing the user that the device failed to connect [CHAR_LIMIT=35] -->
+ <string name="connect_peripheral_failed">Could not connect <xliff:g id="device_name">%1$s</xliff:g></string>
+ <!-- Toast string informing the user that the device is disconnecting [CHAR_LIMIT=35] -->
+ <string name="disconnecting_peripheral">Disconnecting <xliff:g id="device_name">%1$s</xliff:g></string>
+ <!-- Toast string informing the user that the device is disconnected [CHAR_LIMIT=35] -->
+ <string name="disconnected_peripheral">Disconnected <xliff:g id="device_name">%1$s</xliff:g></string>
+ <!-- Toast string informing the user that the device is pairing [CHAR_LIMIT=35] -->
+ <string name="pairing_peripheral">Pairing <xliff:g id="device_name">%1$s</xliff:g></string>
+ <!-- Toast string informing the user that the device failed to pair [CHAR_LIMIT=35] -->
+ <string name="pairing_peripheral_failed">Could not pair <xliff:g id="device_name">%1$s</xliff:g></string>
+ <!-- Toast string informing the user that BT could not be enabled [CHAR_LIMIT=35] -->
<string name="failed_to_enable_bt">Could not enable Bluetooth</string>
+ <!-- Dialog string informing the user that BT could not be enabled [CHAR_LIMIT=75] -->
<string name="confirm_pairing">Are you sure you want to pair the Bluetooth device <xliff:g id="device_name">%1$s</xliff:g>?</string>
<string name="pair_yes">Yes</string>
<string name="pair_no">No</string>
diff --git a/src/com/android/nfc/handover/BluetoothPeripheralHandover.java b/src/com/android/nfc/handover/BluetoothPeripheralHandover.java
index 24bd9e5e..3ac09e62 100644
--- a/src/com/android/nfc/handover/BluetoothPeripheralHandover.java
+++ b/src/com/android/nfc/handover/BluetoothPeripheralHandover.java
@@ -222,8 +222,7 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
!= BluetoothProfile.STATE_DISCONNECTED) {
mHidResult = RESULT_PENDING;
mInput.disconnect(mDevice);
- toast(mContext.getString(R.string.disconnecting_peripheral) + " " +
- mName + "...");
+ toast(getToastString(R.string.disconnecting_peripheral));
break;
} else {
mHidResult = RESULT_DISCONNECTED;
@@ -244,8 +243,7 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
mA2dpResult = RESULT_DISCONNECTED;
}
if (mA2dpResult == RESULT_PENDING || mHfpResult == RESULT_PENDING) {
- toast(mContext.getString(R.string.disconnecting_peripheral) + " " +
- mName + "...");
+ toast(getToastString(R.string.disconnecting_peripheral));
break;
}
}
@@ -254,7 +252,7 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
case STATE_DISCONNECTING:
if (mTransport == BluetoothDevice.TRANSPORT_LE) {
if (mHidResult == RESULT_DISCONNECTED) {
- toast(mContext.getString(R.string.disconnected_peripheral) + " " + mName);
+ toast(getToastString(R.string.disconnected_peripheral));
complete(false);
}
@@ -265,7 +263,7 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
break;
}
if (mA2dpResult == RESULT_DISCONNECTED && mHfpResult == RESULT_DISCONNECTED) {
- toast(mContext.getString(R.string.disconnected_peripheral) + " " + mName);
+ toast(getToastString(R.string.disconnected_peripheral));
}
complete(false);
break;
@@ -275,6 +273,10 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
}
+ private String getToastString(int resid) {
+ return mContext.getString(resid, mName != null ? mName : R.string.device);
+ }
+
boolean getProfileProxys() {
if (mTransport == BluetoothDevice.TRANSPORT_LE) {
@@ -326,8 +328,7 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
!= BluetoothProfile.STATE_CONNECTED) {
mHidResult = RESULT_PENDING;
mInput.connect(mDevice);
- toast(mContext.getString(R.string.connecting_peripheral) + " "
- + mName + "...");
+ toast(getToastString(R.string.connecting_peripheral));
break;
} else {
mHidResult = RESULT_CONNECTED;
@@ -347,8 +348,7 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
mA2dpResult = RESULT_CONNECTED;
}
if (mA2dpResult == RESULT_PENDING || mHfpResult == RESULT_PENDING) {
- toast(mContext.getString(R.string.connecting_peripheral) + " "
- + mName + "...");
+ toast(getToastString(R.string.connecting_peripheral));
break;
}
}
@@ -359,12 +359,11 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
if (mHidResult == RESULT_PENDING) {
break;
} else if (mHidResult == RESULT_CONNECTED) {
- toast(mContext.getString(R.string.connected_peripheral) + " " + mName);
+ toast(getToastString(R.string.connected_peripheral));
mDevice.setAlias(mName);
complete(true);
} else {
- toast (mContext.getString(R.string.connect_peripheral_failed) + " "
- + mName);
+ toast (getToastString(R.string.connect_peripheral_failed));
complete(false);
}
} else {
@@ -374,12 +373,12 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
}
if (mA2dpResult == RESULT_CONNECTED || mHfpResult == RESULT_CONNECTED) {
// we'll take either as success
- toast(mContext.getString(R.string.connected_peripheral) + " " + mName);
+ toast(getToastString(R.string.connected_peripheral));
if (mA2dpResult == RESULT_CONNECTED) startTheMusic();
mDevice.setAlias(mName);
complete(true);
} else {
- toast (mContext.getString(R.string.connect_peripheral_failed) + " " + mName);
+ toast (getToastString(R.string.connect_peripheral_failed));
complete(false);
}
}
@@ -389,9 +388,9 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
void startBonding() {
mState = STATE_BONDING;
- toast(mContext.getString(R.string.pairing_peripheral) + " " + mName + "...");
+ toast(getToastString(R.string.pairing_peripheral));
if (!mDevice.createBond(mTransport)) {
- toast(mContext.getString(R.string.pairing_peripheral_failed) + " " + mName);
+ toast(getToastString(R.string.pairing_peripheral_failed));
complete(false);
}
}
@@ -413,7 +412,7 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList
if (bond == BluetoothDevice.BOND_BONDED) {
nextStepConnect();
} else if (bond == BluetoothDevice.BOND_NONE) {
- toast(mContext.getString(R.string.pairing_peripheral_failed) + " " + mName);
+ toast(getToastString(R.string.pairing_peripheral_failed));
complete(false);
}
} else if (BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED.equals(action) &&