Add starting state to temp hotspot

This commit is contained in:
Mygod
2018-12-28 14:18:02 +08:00
parent e5b3e7e5d0
commit 7eec6f7a06
6 changed files with 49 additions and 27 deletions

View File

@@ -89,6 +89,7 @@ class LocalOnlyHotspotManager(private val parent: TetheringFragment) : Manager()
return lookup[binder?.iface ?: return ""]?.formatAddresses() ?: ""
}
override val active get() = binder?.iface != null
override val enabled get() = binder?.iface != ""
override val selectable get() = active
}
@@ -110,12 +111,11 @@ class LocalOnlyHotspotManager(private val parent: TetheringFragment) : Manager()
override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
binder = service as LocalOnlyHotspotService.Binder
service.manager = this
update()
service.ifaceChanged[this] = { data.notifyChange() }
}
override fun onServiceDisconnected(name: ComponentName?) {
binder?.manager = null
binder?.ifaceChanged?.remove(this)
binder = null
}
}