Support basic clients count on Android 9-10

This commit is contained in:
Mygod
2021-05-28 22:41:25 -04:00
parent 0796c689d3
commit 257e4497cc
4 changed files with 14 additions and 1 deletions

View File

@@ -168,7 +168,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
} }
override fun onNumClientsChanged(numClients: Int) { override fun onNumClientsChanged(numClients: Int) {
this.numClients = numClients this.numClients = numClients
if (Build.VERSION.SDK_INT >= 30) data.notifyChange() // only emits when onCapabilityChanged can be called data.notifyChange()
} }
override fun onInfoChanged(info: List<Parcelable>) { override fun onInfoChanged(info: List<Parcelable>) {
this.info = info this.info = info
@@ -213,6 +213,9 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
features = features and bit.inv() features = features and bit.inv()
} else yield(parent.getText(R.string.tethering_manage_wifi_no_features)) } else yield(parent.getText(R.string.tethering_manage_wifi_no_features))
}.joinToSpanned()) }.joinToSpanned())
} ?: numClients?.let { numClients ->
app.resources.getQuantityText(R.plurals.tethering_manage_wifi_clients, numClients).format(locale,
numClients)
} }
override val text get() = parent.resources.configuration.locale.let { locale -> override val text get() = parent.resources.configuration.locale.let { locale ->
listOfNotNull(failureReason?.let { WifiApManager.failureReasonLookup(it) }, baseError, info.run { listOfNotNull(failureReason?.let { WifiApManager.failureReasonLookup(it) }, baseError, info.run {

View File

@@ -66,6 +66,9 @@
<plurals name="tethering_manage_wifi_capabilities"> <plurals name="tethering_manage_wifi_capabilities">
<item quantity="other">已连接 %1$s/%2$d 个设备\n支持功能%3$s</item> <item quantity="other">已连接 %1$s/%2$d 个设备\n支持功能%3$s</item>
</plurals> </plurals>
<plurals name="tethering_manage_wifi_clients">
<item quantity="other">已连接 %d 个设备</item>
</plurals>
<string name="tethering_manage_wifi_no_features"></string> <string name="tethering_manage_wifi_no_features"></string>
<string name="tethering_manage_wifi_client_blocked">已屏蔽 %1$s%2$s</string> <string name="tethering_manage_wifi_client_blocked">已屏蔽 %1$s%2$s</string>
<string name="tethering_manage_wifi_copy_mac">复制 MAC</string> <string name="tethering_manage_wifi_copy_mac">复制 MAC</string>

View File

@@ -71,6 +71,9 @@
<plurals name="tethering_manage_wifi_capabilities"> <plurals name="tethering_manage_wifi_capabilities">
<item quantity="other">已連接 %1$s/%2$d 個設備\n支持功能%3$s</item> <item quantity="other">已連接 %1$s/%2$d 個設備\n支持功能%3$s</item>
</plurals> </plurals>
<plurals name="tethering_manage_wifi_clients">
<item quantity="other">已連接 %d 個設備</item>
</plurals>
<string name="tethering_manage_wifi_no_features"></string> <string name="tethering_manage_wifi_no_features"></string>
<string name="tethering_manage_wifi_client_blocked">已隱藏 %1$s%2$s</string> <string name="tethering_manage_wifi_client_blocked">已隱藏 %1$s%2$s</string>
<string name="tethering_manage_wifi_copy_mac">複製 MAC</string> <string name="tethering_manage_wifi_copy_mac">複製 MAC</string>

View File

@@ -78,6 +78,10 @@
<item quantity="one">%1$s/%2$d client connected\nSupported features: %3$s</item> <item quantity="one">%1$s/%2$d client connected\nSupported features: %3$s</item>
<item quantity="other">%1$s/%2$d clients connected\nSupported features: %3$s</item> <item quantity="other">%1$s/%2$d clients connected\nSupported features: %3$s</item>
</plurals> </plurals>
<plurals name="tethering_manage_wifi_clients">
<item quantity="one">%d client connected</item>
<item quantity="other">%1d clients connected</item>
</plurals>
<string name="tethering_manage_wifi_no_features">None</string> <string name="tethering_manage_wifi_no_features">None</string>
<string name="tethering_manage_wifi_client_blocked">Blocked %1$s: %2$s</string> <string name="tethering_manage_wifi_client_blocked">Blocked %1$s: %2$s</string>
<string name="tethering_manage_wifi_copy_mac">Copy MAC</string> <string name="tethering_manage_wifi_copy_mac">Copy MAC</string>