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
/captures
.externalNativeBuild
.idea/vcs.xml

View File

@ -24,7 +24,7 @@
</value>
</option>
</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" />
</component>
<component name="ProjectType">

View File

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