mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
CheckmarkDialog: Always set up all buttons
This commit is contained in:
@@ -79,29 +79,25 @@ class CheckmarkDialog
|
|||||||
private fun setUpButtons(value: Int, color: Int) {
|
private fun setUpButtons(value: Int, color: Int) {
|
||||||
val sres = StyledResources(context)
|
val sres = StyledResources(context)
|
||||||
val mediumContrastColor = sres.getColor(R.attr.contrast60)
|
val mediumContrastColor = sres.getColor(R.attr.contrast60)
|
||||||
|
|
||||||
setButtonAttrs(binding.yesBtn, color)
|
setButtonAttrs(binding.yesBtn, color)
|
||||||
setButtonAttrs(binding.noBtn, mediumContrastColor)
|
setButtonAttrs(binding.noBtn, mediumContrastColor)
|
||||||
|
setButtonAttrs(binding.skippedBtn, color, visible = preferences.isSkipEnabled)
|
||||||
if (preferences.isSkipEnabled) {
|
setButtonAttrs(binding.questionBtn, mediumContrastColor, visible = preferences.areQuestionMarksEnabled)
|
||||||
setButtonAttrs(binding.skippedBtn, color)
|
|
||||||
if (value == SKIP) binding.skippedBtn.performClick()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preferences.areQuestionMarksEnabled) {
|
|
||||||
setButtonAttrs(binding.questionBtn, mediumContrastColor)
|
|
||||||
if (value == UNKNOWN) binding.questionBtn.performClick()
|
|
||||||
}
|
|
||||||
|
|
||||||
when (value) {
|
when (value) {
|
||||||
YES_MANUAL, YES_AUTO -> binding.yesBtn.performClick()
|
UNKNOWN -> if (preferences.areQuestionMarksEnabled) {
|
||||||
NO -> binding.noBtn.performClick()
|
binding.questionBtn.performClick()
|
||||||
|
} else {
|
||||||
|
binding.noBtn.performClick()
|
||||||
|
}
|
||||||
|
SKIP -> binding.skippedBtn.performClick()
|
||||||
|
YES_MANUAL -> binding.yesBtn.performClick()
|
||||||
|
YES_AUTO, NO -> binding.noBtn.performClick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setButtonAttrs(button: Button, color: Int) {
|
private fun setButtonAttrs(button: Button, color: Int, visible: Boolean = true) {
|
||||||
button.apply {
|
button.apply {
|
||||||
visibility = View.VISIBLE
|
visibility = if (visible) View.VISIBLE else View.GONE
|
||||||
typeface = fontAwesome
|
typeface = fontAwesome
|
||||||
setTextColor(color)
|
setTextColor(color)
|
||||||
setOnClickListener(this@CheckmarkDialog)
|
setOnClickListener(this@CheckmarkDialog)
|
||||||
|
|||||||
Reference in New Issue
Block a user