change text selection handle and background colors in compose screen bubbles to ensure they always have a high(ish) contrast to bubble colours and to match with theme color

This commit is contained in:
gavine99
2025-03-13 14:40:31 +11:00
parent da3de1e67d
commit 7d77690245
@@ -22,6 +22,7 @@ import android.animation.ObjectAnimator
import android.content.Context
import android.graphics.Typeface
import android.net.Uri
import android.os.Build
import android.text.Layout
import android.text.Spannable
import android.text.SpannableString
@@ -49,6 +50,7 @@ import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint
import dev.octoshrimpy.quik.common.util.extensions.setPadding
import dev.octoshrimpy.quik.common.util.extensions.setTint
import dev.octoshrimpy.quik.common.util.extensions.setVisible
import dev.octoshrimpy.quik.common.util.extensions.withAlpha
import dev.octoshrimpy.quik.compat.SubscriptionManagerCompat
import dev.octoshrimpy.quik.extensions.isSmil
import dev.octoshrimpy.quik.extensions.isText
@@ -276,6 +278,19 @@ class MessagesAdapter @Inject constructor(
holder.body.setTextColor(theme.textPrimary)
holder.body.setBackgroundTint(theme.theme)
holder.body.highlightColor = R.attr.bubbleColor.withAlpha(0x5d)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
holder.body.textSelectHandle?.setTint(R.attr.bubbleColor.withAlpha(0x7d))
holder.body.textSelectHandleLeft?.setTint(R.attr.bubbleColor.withAlpha(0x7d))
holder.body.textSelectHandleRight?.setTint(R.attr.bubbleColor.withAlpha(0x7d))
}
} else {
holder.body.highlightColor = theme.theme.withAlpha(0x5d)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
holder.body.textSelectHandle?.setTint(theme.theme.withAlpha(0xad))
holder.body.textSelectHandleLeft?.setTint(theme.theme.withAlpha(0xad))
holder.body.textSelectHandleRight?.setTint(theme.theme.withAlpha(0xad))
}
}
// Bind the body text