mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix icon selection and icon removed no longer accessible
This commit is contained in:
@@ -34,9 +34,9 @@ class IconStandardFragment : IconFragment<IconImageStandard>() {
|
|||||||
return database.getStandardIconList()
|
return database.getStandardIconList()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onIconLongClickListener(icon: IconImageStandard) {
|
override fun onIconClickListener(icon: IconImageStandard) {
|
||||||
iconPickerViewModel.pickStandardIcon(icon)
|
iconPickerViewModel.pickStandardIcon(icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onIconClickListener(icon: IconImageStandard) {}
|
override fun onIconLongClickListener(icon: IconImageStandard) {}
|
||||||
}
|
}
|
||||||
@@ -66,22 +66,23 @@ class IconDrawableFactory(private val retrieveCipherKey : () -> Database.LoadedK
|
|||||||
*/
|
*/
|
||||||
private fun getIconSuperDrawable(context: Context, iconDraw: IconImageDraw, width: Int, tintColor: Int = Color.WHITE): SuperDrawable {
|
private fun getIconSuperDrawable(context: Context, iconDraw: IconImageDraw, width: Int, tintColor: Int = Color.WHITE): SuperDrawable {
|
||||||
val icon = iconDraw.getIconImageToDraw()
|
val icon = iconDraw.getIconImageToDraw()
|
||||||
return if (!icon.custom.isUnknown) {
|
if (!icon.custom.isUnknown) {
|
||||||
SuperDrawable(getIconDrawable(context.resources, icon.custom))
|
getIconDrawable(context.resources, icon.custom)?.let {
|
||||||
} else {
|
return SuperDrawable(it)
|
||||||
val iconPack = IconPackChooser.getSelectedIconPack(context)
|
|
||||||
iconPack?.iconToResId(icon.standard.id)?.let { iconId ->
|
|
||||||
SuperDrawable(getIconDrawable(context.resources, iconId, width, tintColor), iconPack.tintable())
|
|
||||||
} ?: run {
|
|
||||||
SuperDrawable(PatternIcon(context.resources).blankDrawable)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val iconPack = IconPackChooser.getSelectedIconPack(context)
|
||||||
|
iconPack?.iconToResId(icon.standard.id)?.let { iconId ->
|
||||||
|
return SuperDrawable(getIconDrawable(context.resources, iconId, width, tintColor), iconPack.tintable())
|
||||||
|
} ?: run {
|
||||||
|
return SuperDrawable(PatternIcon(context.resources).blankDrawable)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a custom [Drawable] from custom [icon]
|
* Build a custom [Drawable] from custom [icon]
|
||||||
*/
|
*/
|
||||||
private fun getIconDrawable(resources: Resources, icon: IconImageCustom): Drawable {
|
private fun getIconDrawable(resources: Resources, icon: IconImageCustom): Drawable? {
|
||||||
val patternIcon = PatternIcon(resources)
|
val patternIcon = PatternIcon(resources)
|
||||||
val cipherKey = retrieveCipherKey.invoke()
|
val cipherKey = retrieveCipherKey.invoke()
|
||||||
if (cipherKey != null) {
|
if (cipherKey != null) {
|
||||||
@@ -93,12 +94,14 @@ class IconDrawableFactory(private val retrieveCipherKey : () -> Database.LoadedK
|
|||||||
val createdDraw = BitmapDrawable(resources, bitmap)
|
val createdDraw = BitmapDrawable(resources, bitmap)
|
||||||
customIconMap[icon.uuid] = WeakReference(createdDraw)
|
customIconMap[icon.uuid] = WeakReference(createdDraw)
|
||||||
return createdDraw
|
return createdDraw
|
||||||
|
} ?: run {
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return draw
|
return draw
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return patternIcon.blankDrawable
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user