|
|
@ -66,23 +66,21 @@ class CheckmarkWidgetView : HabitWidgetView {
|
|
|
|
val res = StyledResources(context)
|
|
|
|
val res = StyledResources(context)
|
|
|
|
val bgColor: Int
|
|
|
|
val bgColor: Int
|
|
|
|
val fgColor: Int
|
|
|
|
val fgColor: Int
|
|
|
|
|
|
|
|
setShadowAlpha(0x4f)
|
|
|
|
when (entryState) {
|
|
|
|
when (entryState) {
|
|
|
|
YES_MANUAL, SKIP -> {
|
|
|
|
YES_MANUAL, SKIP -> {
|
|
|
|
bgColor = activeColor
|
|
|
|
bgColor = activeColor
|
|
|
|
fgColor = res.getColor(R.attr.contrast0)
|
|
|
|
fgColor = res.getColor(R.attr.contrast0)
|
|
|
|
setShadowAlpha(0x4f)
|
|
|
|
|
|
|
|
backgroundPaint!!.color = bgColor
|
|
|
|
backgroundPaint!!.color = bgColor
|
|
|
|
frame!!.setBackgroundDrawable(background)
|
|
|
|
frame!!.setBackgroundDrawable(background)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
YES_AUTO, NO, UNKNOWN -> {
|
|
|
|
YES_AUTO, NO, UNKNOWN -> {
|
|
|
|
bgColor = res.getColor(R.attr.cardBgColor)
|
|
|
|
bgColor = res.getColor(R.attr.cardBgColor)
|
|
|
|
fgColor = res.getColor(R.attr.contrast60)
|
|
|
|
fgColor = res.getColor(R.attr.contrast60)
|
|
|
|
setShadowAlpha(0x00)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else -> {
|
|
|
|
else -> {
|
|
|
|
bgColor = res.getColor(R.attr.cardBgColor)
|
|
|
|
bgColor = res.getColor(R.attr.cardBgColor)
|
|
|
|
fgColor = res.getColor(R.attr.contrast60)
|
|
|
|
fgColor = res.getColor(R.attr.contrast60)
|
|
|
|
setShadowAlpha(0x00)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ring.setPercentage(percentage)
|
|
|
|
ring.setPercentage(percentage)
|
|
|
@ -126,7 +124,7 @@ class CheckmarkWidgetView : HabitWidgetView {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
width = min(width, height)
|
|
|
|
width = min(width, height)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
val textSize = min(0.2f * width, getDimension(context, R.dimen.smallerTextSize))
|
|
|
|
val textSize = min(0.175f * width, getDimension(context, R.dimen.smallTextSize))
|
|
|
|
label.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
|
|
|
label.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
|
|
|
if (isNumerical) {
|
|
|
|
if (isNumerical) {
|
|
|
|
ring.setTextSize(textSize * 0.9f)
|
|
|
|
ring.setTextSize(textSize * 0.9f)
|
|
|
@ -141,7 +139,8 @@ class CheckmarkWidgetView : HabitWidgetView {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun init() {
|
|
|
|
private fun init() {
|
|
|
|
val appComponent: HabitsApplicationComponent = (context.applicationContext as HabitsApplication).component
|
|
|
|
val appComponent: HabitsApplicationComponent =
|
|
|
|
|
|
|
|
(context.applicationContext as HabitsApplication).component
|
|
|
|
preferences = appComponent.preferences
|
|
|
|
preferences = appComponent.preferences
|
|
|
|
ring = findViewById<View>(R.id.scoreRing) as RingView
|
|
|
|
ring = findViewById<View>(R.id.scoreRing) as RingView
|
|
|
|
label = findViewById<View>(R.id.label) as TextView
|
|
|
|
label = findViewById<View>(R.id.label) as TextView
|
|
|
|