Fix typing indicator rendering.

This commit is contained in:
Alex Hart 2023-08-21 14:22:08 -03:00
parent acb24fd265
commit 372104cdfe
3 changed files with 9 additions and 10 deletions

View file

@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.components
import android.content.Context
import android.graphics.Canvas
import android.graphics.Path
import android.graphics.Rect
import android.graphics.RectF
import android.util.AttributeSet
import androidx.core.graphics.withClip
@ -18,15 +17,15 @@ class ClippedCardView @JvmOverloads constructor(
attrs: AttributeSet? = null
) : MaterialCardView(context, attrs) {
private val bounds = Rect()
private val boundsF = RectF()
private val path = Path()
override fun draw(canvas: Canvas) {
canvas.getClipBounds(bounds)
boundsF.set(bounds)
path.reset()
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
boundsF.set(0f, 0f, w.toFloat(), h.toFloat())
}
override fun draw(canvas: Canvas) {
path.reset()
path.addRoundRect(boundsF, radius, radius, Path.Direction.CW)
canvas.withClip(path) {
super.draw(canvas)

View file

@ -141,8 +141,8 @@ class TypingIndicatorDecoration(
layout(
0,
0,
typingView.measuredWidth,
typingView.measuredHeight
measuredWidth,
measuredHeight
)
}
}

View file

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.components.ConversationTypingView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:viewBindingIgnore="true"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingStart="8dp"
android:paddingTop="2dp"
android:paddingEnd="8dp"
android:paddingBottom="8dp"
android:paddingEnd="8dp">
tools:viewBindingIgnore="true">
<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/typing_avatar_1"