fix access control mode & packages

This commit is contained in:
Kr328 committed 2020-02-20 15:02:47 +08:00
1 parent 932778b153
commit a557255099
3 files changed
+14 -2

No files matched your search

@@ -50,7 +50,6 @@ class PackagesActivity : BaseActivity() {
it.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0
)
}
.sorted(compareBy(PackagesAdapter.AppInfo::label))
.toList()
}
}
@@ -73,10 +72,13 @@ class PackagesActivity : BaseActivity() {
progress.visibility = View.GONE
refreshChannel.offer(Unit)
while (isActive) {
refreshChannel.receive()
adapter.applyFilter(keyword, sort, decrease, systemApp)
mainList.scrollToPosition(0)
delay(200)
}
@@ -46,6 +46,16 @@ class PackagesAdapter(private val context: Context,
&& (systemApp || !it.isSystem)
}
.sorted { a, b ->
val sA = selectedPackages.contains(a.packageName)
val sB = selectedPackages.contains(b.packageName)
if ( sA != sB ) {
when {
sA -> return@sorted -1
sB -> return@sorted 1
}
}
val result = when (sort) {
Sort.NAME -> a.label.compareTo(b.label, true)
Sort.PACKAGE -> a.packageName.compareTo(b.packageName)
+1 -1
View File
@@ -23,8 +23,8 @@
</string-array>
<string-array name="access_control_mode_value" translatable="false">
<item>access_control_mode_all</item>
<item>access_control_mode_blacklist</item>
<item>access_control_mode_whitelist</item>
<item>access_control_mode_blacklist</item>
</string-array>
<string-array name="language_value" translatable="false">
<item />