Refine code style

This commit is contained in:
Mygod
2018-04-21 20:28:27 -07:00
parent cfd471202f
commit 2d3e8556fd
4 changed files with 8 additions and 9 deletions

View File

@@ -30,7 +30,7 @@ import be.mygod.vpnhotspot.net.IpNeighbourMonitor
import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.net.wifi.P2pSupplicantConfiguration
import be.mygod.vpnhotspot.net.wifi.WifiApDialog
import be.mygod.vpnhotspot.net.wifi.WifiP2pDialog
import java.net.NetworkInterface
import java.net.SocketException
import java.util.*
@@ -248,8 +248,8 @@ class RepeaterFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClickL
return
}
if (wifi.preSharedKey != null && wifi.preSharedKey.length >= 8) {
var dialog: WifiApDialog? = null
dialog = WifiApDialog(context, DialogInterface.OnClickListener { _, which ->
var dialog: WifiP2pDialog? = null
dialog = WifiP2pDialog(context, DialogInterface.OnClickListener { _, which ->
when (which) {
DialogInterface.BUTTON_POSITIVE -> when (conf.update(dialog!!.config!!)) {
true -> binder.requestGroupUpdate()

View File

@@ -53,7 +53,8 @@ class P2pSupplicantConfiguration {
Log.w(TAG, "Invalid conf ($ssidFound, $pskFound): $content")
return false
}
return noisySu("cat ${tempFile.absolutePath} > /data/misc/wifi/p2p_supplicant.conf", "killall wpa_supplicant")
return noisySu("cat ${tempFile.absolutePath} > /data/misc/wifi/p2p_supplicant.conf",
"killall wpa_supplicant")
} finally {
if (!tempFile.delete()) tempFile.deleteOnExit()
}

View File

@@ -19,8 +19,9 @@ import java.nio.charset.Charset
/**
* https://android.googlesource.com/platform/packages/apps/Settings/+/39b4674/src/com/android/settings/wifi/WifiApDialog.java
*/
class WifiApDialog(mContext: Context, private val mListener: DialogInterface.OnClickListener,
private val mWifiConfig: WifiConfiguration?) : AlertDialog(mContext), View.OnClickListener, TextWatcher {
class WifiP2pDialog(mContext: Context, private val mListener: DialogInterface.OnClickListener,
private val mWifiConfig: WifiConfiguration?) :
AlertDialog(mContext), View.OnClickListener, TextWatcher {
companion object {
private const val BUTTON_SUBMIT = DialogInterface.BUTTON_POSITIVE
}