Fix address not updated

This commit is contained in:
Mygod
2018-05-09 16:30:46 -07:00
parent 377025371d
commit 3d0b430fa8

View File

@@ -76,8 +76,9 @@ class RepeaterFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClickL
fun onStatusChanged() { fun onStatusChanged() {
notifyPropertyChanged(BR.switchEnabled) notifyPropertyChanged(BR.switchEnabled)
notifyPropertyChanged(BR.serviceStarted) notifyPropertyChanged(BR.serviceStarted)
if (binder?.active != true) onGroupChanged()
} }
fun onGroupChanged(group: WifiP2pGroup? = binder?.service?.group) { fun onGroupChanged(group: WifiP2pGroup? = null) {
notifyPropertyChanged(BR.ssid) notifyPropertyChanged(BR.ssid)
p2pInterface = group?.`interface` p2pInterface = group?.`interface`
notifyPropertyChanged(BR.addresses) notifyPropertyChanged(BR.addresses)
@@ -208,7 +209,6 @@ class RepeaterFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClickL
binder.groupChanged -= this binder.groupChanged -= this
this.binder = null this.binder = null
data.onStatusChanged() data.onStatusChanged()
data.onGroupChanged()
} }
override fun onMenuItemClick(item: MenuItem) = when (item.itemId) { override fun onMenuItemClick(item: MenuItem) = when (item.itemId) {