mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-08 10:08:51 -06:00
Use different colors for YES_AUTO and NO; increase contrast slightly
This commit is contained in:
@@ -255,8 +255,8 @@ class FrequencyChart : ScrollableChart {
|
||||
|
||||
private fun initColors() {
|
||||
val res = StyledResources(context)
|
||||
textColor = res.getColor(R.attr.mediumContrastTextColor)
|
||||
gridColor = res.getColor(R.attr.lowContrastTextColor)
|
||||
textColor = res.getColor(R.attr.contrast60)
|
||||
gridColor = res.getColor(R.attr.contrast20)
|
||||
colors = IntArray(4)
|
||||
colors[0] = gridColor
|
||||
colors[3] = primaryColor
|
||||
|
||||
@@ -187,7 +187,7 @@ class RingView : View {
|
||||
pRing!!.textAlign = Paint.Align.CENTER
|
||||
val res = StyledResources(context)
|
||||
if (backgroundColor == null) backgroundColor = res.getColor(R.attr.cardBgColor)
|
||||
if (inactiveColor == null) inactiveColor = res.getColor(R.attr.highContrastTextColor)
|
||||
if (inactiveColor == null) inactiveColor = res.getColor(R.attr.contrast100)
|
||||
inactiveColor = setAlpha(inactiveColor!!, 0.1f)
|
||||
rect = RectF()
|
||||
}
|
||||
|
||||
@@ -334,8 +334,8 @@ class ScoreChart : ScrollableChart {
|
||||
private fun initColors() {
|
||||
val res = StyledResources(context)
|
||||
primaryColor = Color.BLACK
|
||||
textColor = res.getColor(R.attr.mediumContrastTextColor)
|
||||
gridColor = res.getColor(R.attr.lowContrastTextColor)
|
||||
textColor = res.getColor(R.attr.contrast60)
|
||||
gridColor = res.getColor(R.attr.contrast20)
|
||||
internalBackgroundColor = res.getColor(R.attr.cardBgColor)
|
||||
}
|
||||
|
||||
|
||||
@@ -207,11 +207,11 @@ class StreakChart : View {
|
||||
colors[3] = primaryColor
|
||||
colors[2] = Color.argb(192, red, green, blue)
|
||||
colors[1] = Color.argb(96, red, green, blue)
|
||||
colors[0] = res.getColor(R.attr.lowContrastTextColor)
|
||||
colors[0] = res.getColor(R.attr.contrast20)
|
||||
textColors = IntArray(3)
|
||||
textColors[2] = res.getColor(R.attr.highContrastReverseTextColor)
|
||||
textColors[1] = res.getColor(R.attr.mediumContrastTextColor)
|
||||
textColors[0] = res.getColor(R.attr.lowContrastReverseTextColor)
|
||||
textColors[2] = res.getColor(R.attr.contrast0)
|
||||
textColors[1] = res.getColor(R.attr.contrast60)
|
||||
textColors[0] = res.getColor(R.attr.contrast80)
|
||||
}
|
||||
|
||||
private fun initPaints() {
|
||||
|
||||
@@ -165,9 +165,9 @@ class TargetChart : View {
|
||||
paint!!.textAlign = Paint.Align.CENTER
|
||||
paint!!.isAntiAlias = true
|
||||
val res = StyledResources(context)
|
||||
lowContrastTextColor = res.getColor(R.attr.lowContrastTextColor)
|
||||
mediumContrastTextColor = res.getColor(R.attr.mediumContrastTextColor)
|
||||
highContrastReverseTextColor = res.getColor(R.attr.highContrastReverseTextColor)
|
||||
lowContrastTextColor = res.getColor(R.attr.contrast20)
|
||||
mediumContrastTextColor = res.getColor(R.attr.contrast60)
|
||||
highContrastReverseTextColor = res.getColor(R.attr.contrast0)
|
||||
tinyTextSize = getDimension(context, R.dimen.tinyTextSize)
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.isoron.uhabits.core.models.Entry
|
||||
import org.isoron.uhabits.core.models.Entry.Companion.NO
|
||||
import org.isoron.uhabits.core.models.Entry.Companion.SKIP
|
||||
import org.isoron.uhabits.core.models.Entry.Companion.UNKNOWN
|
||||
import org.isoron.uhabits.core.models.Entry.Companion.YES_AUTO
|
||||
import org.isoron.uhabits.core.models.Entry.Companion.YES_MANUAL
|
||||
import org.isoron.uhabits.core.preferences.Preferences
|
||||
import org.isoron.uhabits.inject.ActivityContext
|
||||
@@ -116,7 +117,8 @@ class CheckmarkButtonView(
|
||||
|
||||
private inner class Drawer {
|
||||
private val rect = RectF()
|
||||
private val lowContrastColor = sres.getColor(R.attr.lowContrastTextColor)
|
||||
private val lowContrastColor = sres.getColor(R.attr.contrast40)
|
||||
private val mediumContrastColor = sres.getColor(R.attr.contrast60)
|
||||
|
||||
private val paint = TextPaint().apply {
|
||||
typeface = getFontAwesome()
|
||||
@@ -128,7 +130,12 @@ class CheckmarkButtonView(
|
||||
fun draw(canvas: Canvas) {
|
||||
paint.color = when (value) {
|
||||
YES_MANUAL -> color
|
||||
YES_AUTO -> mediumContrastColor
|
||||
SKIP -> color
|
||||
NO -> {
|
||||
if (preferences.areQuestionMarksEnabled()) mediumContrastColor
|
||||
else lowContrastColor
|
||||
}
|
||||
else -> lowContrastColor
|
||||
}
|
||||
val id = when (value) {
|
||||
|
||||
@@ -47,7 +47,7 @@ class EmptyListView(context: Context) : LinearLayout(context) {
|
||||
typeface = getFontAwesome()
|
||||
textSize = sp(40.0f)
|
||||
gravity = CENTER
|
||||
setTextColor(sres.getColor(R.attr.mediumContrastTextColor))
|
||||
setTextColor(sres.getColor(R.attr.contrast60))
|
||||
}
|
||||
|
||||
addView(
|
||||
@@ -60,7 +60,7 @@ class EmptyListView(context: Context) : LinearLayout(context) {
|
||||
text = str(R.string.no_habits_found)
|
||||
gravity = CENTER
|
||||
setPadding(0, dp(20.0f).toInt(), 0, 0)
|
||||
setTextColor(sres.getColor(R.attr.mediumContrastTextColor))
|
||||
setTextColor(sres.getColor(R.attr.contrast60))
|
||||
}
|
||||
addView(
|
||||
textTextView,
|
||||
|
||||
@@ -212,7 +212,7 @@ class HabitCardView(
|
||||
|
||||
fun getActiveColor(habit: Habit): Int {
|
||||
return when (habit.isArchived) {
|
||||
true -> sres.getColor(R.attr.mediumContrastTextColor)
|
||||
true -> sres.getColor(R.attr.contrast60)
|
||||
false -> habit.color.toThemedAndroidColor(context)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ class HeaderView(
|
||||
textSize = dim(R.dimen.tinyTextSize)
|
||||
textAlign = Paint.Align.CENTER
|
||||
typeface = Typeface.DEFAULT_BOLD
|
||||
color = sres.getColor(R.attr.mediumContrastTextColor)
|
||||
color = sres.getColor(R.attr.contrast60)
|
||||
}
|
||||
|
||||
fun draw(canvas: Canvas) {
|
||||
|
||||
@@ -128,8 +128,8 @@ class NumberButtonView(
|
||||
private val rect: RectF = RectF()
|
||||
private val sr = StyledResources(context)
|
||||
|
||||
private val lightGrey: Int
|
||||
private val darkGrey: Int
|
||||
private val lowContrast: Int
|
||||
private val mediumContrast: Int
|
||||
|
||||
private val pRegular: TextPaint = TextPaint().apply {
|
||||
textSize = getDimension(context, R.dimen.smallerTextSize)
|
||||
@@ -147,14 +147,14 @@ class NumberButtonView(
|
||||
|
||||
init {
|
||||
em = pBold.measureText("m")
|
||||
lightGrey = sr.getColor(R.attr.lowContrastTextColor)
|
||||
darkGrey = sr.getColor(R.attr.mediumContrastTextColor)
|
||||
lowContrast = sr.getColor(R.attr.contrast40)
|
||||
mediumContrast = sr.getColor(R.attr.contrast60)
|
||||
}
|
||||
|
||||
fun draw(canvas: Canvas) {
|
||||
val activeColor = when {
|
||||
value <= 0.0 -> lightGrey
|
||||
value < threshold -> darkGrey
|
||||
value <= 0.0 -> lowContrast
|
||||
value < threshold -> mediumContrast
|
||||
else -> color
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class OverviewCardView(context: Context, attrs: AttributeSet) : LinearLayout(con
|
||||
fun setState(state: OverviewCardState) {
|
||||
val androidColor = state.color.toThemedAndroidColor(context)
|
||||
val res = StyledResources(context)
|
||||
val inactiveColor = res.getColor(R.attr.mediumContrastTextColor)
|
||||
val inactiveColor = res.getColor(R.attr.contrast60)
|
||||
binding.monthDiffLabel.setTextColor(if (state.scoreMonthDiff >= 0) androidColor else inactiveColor)
|
||||
binding.monthDiffLabel.text = formatPercentageDiff(state.scoreMonthDiff)
|
||||
binding.scoreLabel.setTextColor(androidColor)
|
||||
|
||||
@@ -67,19 +67,19 @@ class CheckmarkWidgetView : HabitWidgetView {
|
||||
when (entryState) {
|
||||
YES_MANUAL, SKIP -> {
|
||||
bgColor = activeColor
|
||||
fgColor = res.getColor(R.attr.highContrastReverseTextColor)
|
||||
fgColor = res.getColor(R.attr.contrast0)
|
||||
setShadowAlpha(0x4f)
|
||||
backgroundPaint!!.color = bgColor
|
||||
frame!!.setBackgroundDrawable(background)
|
||||
}
|
||||
YES_AUTO, NO, UNKNOWN -> {
|
||||
bgColor = res.getColor(R.attr.cardBgColor)
|
||||
fgColor = res.getColor(R.attr.mediumContrastTextColor)
|
||||
fgColor = res.getColor(R.attr.contrast60)
|
||||
setShadowAlpha(0x00)
|
||||
}
|
||||
else -> {
|
||||
bgColor = res.getColor(R.attr.cardBgColor)
|
||||
fgColor = res.getColor(R.attr.mediumContrastTextColor)
|
||||
fgColor = res.getColor(R.attr.contrast60)
|
||||
setShadowAlpha(0x00)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user