Draft implementation of new SACC elements

This commit is contained in:
Mygod
2022-07-15 23:11:42 -04:00
parent 8ff35f59ed
commit 331358bd14
8 changed files with 315 additions and 57 deletions

View File

@@ -229,30 +229,8 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
if (Build.VERSION.SDK_INT >= 31) {
val list = SoftApConfigurationCompat.BAND_TYPES.map { band ->
val channels = capability.getSupportedChannelList(band)
if (channels.isNotEmpty()) StringBuilder().apply {
append(SoftApConfigurationCompat.bandLookup(band, true))
append(" (")
channels.sort()
var pending: Int? = null
var last = channels[0]
append(last)
for (channel in channels.asSequence().drop(1)) {
if (channel == last + 1) pending = channel else {
pending?.let {
append('-')
append(it)
pending = null
}
append(',')
append(channel)
}
last = channel
}
pending?.let {
append('-')
append(it)
}
append(')')
if (channels.isNotEmpty()) {
"${SoftApConfigurationCompat.bandLookup(band, true)} (${RangeInput.toString(channels)})"
} else null
}.filterNotNull()
if (list.isNotEmpty()) result.append(parent.getText(R.string.tethering_manage_wifi_supported_channels)