mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Changed mentions color in chat bubble to app's primary
This commit is contained in:
parent
e306c8c7fc
commit
57644a34de
2 changed files with 15 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ import android.os.CountDownTimer
|
|||
import android.text.Spannable
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.Spanned
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.StyleSpan
|
||||
import androidx.annotation.AnyThread
|
||||
import androidx.annotation.UiThread
|
||||
|
|
@ -744,6 +745,13 @@ class MessageModel
|
|||
start + offset + displayName.length + 1,
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
// Change color
|
||||
spannableBuilder.setSpan(
|
||||
ForegroundColorSpan(AppUtils.getColorInt(R.color.orange_main_500)),
|
||||
start + offset,
|
||||
start + offset + displayName.length + 1,
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
offset += displayName.length - source.length
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,11 +27,13 @@ import android.util.DisplayMetrics
|
|||
import android.util.Rational
|
||||
import android.view.View
|
||||
import androidx.annotation.AnyThread
|
||||
import androidx.annotation.ColorRes
|
||||
import androidx.annotation.DimenRes
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.annotation.PluralsRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.SoftwareKeyboardControllerCompat
|
||||
import java.util.Locale
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
|
|
@ -84,6 +86,11 @@ class AppUtils {
|
|||
return coreContext.context.resources.getQuantityString(id, count, value)
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
fun getColorInt(@ColorRes id: Int): Int {
|
||||
return ContextCompat.getColor(coreContext.context, id)
|
||||
}
|
||||
|
||||
@MainThread
|
||||
fun getPipRatio(
|
||||
activity: Activity,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue