I have two ImageView
(up, down) which I want to update in color depending on certain actions. There are three different cases:
up red, down black
up black, down red
up green, down green
I have three functions for changing the colors accordingly that get executed in the correct place (I have a TextView that prints out what is currently called, and the result is as expected), but I found that often they don't work correctly - as in that they only color one ImageView. As I wrote above, those are the three possible cases - however sometimes one imageview is green and the other red, or both imageviews are red, or only one imageview is green despite being in the up green, down green
case - which shouldn't happen. Here are the functions:
/** 17170452 = green
* 17170444 = black
* 17170455 = red
*/
@SuppressLint("ResourceType")
override fun colorTuned() {
DrawableCompat.setTint(down.drawable, ContextCompat.getColor(applicationContext, 17170452))
DrawableCompat.setTint(up.drawable, ContextCompat.getColor(applicationContext, 17170452))
}
@SuppressLint("ResourceType")
override fun colorDown() {
DrawableCompat.setTint(down.drawable, ContextCompat.getColor(applicationContext, 17170455))
DrawableCompat.setTint(up.drawable, ContextCompat.getColor(applicationContext, 17170444))
}
@SuppressLint("ResourceType")
override fun colorUp() {
DrawableCompat.setTint(down.drawable, ContextCompat.getColor(applicationContext, 17170444))
DrawableCompat.setTint(up.drawable, ContextCompat.getColor(applicationContext, 17170455))
}
How can those wrong cases happen here?