pull/2222/merge
Vlad Petrushkevich 2 weeks ago committed by GitHub
commit 63333ac6e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -36,12 +36,14 @@ abstract class ButtonPanelView<T : View>(
var buttonCount = 0
set(value) {
if (field == value) return
field = value
inflateButtons()
}
var dataOffset = 0
set(value) {
if (field == value) return
field = value
setupButtons()
}

@ -135,6 +135,7 @@ class CheckmarkButtonView(
private val bgColor = sres.getColor(R.attr.cardBgColor)
private val lowContrastColor = sres.getColor(R.attr.contrast40)
private val mediumContrastColor = sres.getColor(R.attr.contrast60)
private val pNotesIndicator = Paint()
private val paint = TextPaint().apply {
typeface = getFontAwesome()
@ -192,7 +193,13 @@ class CheckmarkButtonView(
canvas.drawText(label, rect.centerX(), rect.centerY(), paint)
}
drawNotesIndicator(canvas, color, em, notes)
drawNotesIndicator(
pNotesIndicator = pNotesIndicator,
canvas = canvas,
color = color,
size = em,
notes = notes,
)
}
}
}

@ -70,6 +70,8 @@ class HabitCardListAdapter @Inject constructor(
* Sets all items as not selected.
*/
override fun clearSelection() {
if (selected.isEmpty()) return
selected.clear()
notifyDataSetChanged()
observable.notifyListeners()

@ -145,6 +145,8 @@ class NumberButtonView(
private val lowContrast: Int
private val mediumContrast: Int
private val pNotesIndicator = Paint()
private val paint = TextPaint().apply {
typeface = getFontAwesome()
isAntiAlias = true
@ -234,7 +236,13 @@ class NumberButtonView(
canvas.drawText(trimmedUnits, rect.centerX(), rect.centerY(), pUnit)
}
drawNotesIndicator(canvas, color, em, notes)
drawNotesIndicator(
pNotesIndicator = pNotesIndicator,
canvas = canvas,
color = color,
size = em,
notes = notes,
)
}
}
}

@ -210,13 +210,18 @@ fun View.sp(value: Float) = InterfaceUtils.spToPixels(context, value)
fun View.dp(value: Float) = InterfaceUtils.dpToPixels(context, value)
fun View.str(id: Int) = resources.getString(id)
fun View.drawNotesIndicator(canvas: Canvas, color: Int, size: Float, notes: String) {
val pNotesIndicator = Paint()
fun View.drawNotesIndicator(
pNotesIndicator: Paint,
canvas: Canvas,
color: Int,
size: Float,
notes: String,
) {
if (notes.isBlank()) return
pNotesIndicator.color = color
if (notes.isNotBlank()) {
val cy = 0.8f * size
canvas.drawCircle(width.toFloat() - cy, cy, 8f, pNotesIndicator)
}
}
val View.sres: StyledResources

Loading…
Cancel
Save