1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-24 05:50:47 +02:00

Added a checkbox to un-ignore bonded devices

This commit is contained in:
TaaviE 2020-08-01 03:06:13 +03:00 committed by Gitea
parent 8795acd0fd
commit 8da7a7aced
2 changed files with 14 additions and 2 deletions

View File

@ -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);

View File

@ -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"