mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-29 21:33:07 -08:00
Fix flickering
This commit is contained in:
1 parent
79d11138e6
commit
d46edfc9b7
2 files changed
+12
-6
No files matched your search
@@ -51,7 +51,7 @@ class IconCustomFragment : IconFragment<IconImageCustom>() {
|
||||
iconPickerAdapter.deselectAllIcons()
|
||||
} else {
|
||||
iconActionSelectionMode = true
|
||||
iconPickerAdapter.updateIcons(customIconsSelected)
|
||||
iconPickerAdapter.updateIconSelectedState(customIconsSelected)
|
||||
}
|
||||
}
|
||||
iconPickerViewModel.customIconRemoved.observe(viewLifecycleOwner) { customIconRemoved ->
|
||||
|
||||
@@ -31,15 +31,21 @@ class IconPickerAdapter<I: IconImageDraw>(val context: Context, private val tint
|
||||
}
|
||||
|
||||
fun updateIcon(icon: I) {
|
||||
if (iconList.contains(icon)) {
|
||||
iconList[iconList.indexOf(icon)] = icon
|
||||
notifyItemChanged(iconList.indexOf(icon))
|
||||
val index = iconList.indexOf(icon)
|
||||
if (index != -1) {
|
||||
iconList[index] = icon
|
||||
notifyItemChanged(index)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateIcons(icons: List<I>) {
|
||||
fun updateIconSelectedState(icons: List<I>) {
|
||||
icons.forEach { icon ->
|
||||
updateIcon(icon)
|
||||
val index = iconList.indexOf(icon)
|
||||
if (index != -1
|
||||
&& iconList[index].selected != icon.selected) {
|
||||
iconList[index] = icon
|
||||
notifyItemChanged(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user