This commit is contained in:
Mygod
2018-07-14 23:41:58 +08:00
parent 89cbd96280
commit 35bc2b4a75
2 changed files with 7 additions and 8 deletions

View File

@@ -43,13 +43,12 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
private var groups: Collection<WifiP2pGroup> = emptyList() private var groups: Collection<WifiP2pGroup> = emptyList()
fun startWps(pin: String? = null) { fun startWps(pin: String? = null) {
if (!active) return if (active) p2pManager.startWps(channel, WpsInfo().apply {
val wps = WpsInfo() setup = if (pin == null) WpsInfo.PBC else {
if (pin == null) wps.setup = WpsInfo.PBC else { this.pin = pin
wps.setup = WpsInfo.KEYPAD WpsInfo.KEYPAD
wps.pin = pin }
} }, object : WifiP2pManager.ActionListener {
p2pManager.startWps(channel, wps, object : WifiP2pManager.ActionListener {
override fun onSuccess() = Toast.makeText(this@RepeaterService, override fun onSuccess() = Toast.makeText(this@RepeaterService,
if (pin == null) R.string.repeater_wps_success_pbc else R.string.repeater_wps_success_keypad, if (pin == null) R.string.repeater_wps_success_pbc else R.string.repeater_wps_success_keypad,
Toast.LENGTH_SHORT).show() Toast.LENGTH_SHORT).show()

View File

@@ -25,7 +25,7 @@ import be.mygod.vpnhotspot.util.setPaddingStart
import com.crashlytics.android.Crashlytics import com.crashlytics.android.Crashlytics
import java.lang.reflect.InvocationTargetException import java.lang.reflect.InvocationTargetException
abstract class TetherManager private constructor(protected val parent: TetheringFragment) : Manager(), sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
TetheringManager.OnStartTetheringCallback { TetheringManager.OnStartTetheringCallback {
class ViewHolder(val binding: ListitemInterfaceBinding) : RecyclerView.ViewHolder(binding.root), class ViewHolder(val binding: ListitemInterfaceBinding) : RecyclerView.ViewHolder(binding.root),
View.OnClickListener { View.OnClickListener {