Color the icon itself, not the background

This commit is contained in:
Naveen 2022-10-12 03:14:12 +05:30
parent 5be7d50402
commit 2fecf237a3

View file

@ -40,6 +40,7 @@ import java.io.ByteArrayOutputStream
import java.io.File
import java.io.OutputStream
class MainActivity : SimpleActivity(), CanvasListener {
private val PICK_IMAGE_INTENT = 1
private val SAVE_IMAGE_INTENT = 2
@ -416,16 +417,10 @@ class MainActivity : SimpleActivity(), CanvasListener {
).forEach {
val view = it.first
val enabled = it.second
view.apply {
if (enabled) {
val primaryColor = getProperPrimaryColor()
background = ColorDrawable(primaryColor).apply { alpha = 220 }
applyColorFilter(primaryColor.getContrastColor())
} else {
background = null
applyColorFilter(config.canvasBackgroundColor.getContrastColor())
}
if (enabled) {
view.applyColorFilter(getProperPrimaryColor())
} else {
view.applyColorFilter(config.canvasBackgroundColor.getContrastColor())
}
}
}