Update dependencies

This commit is contained in:
Mygod
2018-06-23 18:59:31 +08:00
parent b49ea8635b
commit 2488a528a3
6 changed files with 22 additions and 19 deletions

View File

@@ -18,7 +18,7 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:$androidPluginVersion"
classpath 'com.github.ben-manes:gradle-versions-plugin:0.18.0'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.25.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip

View File

@@ -74,10 +74,10 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
fun requestGroupUpdate() {
group = null
try {
p2pManager.requestPersistentGroupInfo(channel, {
p2pManager.requestPersistentGroupInfo(channel) {
groups = it
if (it.size == 1) group = it.single()
})
}
} catch (e: ReflectiveOperationException) {
e.printStackTrace()
Crashlytics.logException(e)
@@ -186,7 +186,7 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
registerReceiver(receiver, intentFilter(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION,
WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION))
receiverRegistered = true
p2pManager.requestGroupInfo(channel, {
p2pManager.requestGroupInfo(channel) {
when {
it == null -> doStart()
it.isGroupOwner -> if (routingManager == null) doStart(it)
@@ -202,7 +202,7 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
})
}
}
})
}
}
else -> startFailure(getString(R.string.repeater_p2p_unavailable))
}

View File

@@ -89,10 +89,12 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic
val dialog = AlertDialog.Builder(parent.requireContext())
.setTitle(R.string.repeater_wps_dialog_title)
.setView(R.layout.dialog_wps)
.setPositiveButton(android.R.string.ok, { dialog, _ -> binder?.startWps((dialog as AppCompatDialog)
.findViewById<EditText>(android.R.id.edit)!!.text.toString()) })
.setPositiveButton(android.R.string.ok) { dialog, _ ->
binder?.startWps((dialog as AppCompatDialog)
.findViewById<EditText>(android.R.id.edit)!!.text.toString())
}
.setNegativeButton(android.R.string.cancel, null)
.setNeutralButton(R.string.repeater_wps_dialog_pbc, { _, _ -> binder?.startWps(null) })
.setNeutralButton(R.string.repeater_wps_dialog_pbc) { _, _ -> binder?.startWps(null) }
.create()
dialog.window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
dialog.show()

View File

@@ -105,16 +105,16 @@ object WifiP2pManagerHelper {
fun WifiP2pManager.requestPersistentGroupInfo(c: WifiP2pManager.Channel,
listener: (Collection<WifiP2pGroup>) -> Unit) {
val proxy = Proxy.newProxyInstance(interfacePersistentGroupInfoListener.classLoader,
arrayOf(interfacePersistentGroupInfoListener), { proxy, method, args ->
if (method.name == "onPersistentGroupInfoAvailable") {
if (args.size != 1) Crashlytics.log(Log.WARN, TAG, "Unexpected args: $args")
listener(getGroupList.invoke(args[0]) as Collection<WifiP2pGroup>)
null
} else {
Crashlytics.log(Log.WARN, TAG, "Unexpected method, calling super: $method")
ProxyBuilder.callSuper(proxy, method, args)
}
})
arrayOf(interfacePersistentGroupInfoListener)) { proxy, method, args ->
if (method.name == "onPersistentGroupInfoAvailable") {
if (args.size != 1) Crashlytics.log(Log.WARN, TAG, "Unexpected args: $args")
listener(getGroupList.invoke(args[0]) as Collection<WifiP2pGroup>)
null
} else {
Crashlytics.log(Log.WARN, TAG, "Unexpected method, calling super: $method")
ProxyBuilder.callSuper(proxy, method, args)
}
}
requestPersistentGroupInfo.invoke(this, c, proxy)
}

View File

@@ -11,6 +11,7 @@
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:inputType="number"
android:importantForAutofill="no"
tools:text="12345678">
<requestFocus/>
</EditText>