diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt index 1cc12484..4c8ec1ad 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt @@ -207,10 +207,8 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic ssid = group.networkName securityType = SoftApConfiguration.SECURITY_TYPE_WPA2_PSK // is not actually used passphrase = config.psk - if (Build.VERSION.SDK_INT >= 23) { - band = SoftApConfigurationCompat.BAND_ANY - channel = RepeaterService.operatingChannel - } + band = SoftApConfigurationCompat.BAND_ANY + channel = RepeaterService.operatingChannel bssid = RepeaterService.deviceAddress } } catch (e: RuntimeException) { @@ -241,7 +239,7 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic } holder.config = null } - if (Build.VERSION.SDK_INT >= 23) RepeaterService.operatingChannel = config.channel + RepeaterService.operatingChannel = config.channel RepeaterService.deviceAddress = config.bssid } } diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt index aebf9460..c38ffd33 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt @@ -50,7 +50,6 @@ class WifiApDialogFragment : AlertDialogFragment= 23) { - val bandOption = dialogView.band.selectedItem as BandOption - band = bandOption.band - channel = bandOption.channel - } + val bandOption = dialogView.band.selectedItem as BandOption + band = bandOption.band + channel = bandOption.channel }) override fun AlertDialog.Builder.prepare(listener: DialogInterface.OnClickListener) { @@ -131,16 +128,13 @@ class WifiApDialogFragment : AlertDialogFragment= 28) add(BandOption.BandAny) add(BandOption.Band2GHz) add(BandOption.Band5GHz) - if (BuildCompat.isAtLeastR()) add (BandOption.Band6GHz) + if (BuildCompat.isAtLeastR()) add(BandOption.Band6GHz) } addAll(channels) } adapter = ArrayAdapter(activity, android.R.layout.simple_spinner_item, 0, bandOptions).apply { setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) } - if (Build.VERSION.SDK_INT < 23) { - setSelection(bandOptions.indexOfFirst { it.channel == RepeaterService.operatingChannel }) - } } else dialogView.bandWrapper.isGone = true if (!arg.readOnly) dialogView.bssid.addTextChangedListener(this@WifiApDialogFragment) if (arg.p2pMode) dialogView.hiddenSsid.isGone = true @@ -151,11 +145,9 @@ class WifiApDialogFragment : AlertDialogFragment= 23) { - dialogView.band.setSelection(if (configuration.channel in 1..165) { - bandOptions.indexOfFirst { it.channel == configuration.channel } - } else bandOptions.indexOfFirst { it.band == configuration.band }) - } + dialogView.band.setSelection(if (configuration.channel in 1..165) { + bandOptions.indexOfFirst { it.channel == configuration.channel } + } else bandOptions.indexOfFirst { it.band == configuration.band }) dialogView.bssid.setText(configuration.bssid?.toString()) dialogView.hiddenSsid.isChecked = configuration.isHiddenSsid // TODO support more fields from SACC @@ -233,11 +225,4 @@ class WifiApDialogFragment : AlertDialogFragment false } } - - override fun onClick(dialog: DialogInterface?, which: Int) { - super.onClick(dialog, which) - if (Build.VERSION.SDK_INT < 23 && arg.p2pMode && which == DialogInterface.BUTTON_POSITIVE) { - RepeaterService.operatingChannel = (dialogView.band.selectedItem as BandOption).channel - } - } }