This commit is contained in:
Jay 2017-08-15 11:59:00 +08:00
parent 1baa779c49
commit 95c4bdaa9d
3 changed files with 12 additions and 15 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/build /build
/captures /captures
.externalNativeBuild .externalNativeBuild
.idea/vcs.xml

View File

@ -24,7 +24,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -30,23 +30,19 @@ class MainActivity : Activity() {
ble?.startScan() ble?.startScan()
} }
th = Thread(Runnable { -> th = Thread(Runnable {
{}.run {
thrun = true thrun = true
while (thrun) { while (thrun) {
System.out.println("state ===== " + ble?.mState) System.out.println("state ===== " + ble?.mState)
if (ble?.mState == ble?.CONNECTED) { if (ble?.mState == ble?.CONNECTED) {
uiHandler.post { uiHandler.post {
run {
btn.isEnabled = true btn.isEnabled = true
} }
}
thrun = false thrun = false
break break
} }
Thread.sleep(200) Thread.sleep(200)
} }
}
}) })
th?.start() th?.start()