mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-07-08 22:51:37 +02:00
Added a checkbox to un-ignore bonded devices
This commit is contained in:
parent
8795acd0fd
commit
8da7a7aced
|
@ -258,6 +258,9 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||
private Scanning isScanning = Scanning.SCANNING_OFF;
|
||||
private GBDeviceCandidate bondingDevice;
|
||||
|
||||
private boolean ignoreBonded = true;
|
||||
|
||||
|
||||
private enum Scanning {
|
||||
SCANNING_BT,
|
||||
SCANNING_BTLE,
|
||||
|
@ -269,6 +272,8 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ignoreBonded = GBApplication.getPrefs().getBoolean("ignore_bonded_devices", true);
|
||||
|
||||
disableNewBLEScanning = GBApplication.getPrefs().getBoolean("disable_new_ble_scanning", false);
|
||||
if (disableNewBLEScanning) {
|
||||
LOG.info("new BLE scanning disabled via settings, using old method");
|
||||
|
@ -377,8 +382,9 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||
}
|
||||
}
|
||||
}
|
||||
if (device.getBondState() == BluetoothDevice.BOND_BONDED) {
|
||||
return true; // ignore already bonded devices
|
||||
|
||||
if (device.getBondState() == BluetoothDevice.BOND_BONDED && ignoreBonded) {
|
||||
return true; // Ignore already bonded devices
|
||||
}
|
||||
|
||||
GBDeviceCandidate candidate = new GBDeviceCandidate(device, rssi, uuids);
|
||||
|
|
|
@ -632,6 +632,12 @@
|
|||
android:defaultValue="false"
|
||||
android:key="log_to_file"
|
||||
android:title="@string/pref_write_logfiles" />
|
||||
<CheckBoxPreference
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:defaultValue="true"
|
||||
android:key="ignore_bonded_devices"
|
||||
android:summary="@string/ignore_bonded_devices_description"
|
||||
android:title="@string/ignore_bonded_devices" />
|
||||
<CheckBoxPreference
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:defaultValue="false"
|
||||
|
|
Loading…
Reference in New Issue
Block a user