forked from upstream-mirrors/OpenTracks
Simplified getting the BluetoothAdapter.
This commit is contained in:
@@ -137,7 +137,7 @@ public class SettingsActivity extends AppCompatActivity implements ChooseActivit
|
||||
private void updateBluetooth() {
|
||||
// Disable Bluetooth preference if device does not have Bluetooth
|
||||
BluetoothLeSensorPreference bluetoothPreference = findPreference(getString(R.string.settings_sensor_bluetooth_heart_rate_key));
|
||||
bluetoothPreference.setVisible(BluetoothUtils.hasBluetooth(TAG));
|
||||
bluetoothPreference.setVisible(BluetoothUtils.hasBluetooth(getContext()));
|
||||
}
|
||||
|
||||
private void updateUnits() {
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ public abstract class BluetoothLeSensorPreference extends DialogPreference {
|
||||
UUID sensorUUID = (UUID) getArguments().getSerializable(ARG_BLUETOOTH_UUID);
|
||||
Log.i(TAG, "UUID: " + sensorUUID);
|
||||
|
||||
BluetoothAdapter bluetoothAdapter = BluetoothUtils.getDefaultBluetoothAdapter(TAG);
|
||||
BluetoothAdapter bluetoothAdapter = BluetoothUtils.getAdapter(getContext());
|
||||
if (bluetoothAdapter == null || !bluetoothAdapter.isEnabled()) {
|
||||
Log.w(TAG, "Bluetooth adapter is present or not enabled.");
|
||||
Toast.makeText(getContext(), R.string.bluetooth_disabled, Toast.LENGTH_SHORT).show();
|
||||
|
||||
Reference in New Issue
Block a user