Settings: renamed Bluetooth sensor to "Heart rate".

This commit is contained in:
Dennis Guse
2019-11-18 17:16:50 +01:00
parent 7a4faf6b0d
commit 54ff94f905
5 changed files with 9 additions and 9 deletions
@@ -85,8 +85,8 @@ public class BluetoothRemoteSensorManager {
private final SharedPreferences.OnSharedPreferenceChangeListener sharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() { private final SharedPreferences.OnSharedPreferenceChangeListener sharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) { public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
if (bluetoothConnectionManager != null && PreferencesUtils.isKey(context, R.string.settings_sensor_bluetooth_sensor_key, key)) { if (bluetoothConnectionManager != null && PreferencesUtils.isKey(context, R.string.settings_sensor_bluetooth_heart_rate_key, key)) {
String address = PreferencesUtils.getString(context, R.string.settings_sensor_bluetooth_sensor_key, PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT); String address = PreferencesUtils.getString(context, R.string.settings_sensor_bluetooth_heart_rate_key, PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT);
if (address.equals(PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT)) { if (address.equals(PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT)) {
stop(); stop();
return; return;
@@ -145,7 +145,7 @@ public class BluetoothRemoteSensorManager {
return; return;
} }
String address = PreferencesUtils.getString(context, R.string.settings_sensor_bluetooth_sensor_key, PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT); String address = PreferencesUtils.getString(context, R.string.settings_sensor_bluetooth_heart_rate_key, PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT);
if (PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT.equals(address)) { if (PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT.equals(address)) {
Log.w(TAG, "No bluetooth address."); Log.w(TAG, "No bluetooth address.");
return; return;
@@ -157,7 +157,7 @@ public class SettingsActivity extends AppCompatActivity implements ChooseActivit
private void updateBluetooth() { private void updateBluetooth() {
// Disable Bluetooth preference if device does not have Bluetooth // Disable Bluetooth preference if device does not have Bluetooth
BluetoothLeListPreference bluetoothPreference = findPreference(getString(R.string.settings_sensor_bluetooth_sensor_key)); BluetoothLeListPreference bluetoothPreference = findPreference(getString(R.string.settings_sensor_bluetooth_heart_rate_key));
bluetoothPreference.setVisible(BluetoothUtils.hasBluetooth(TAG)); bluetoothPreference.setVisible(BluetoothUtils.hasBluetooth(TAG));
} }
@@ -108,7 +108,7 @@ public class StatsUtils {
public static void setSensorData(Activity activity, SensorDataSet sensorDataSet, boolean isRecording) { public static void setSensorData(Activity activity, SensorDataSet sensorDataSet, boolean isRecording) {
// heart rate // heart rate
int isVisible = View.VISIBLE; int isVisible = View.VISIBLE;
if (!isRecording || PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT.equals(PreferencesUtils.getString(activity, R.string.settings_sensor_bluetooth_sensor_key, PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT))) { if (!isRecording || PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT.equals(PreferencesUtils.getString(activity, R.string.settings_sensor_bluetooth_heart_rate_key, PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT))) {
isVisible = View.INVISIBLE; isVisible = View.INVISIBLE;
} }
activity.findViewById(R.id.stats_sensor_container).setVisibility(isVisible); activity.findViewById(R.id.stats_sensor_container).setVisibility(isVisible);
+1 -1
View File
@@ -27,7 +27,7 @@
<string name="settings_reset_key" translatable="false">settingsReset</string> <string name="settings_reset_key" translatable="false">settingsReset</string>
<string name="settings_sensor_bluetooth_sensor_key" translatable="false">bluetoothSensor</string> <string name="settings_sensor_bluetooth_heart_rate_key" translatable="false">bluetoothSensor</string>
<string name="sensor_type_value_none" translatable="false">NONE</string> <string name="sensor_type_value_none" translatable="false">NONE</string>
<string name="default_activity_key" translatable="false">defaultActivity</string> <string name="default_activity_key" translatable="false">defaultActivity</string>
+3 -3
View File
@@ -129,11 +129,11 @@ limitations under the License.
android:title="@string/settings_recording_default_activity_title" /> android:title="@string/settings_recording_default_activity_title" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/settings_sensor"> <PreferenceCategory android:title="@string/settings_sensor_bluetooth">
<de.dennisguse.opentracks.settings.BluetoothLeListPreference <de.dennisguse.opentracks.settings.BluetoothLeListPreference
android:defaultValue="@string/sensor_type_value_none" android:defaultValue="@string/sensor_type_value_none"
android:key="@string/settings_sensor_bluetooth_sensor_key" android:key="@string/settings_sensor_bluetooth_heart_rate_key"
android:title="@string/settings_sensor_bluetooth_sensor" /> android:title="@string/sensor_state_heart_rate" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/generic_tracks"> <PreferenceCategory android:title="@string/generic_tracks">