mirror of
https://github.com/pachli/pachli-android.git
synced 2025-01-29 00:30:22 +01:00
fix: Ensure poll option text is visible against the background (#86)
Draw poll bars using the container colour variants to ensure that the text drawn on top is also visible against the background. Fixes #85
This commit is contained in:
parent
5fd15852fb
commit
0b74b073a4
@ -97,12 +97,14 @@ class PollAdapter : RecyclerView.Adapter<BindingHolder<ItemPollBinding>>() {
|
||||
val level = percent * 100
|
||||
val optionColor: Int
|
||||
val textColor: Int
|
||||
// Use the "container" colours to ensure the text is visible on the container
|
||||
// and on the background, per https://github.com/pachli/pachli-android/issues/85
|
||||
if (option.voted) {
|
||||
optionColor = MaterialColors.getColor(resultTextView, com.google.android.material.R.attr.colorPrimary)
|
||||
textColor = MaterialColors.getColor(resultTextView, com.google.android.material.R.attr.colorOnPrimary)
|
||||
optionColor = MaterialColors.getColor(resultTextView, com.google.android.material.R.attr.colorPrimaryContainer)
|
||||
textColor = MaterialColors.getColor(resultTextView, com.google.android.material.R.attr.colorOnPrimaryContainer)
|
||||
} else {
|
||||
optionColor = MaterialColors.getColor(resultTextView, com.google.android.material.R.attr.colorSecondary)
|
||||
textColor = MaterialColors.getColor(resultTextView, com.google.android.material.R.attr.colorOnSecondary)
|
||||
optionColor = MaterialColors.getColor(resultTextView, com.google.android.material.R.attr.colorSecondaryContainer)
|
||||
textColor = MaterialColors.getColor(resultTextView, com.google.android.material.R.attr.colorOnSecondaryContainer)
|
||||
}
|
||||
|
||||
resultTextView.background.level = level
|
||||
|
Loading…
x
Reference in New Issue
Block a user