1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-18 06:37:47 +01:00

Fixed an UI error when Bluetooth discovery starting fails

This commit is contained in:
TaaviE 2020-08-02 21:23:14 +03:00
parent 61c74e9b15
commit 9627360fac

View File

@ -614,15 +614,18 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
*/ */
private void startBTDiscovery(Scanning what) { private void startBTDiscovery(Scanning what) {
LOG.info("Starting BT discovery"); LOG.info("Starting BT discovery");
setIsScanning(what);
handler.removeMessages(0, stopRunnable); handler.removeMessages(0, stopRunnable);
handler.sendMessageDelayed(getPostMessage(stopRunnable), SCAN_DURATION); handler.sendMessageDelayed(getPostMessage(stopRunnable), SCAN_DURATION);
if (adapter.startDiscovery()) { if (adapter.startDiscovery()) {
LOG.error("Discovery starting failed"); LOG.debug("Discovery starting successful");
}
bluetoothProgress.setVisibility(View.VISIBLE); bluetoothProgress.setVisibility(View.VISIBLE);
setIsScanning(what);
} else {
LOG.error("Discovery starting failed");
bluetoothProgress.setVisibility(View.GONE);
setIsScanning(Scanning.SCANNING_OFF);
}
} }
private void stopBTDiscovery() { private void stopBTDiscovery() {