Update dependencies

This commit is contained in:
Mygod
2018-08-08 15:12:48 +08:00
parent edede5793e
commit b0d2db2d2d
9 changed files with 17 additions and 16 deletions

View File

@@ -6,7 +6,7 @@ buildscript {
ext { ext {
androidPluginVersion = '3.2.0-beta05' androidPluginVersion = '3.2.0-beta05'
kotlinVersion = '1.2.60' kotlinVersion = '1.2.60'
androidxVersion = '1.0.0-beta01' androidxVersion = '1.0.0-rc01'
} }
repositories { repositories {
google() google()

View File

@@ -4,7 +4,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
android { android {
buildToolsVersion "28.0.1" buildToolsVersion "28.0.2"
compileSdkVersion 28 compileSdkVersion 28
defaultConfig { defaultConfig {
applicationId "be.mygod.vpnhotspot" applicationId "be.mygod.vpnhotspot"

View File

@@ -21,8 +21,9 @@ class ClientMonitorService : Service(), ServiceConnection, IpNeighbourMonitor.Ca
private var tetheredInterfaces = emptySet<String>() private var tetheredInterfaces = emptySet<String>()
private val receiver = broadcastReceiver { _, intent -> private val receiver = broadcastReceiver { _, intent ->
tetheredInterfaces = TetheringManager.getTetheredIfaces(intent.extras).toSet() + val extras = intent.extras!!
TetheringManager.getLocalOnlyTetheredIfaces(intent.extras) tetheredInterfaces = TetheringManager.getTetheredIfaces(extras).toSet() +
TetheringManager.getLocalOnlyTetheredIfaces(extras)
populateClients() populateClients()
} }

View File

@@ -92,7 +92,7 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic
.setNegativeButton(android.R.string.cancel, null) .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() .create()
dialog.window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE) dialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
dialog.show() dialog.show()
} }

View File

@@ -113,6 +113,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
TetheringManager.TETHER_ERROR_ENABLE_NAT_ERROR -> "TETHER_ERROR_ENABLE_NAT_ERROR" TetheringManager.TETHER_ERROR_ENABLE_NAT_ERROR -> "TETHER_ERROR_ENABLE_NAT_ERROR"
TetheringManager.TETHER_ERROR_DISABLE_NAT_ERROR -> "TETHER_ERROR_DISABLE_NAT_ERROR" TetheringManager.TETHER_ERROR_DISABLE_NAT_ERROR -> "TETHER_ERROR_DISABLE_NAT_ERROR"
TetheringManager.TETHER_ERROR_IFACE_CFG_ERROR -> "TETHER_ERROR_IFACE_CFG_ERROR" TetheringManager.TETHER_ERROR_IFACE_CFG_ERROR -> "TETHER_ERROR_IFACE_CFG_ERROR"
TetheringManager.TETHER_ERROR_PROVISION_FAILED -> "TETHER_ERROR_PROVISION_FAILED"
else -> app.getString(R.string.failure_reason_unknown, error) else -> app.getString(R.string.failure_reason_unknown, error)
} }
} catch (e: SecurityException) { } catch (e: SecurityException) {

View File

@@ -88,9 +88,10 @@ class TetheringFragment : Fragment(), ServiceConnection {
var tetheringBinder: TetheringService.Binder? = null var tetheringBinder: TetheringService.Binder? = null
val adapter = ManagerAdapter() val adapter = ManagerAdapter()
private val receiver = broadcastReceiver { _, intent -> private val receiver = broadcastReceiver { _, intent ->
adapter.update(TetheringManager.getTetheredIfaces(intent.extras), val extras = intent.extras!!
TetheringManager.getLocalOnlyTetheredIfaces(intent.extras), adapter.update(TetheringManager.getTetheredIfaces(extras),
intent.extras.getStringArrayList(TetheringManager.EXTRA_ERRORED_TETHER)) TetheringManager.getLocalOnlyTetheredIfaces(extras),
extras.getStringArrayList(TetheringManager.EXTRA_ERRORED_TETHER)!!)
} }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {

View File

@@ -63,12 +63,10 @@ data class IpNeighbour(val ip: String, val dev: String, val lladdr: String, val
private var arpCacheTime = -ARP_CACHE_EXPIRE private var arpCacheTime = -ARP_CACHE_EXPIRE
private fun arp(): List<List<String>> { private fun arp(): List<List<String>> {
if (System.nanoTime() - arpCacheTime >= ARP_CACHE_EXPIRE) try { if (System.nanoTime() - arpCacheTime >= ARP_CACHE_EXPIRE) try {
arpCache = File("/proc/net/arp").bufferedReader().useLines { arpCache = File("/proc/net/arp").bufferedReader().readLines()
it.map { it.split(spaces) } .map { it.split(spaces) }
.drop(1) .drop(1)
.filter { it.size >= 6 && mac.matcher(it[ARP_HW_ADDRESS]).matches() } .filter { it.size >= 6 && mac.matcher(it[ARP_HW_ADDRESS]).matches() }
.toList()
}
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
Crashlytics.logException(e) Crashlytics.logException(e)

View File

@@ -55,7 +55,7 @@ class WifiP2pDialogFragment : DialogFragment(), TextWatcher, DialogInterface.OnC
setNegativeButton(context.getString(R.string.wifi_cancel), this@WifiP2pDialogFragment) setNegativeButton(context.getString(R.string.wifi_cancel), this@WifiP2pDialogFragment)
setNeutralButton(context.getString(R.string.repeater_reset_credentials), this@WifiP2pDialogFragment) setNeutralButton(context.getString(R.string.repeater_reset_credentials), this@WifiP2pDialogFragment)
val arguments = arguments!! val arguments = arguments!!
configurer = arguments.getParcelable(KEY_CONFIGURER) configurer = arguments.getParcelable(KEY_CONFIGURER)!!
val mWifiConfig = arguments.getParcelable<WifiConfiguration>(KEY_CONFIGURATION) val mWifiConfig = arguments.getParcelable<WifiConfiguration>(KEY_CONFIGURATION)
if (mWifiConfig != null) { if (mWifiConfig != null) {
mSsid.text = mWifiConfig.SSID mSsid.text = mWifiConfig.SSID

View File

@@ -76,7 +76,7 @@ object WifiP2pManagerHelper {
WifiP2pManager.Channel::class.java, Int::class.java, WifiP2pManager.ActionListener::class.java) WifiP2pManager.Channel::class.java, Int::class.java, WifiP2pManager.ActionListener::class.java)
} }
fun WifiP2pManager.deletePersistentGroup(c: WifiP2pManager.Channel, netId: Int, fun WifiP2pManager.deletePersistentGroup(c: WifiP2pManager.Channel, netId: Int,
listener: WifiP2pManager.ActionListener) { listener: WifiP2pManager.ActionListener) {
try { try {
deletePersistentGroup.invoke(this, c, netId, listener) deletePersistentGroup.invoke(this, c, netId, listener)
} catch (e: NoSuchMethodException) { } catch (e: NoSuchMethodException) {