check bluetooth enabled

master
Zhengyu Peng 3 years ago
parent 36d9080fc9
commit dc5d349db6

@ -124,7 +124,6 @@ class MainActivity : AppCompatActivity() {
if (bluetoothAdapter != null) {
if (!bluetoothAdapter.isEnabled) {
alertDialog(ERROR_BLUETOOTH_DISABLED)
}
} else {
if (btConnectPermission && btScanPermission) {
val serverIntent = Intent(this, DeviceListActivity::class.java)
@ -134,6 +133,7 @@ class MainActivity : AppCompatActivity() {
}
}
}
}
if (tabLayout.selectedTabPosition == 0) {
ipLayout.visibility = View.VISIBLE
@ -176,7 +176,6 @@ class MainActivity : AppCompatActivity() {
if (bluetoothAdapter != null) {
if (!bluetoothAdapter.isEnabled) {
alertDialog(ERROR_BLUETOOTH_DISABLED)
}
} else {
if (btConnectPermission && btScanPermission) {
saveSharedPref()
@ -189,6 +188,7 @@ class MainActivity : AppCompatActivity() {
alertDialog(ERROR_NO_PERMISSION)
}
}
}
} else {
alertDialog(ERROR_NO_DEVICE)
}
@ -242,7 +242,6 @@ class MainActivity : AppCompatActivity() {
} else if (requestCode == BLUETOOTH_SCAN_CODE) {
btScanPermission = true
}
}
}

Loading…
Cancel
Save