check bluetooth enabled
This commit is contained in:
		@@ -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
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user