Refine code style
This commit is contained in:
@@ -46,32 +46,31 @@ class WifiP2pDialogFragment : DialogFragment(), TextWatcher, DialogInterface.OnC
|
|||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): AlertDialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): AlertDialog =
|
||||||
return AlertDialog.Builder(requireContext()).apply {
|
AlertDialog.Builder(requireContext()).apply {
|
||||||
mView = requireActivity().layoutInflater.inflate(R.layout.dialog_wifi_ap, null)
|
mView = requireActivity().layoutInflater.inflate(R.layout.dialog_wifi_ap, null)
|
||||||
setView(mView)
|
setView(mView)
|
||||||
setTitle(R.string.repeater_configure)
|
setTitle(R.string.repeater_configure)
|
||||||
mSsid = mView.findViewById(R.id.ssid)
|
mSsid = mView.findViewById(R.id.ssid)
|
||||||
mPassword = mView.findViewById(R.id.password)
|
mPassword = mView.findViewById(R.id.password)
|
||||||
// Note: Reading persistent group information in p2p_supplicant.conf wasn't available until this commit:
|
// Note: Reading persistent group information in p2p_supplicant.conf wasn't available until this commit:
|
||||||
// https://android.googlesource.com/platform/external/wpa_supplicant_8/+/216983bceec7c450951e2fbcd076b5c75d432e57%5E%21/
|
// https://android.googlesource.com/platform/external/wpa_supplicant_8/+/216983bceec7c450951e2fbcd076b5c75d432e57%5E%21/
|
||||||
// which isn't merged until Android 6.0.
|
// which isn't merged until Android 6.0.
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
setPositiveButton(context.getString(R.string.wifi_save), this@WifiP2pDialogFragment)
|
setPositiveButton(context.getString(R.string.wifi_save), this@WifiP2pDialogFragment)
|
||||||
}
|
}
|
||||||
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
|
||||||
mPassword.setText(mWifiConfig.preSharedKey)
|
mPassword.setText(mWifiConfig.preSharedKey)
|
||||||
}
|
}
|
||||||
mSsid.addTextChangedListener(this@WifiP2pDialogFragment)
|
mSsid.addTextChangedListener(this@WifiP2pDialogFragment)
|
||||||
mPassword.addTextChangedListener(this@WifiP2pDialogFragment)
|
mPassword.addTextChangedListener(this@WifiP2pDialogFragment)
|
||||||
}.create()
|
}.create()
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
@@ -101,9 +100,8 @@ class WifiP2pDialogFragment : DialogFragment(), TextWatcher, DialogInterface.OnC
|
|||||||
false -> (activity as MainActivity).snackbar().setText(R.string.noisy_su_failure).show()
|
false -> (activity as MainActivity).snackbar().setText(R.string.noisy_su_failure).show()
|
||||||
null -> (activity as MainActivity).snackbar().setText(R.string.root_unavailable).show()
|
null -> (activity as MainActivity).snackbar().setText(R.string.root_unavailable).show()
|
||||||
}
|
}
|
||||||
DialogInterface.BUTTON_NEUTRAL -> {
|
DialogInterface.BUTTON_NEUTRAL ->
|
||||||
(targetFragment as TetheringFragment).adapter.repeaterManager.binder!!.resetCredentials()
|
(targetFragment as TetheringFragment).adapter.repeaterManager.binder!!.resetCredentials()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user