check bluetooth enabled
This commit is contained in:
parent
22a375a2ee
commit
12798c8588
@ -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…
x
Reference in New Issue
Block a user