Support monitoring tethered interface
This would be useful to be used in together with Instant Tethering + Turn off hotspot automatically. Refine #26, #53.
This commit is contained in:
@@ -4,6 +4,7 @@ import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import be.mygod.vpnhotspot.R
|
||||
import be.mygod.vpnhotspot.TetheringService
|
||||
import be.mygod.vpnhotspot.databinding.ListitemInterfaceBinding
|
||||
import be.mygod.vpnhotspot.net.TetherType
|
||||
@@ -30,12 +31,14 @@ class InterfaceManager(private val parent: TetheringFragment, val iface: String)
|
||||
}
|
||||
private inner class Data : be.mygod.vpnhotspot.manage.Data() {
|
||||
override val icon get() = TetherType.ofInterface(iface).icon
|
||||
override val title get() = iface
|
||||
override val title get() = if (parent.binder?.monitored(iface) == true) {
|
||||
parent.getString(R.string.tethering_state_monitored, iface)
|
||||
} else iface
|
||||
override val text get() = addresses
|
||||
override val active get() = parent.binder?.isActive(iface) == true
|
||||
}
|
||||
|
||||
private val addresses = parent.ifaceLookup[iface]?.formatAddresses() ?: ""
|
||||
private val addresses = parent.ifaceLookup[iface] ?.formatAddresses(parent.binder?.isInactive(iface) == true) ?: ""
|
||||
override val type get() = VIEW_TYPE_INTERFACE
|
||||
private val data = Data()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user