Fix permission dialog flash loop in onResume
This commit is contained in:
parent
d005fef3f6
commit
ac2767c2b6
1 changed files with 5 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ class MainActivity : AppCompatActivity(), BleCallbacks {
|
|||
private lateinit var relay1Button: Button
|
||||
private lateinit var relay2Button: Button
|
||||
private var lastTheme: String? = null
|
||||
private var permissionsRequested = false
|
||||
|
||||
override fun onStatusChanged(status: BleStatus) {
|
||||
when (status) {
|
||||
|
|
@ -118,7 +119,10 @@ class MainActivity : AppCompatActivity(), BleCallbacks {
|
|||
loadButtonLabel(relay1Button, PrefsHelper.PREF_LABEL1, R.string.button_hold)
|
||||
loadButtonLabel(relay2Button, PrefsHelper.PREF_LABEL2, R.string.button_hold)
|
||||
if (!manager.hasPermissions()) {
|
||||
requestPermissions()
|
||||
if (!permissionsRequested) {
|
||||
permissionsRequested = true
|
||||
requestPermissions()
|
||||
}
|
||||
return
|
||||
}
|
||||
if (!manager.isConnected()) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue