diff --git a/.gitignore b/.gitignore index 39fb081..5f8d8c1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /build /captures .externalNativeBuild +.idea/vcs.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 3963879..75dac50 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -24,7 +24,7 @@ - + diff --git a/app/src/main/java/xyz/mtfos/btdemo/MainActivity.kt b/app/src/main/java/xyz/mtfos/btdemo/MainActivity.kt index 010360c..da4d9a8 100644 --- a/app/src/main/java/xyz/mtfos/btdemo/MainActivity.kt +++ b/app/src/main/java/xyz/mtfos/btdemo/MainActivity.kt @@ -30,22 +30,18 @@ class MainActivity : Activity() { ble?.startScan() } - th = Thread(Runnable { -> - {}.run { - thrun = true - while (thrun) { - System.out.println("state ===== " + ble?.mState) - if (ble?.mState == ble?.CONNECTED) { - uiHandler.post { - run { - btn.isEnabled = true - } - } - thrun = false - break + th = Thread(Runnable { + thrun = true + while (thrun) { + System.out.println("state ===== " + ble?.mState) + if (ble?.mState == ble?.CONNECTED) { + uiHandler.post { + btn.isEnabled = true } - Thread.sleep(200) + thrun = false + break } + Thread.sleep(200) } }) th?.start()