From ab1d6d8582ca4c6a6de8be8e04840f0c8a97c739 Mon Sep 17 00:00:00 2001 From: Jimmy Shih Date: Thu, 17 Jan 2013 17:41:50 -0800 Subject: [PATCH] Update sensor settings --- .../res/values/arrays_do_not_translate.xml | 12 +-- MyTracks/res/values/strings.xml | 89 ++++++++---------- MyTracks/res/xml/sensor_settings.xml | 4 +- .../settings/AbstractSettingsActivity.java | 90 ++----------------- .../settings/SensorSettingsActivity.java | 79 +++++++++------- 5 files changed, 95 insertions(+), 179 deletions(-) diff --git a/MyTracks/res/values/arrays_do_not_translate.xml b/MyTracks/res/values/arrays_do_not_translate.xml index cb4366dc0..d97c63fbe 100644 --- a/MyTracks/res/values/arrays_do_not_translate.xml +++ b/MyTracks/res/values/arrays_do_not_translate.xml @@ -161,26 +161,26 @@ limitations under the License. 5000 - @string/value_none - @string/settings_sensor_type_ant @string/settings_sensor_type_polar @string/settings_sensor_type_zephyr + @string/settings_sensor_type_ant + @string/value_none - @string/sensor_type_value_none - @string/sensor_type_value_ant @string/sensor_type_value_polar @string/sensor_type_value_zephyr + @string/sensor_type_value_ant + @string/sensor_type_value_none - @string/value_none @string/settings_sensor_type_polar @string/settings_sensor_type_zephyr + @string/value_none - @string/sensor_type_value_none @string/sensor_type_value_polar @string/sensor_type_value_zephyr + @string/sensor_type_value_none @string/settings_map_track_color_mode_single diff --git a/MyTracks/res/values/strings.xml b/MyTracks/res/values/strings.xml index 3f900c116..6dd719d6f 100644 --- a/MyTracks/res/values/strings.xml +++ b/MyTracks/res/values/strings.xml @@ -1968,128 +1968,111 @@ limitations under the License. Sensor - - ANT+ options + + Not connected - Paired with: %1$d + Paired with %1$d Reset bike cadence Reset combined bike Reset heart rate Reset foot pod - - Bluetooth options + Bluetooth Bluetooth pairing - Open Android\'s Bluetooth settings to pair a device. + translation_description="In the 'Sensor' settings, under the 'Bluetooth' section, the summary + for the 'Bluetooth pairing' option explaining that it will open the Android's Bluetooth + settings to pair a sensor."> + Open Android\'s Bluetooth settings to pair a sensor Bluetooth sensor - - The Bluetooth sensor to connect to. - + %1$s: sensor name. E.g., 'Polar Bluetooth'."> Connected to %1$s - - Not connected. - + Sensor type ANT+ Polar Bluetooth - - The type of sensor to connect to. - Zephyr Bluetooth diff --git a/MyTracks/res/xml/sensor_settings.xml b/MyTracks/res/xml/sensor_settings.xml index e79307e31..40d1d4335 100644 --- a/MyTracks/res/xml/sensor_settings.xml +++ b/MyTracks/res/xml/sensor_settings.xml @@ -23,7 +23,7 @@ limitations under the License. android:title="@string/settings_sensor_type" /> + android:title="@string/settings_sensor_bluetooth" > + android:title="@string/settings_sensor_type_ant" > optionsList = new ArrayList(); List valuesList = new ArrayList(); BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); @@ -155,22 +171,17 @@ public class SensorSettingsActivity extends AbstractSettingsActivity { String[] options = optionsList.toArray(new String[optionsList.size()]); String[] values = valuesList.toArray(new String[valuesList.size()]); - String bluetoothSensorValue = PreferencesUtils.getString( - this, R.string.bluetooth_sensor_key, PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT); - ListPreference bluetoothSensorListPreference = (ListPreference) findPreference( - getString(R.string.bluetooth_sensor_key)); if (valuesList.size() == 1) { - if (!valuesList.get(0).equals(bluetoothSensorValue)) { - bluetoothSensorValue = valuesList.get(0); - PreferencesUtils.setString(this, R.string.bluetooth_sensor_key, bluetoothSensorValue); + if (!valuesList.get(0).equals(value)) { + value = valuesList.get(0); + PreferencesUtils.setString(this, R.string.bluetooth_sensor_key, value); } } else { - if (!valuesList.contains(bluetoothSensorValue)) { - bluetoothSensorValue = PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT; - PreferencesUtils.setString(this, R.string.bluetooth_sensor_key, bluetoothSensorValue); + if (!valuesList.contains(value)) { + value = PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT; + PreferencesUtils.setString(this, R.string.bluetooth_sensor_key, value); } } - configurePreference(bluetoothSensorListPreference, options, values, - R.string.settings_sensor_bluetooth_sensor_summary, bluetoothSensorValue, null); + configureListPreference(preference, options, options, values, value, null); } }