kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
Merge pull request #469 from legendgroupv2/dev-app-bt-prompt
Shows a prompt when Bluetooth is off and trying to add a devicepull/475/head
commit
c1d854dc84
|
@ -1,5 +1,6 @@
|
|||
package com.geeksville.mesh.ui
|
||||
|
||||
import android.bluetooth.BluetoothAdapter
|
||||
import android.bluetooth.BluetoothDevice
|
||||
import android.companion.CompanionDeviceManager
|
||||
import android.content.*
|
||||
|
@ -485,6 +486,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
if (!myActivity.hasScanPermission()) {
|
||||
myActivity.requestScanPermission()
|
||||
} else {
|
||||
checkBTEnabled()
|
||||
if (!scanModel.hasCompanionDeviceApi) checkLocationEnabled()
|
||||
scanLeDevice()
|
||||
}
|
||||
|
@ -511,6 +513,15 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
}
|
||||
}
|
||||
|
||||
private fun checkBTEnabled(
|
||||
warningReason: String = getString(R.string.requires_bluetooth)
|
||||
) {
|
||||
if (bluetoothViewModel.enabled.value == false) {
|
||||
warn("We need bluetooth")
|
||||
showSnackbar(warningReason)
|
||||
}
|
||||
}
|
||||
|
||||
private val updateProgressFilter = IntentFilter(SoftwareUpdateService.ACTION_UPDATE_PROGRESS)
|
||||
|
||||
private val updateProgressReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
|
|
Ładowanie…
Reference in New Issue