diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2022-11-21 00:44:16 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2022-11-21 00:44:16 +0100 |
commit | 83d3873e884d62d6f5b13874ef43197285ef29e1 (patch) | |
tree | ea2dfab12363e207210d75a89cdfdd3c879f5ac5 | |
parent | 74e553368cafd37b99864d6aaa0b9702c4b6139b (diff) |
WIP current changesv1.0.20220516-30-g83d3873e
-rw-r--r-- | ui/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.kt | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ui/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.kt index 1a40a1cd..70321d03 100644 --- a/ui/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.kt +++ b/ui/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.kt @@ -47,12 +47,6 @@ class AppListDialogFragment : DialogFragment() { val appInfo = it.applicationInfo val appData = ApplicationData(appInfo.loadIcon(pm), appInfo.loadLabel(pm).toString(), packageName, currentlySelectedApps.contains(packageName)) applicationData.add(appData) - appData.addOnPropertyChangedCallback(object : Observable.OnPropertyChangedCallback() { - override fun onPropertyChanged(sender: Observable?, propertyId: Int) { - if (propertyId == BR.selected) - setButtonText() - } - }) } } applicationData.sortWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name }) @@ -60,6 +54,16 @@ class AppListDialogFragment : DialogFragment() { appData.clear() appData.addAll(applicationData) } + withContext(Dispatchers.IO) { + appData.forEach() { + it.addOnPropertyChangedCallback(object : Observable.OnPropertyChangedCallback() { + override fun onPropertyChanged(sender: Observable?, propertyId: Int) { + if (propertyId == BR.selected) + setButtonText() + } + }) + } + } } catch (e: Throwable) { withContext(Dispatchers.Main.immediate) { val error = ErrorMessages[e] |