Refine code style
This commit is contained in:
@@ -30,7 +30,7 @@ import be.mygod.vpnhotspot.net.IpNeighbourMonitor
|
|||||||
import be.mygod.vpnhotspot.net.TetheringManager
|
import be.mygod.vpnhotspot.net.TetheringManager
|
||||||
import be.mygod.vpnhotspot.net.TetherType
|
import be.mygod.vpnhotspot.net.TetherType
|
||||||
import be.mygod.vpnhotspot.net.wifi.P2pSupplicantConfiguration
|
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.NetworkInterface
|
||||||
import java.net.SocketException
|
import java.net.SocketException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -248,8 +248,8 @@ class RepeaterFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClickL
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (wifi.preSharedKey != null && wifi.preSharedKey.length >= 8) {
|
if (wifi.preSharedKey != null && wifi.preSharedKey.length >= 8) {
|
||||||
var dialog: WifiApDialog? = null
|
var dialog: WifiP2pDialog? = null
|
||||||
dialog = WifiApDialog(context, DialogInterface.OnClickListener { _, which ->
|
dialog = WifiP2pDialog(context, DialogInterface.OnClickListener { _, which ->
|
||||||
when (which) {
|
when (which) {
|
||||||
DialogInterface.BUTTON_POSITIVE -> when (conf.update(dialog!!.config!!)) {
|
DialogInterface.BUTTON_POSITIVE -> when (conf.update(dialog!!.config!!)) {
|
||||||
true -> binder.requestGroupUpdate()
|
true -> binder.requestGroupUpdate()
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ class P2pSupplicantConfiguration {
|
|||||||
Log.w(TAG, "Invalid conf ($ssidFound, $pskFound): $content")
|
Log.w(TAG, "Invalid conf ($ssidFound, $pskFound): $content")
|
||||||
return false
|
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 {
|
} finally {
|
||||||
if (!tempFile.delete()) tempFile.deleteOnExit()
|
if (!tempFile.delete()) tempFile.deleteOnExit()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
* 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,
|
class WifiP2pDialog(mContext: Context, private val mListener: DialogInterface.OnClickListener,
|
||||||
private val mWifiConfig: WifiConfiguration?) : AlertDialog(mContext), View.OnClickListener, TextWatcher {
|
private val mWifiConfig: WifiConfiguration?) :
|
||||||
|
AlertDialog(mContext), View.OnClickListener, TextWatcher {
|
||||||
companion object {
|
companion object {
|
||||||
private const val BUTTON_SUBMIT = DialogInterface.BUTTON_POSITIVE
|
private const val BUTTON_SUBMIT = DialogInterface.BUTTON_POSITIVE
|
||||||
}
|
}
|
||||||
@@ -14,9 +14,6 @@
|
|||||||
<string name="repeater_configure">设置 WLAN 中继</string>
|
<string name="repeater_configure">设置 WLAN 中继</string>
|
||||||
<string name="repeater_configure_failure">未能找到有效的档案。请尝试先打开中继。</string>
|
<string name="repeater_configure_failure">未能找到有效的档案。请尝试先打开中继。</string>
|
||||||
<string name="repeater_reset_credentials">重置</string>
|
<string name="repeater_reset_credentials">重置</string>
|
||||||
<string name="repeater_reset_credentials_dialog_message">Android
|
|
||||||
系统将在下次打开中继时生成新的中继名称和密码。该操作不可撤销。</string>
|
|
||||||
<string name="repeater_reset_credentials_dialog_reset">重置</string>
|
|
||||||
<string name="repeater_reset_credentials_success">凭据已重置。</string>
|
<string name="repeater_reset_credentials_success">凭据已重置。</string>
|
||||||
<string name="repeater_reset_credentials_failure">重置凭据失败(原因:%s)</string>
|
<string name="repeater_reset_credentials_failure">重置凭据失败(原因:%s)</string>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user