Add invert selection to per-app proxy list

This commit is contained in:
2dust
2026-01-13 09:56:28 +08:00
parent d0612619fd
commit 68ed08d36e
11 changed files with 47 additions and 13 deletions
@@ -137,6 +137,11 @@ class PerAppProxyActivity : BaseActivity() {
allowPerAppProxy()
true
}
R.id.invert_selection -> {
invertSelection()
allowPerAppProxy()
true
}
R.id.select_proxy_app -> {
selectProxyAppAuto()
@@ -177,6 +182,20 @@ class PerAppProxyActivity : BaseActivity() {
}
}
private fun invertSelection() {
adapter?.let { adapter ->
adapter.apps.forEach { app ->
val packageName = app.packageName
if (adapter.blacklist.contains(packageName)) {
adapter.blacklist.remove(packageName)
} else {
adapter.blacklist.add(packageName)
}
}
refreshData()
}
}
private fun selectProxyAppAuto() {
toast(R.string.msg_downloading_content)
showLoading()