summaryrefslogtreecommitdiff
path: root/app/src/main/java/foundation/e/privacycentralapp
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/foundation/e/privacycentralapp')
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/common/TextViewHelpers.kt13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/common/TextViewHelpers.kt b/app/src/main/java/foundation/e/privacycentralapp/common/TextViewHelpers.kt
index a5c576c..1cdc06f 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/common/TextViewHelpers.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/common/TextViewHelpers.kt
@@ -18,6 +18,7 @@
package foundation.e.privacycentralapp.common
import android.content.Context
+import android.content.res.ColorStateList
import android.text.Spannable
import android.text.SpannableString
import android.text.style.ImageSpan
@@ -30,18 +31,24 @@ import foundation.e.privacycentralapp.R
fun setToolTipForAsterisk(
textView: TextView,
@StringRes textId: Int,
- @StringRes tooltipTextId: Int) {
- textView.text = asteriskAsInfoIconSpannable(textView.context, textId)
+ @StringRes tooltipTextId: Int
+) {
+ textView.text = asteriskAsInfoIconSpannable(textView.context, textId, textView.textColors)
TooltipCompat.setTooltipText(textView, textView.context.getString(tooltipTextId))
textView.setOnClickListener { it.performLongClick() }
}
-private fun asteriskAsInfoIconSpannable(context: Context, @StringRes textId: Int): Spannable {
+private fun asteriskAsInfoIconSpannable(
+ context: Context,
+ @StringRes textId: Int,
+ tint: ColorStateList
+): Spannable {
val spannable = SpannableString(context.getString(textId))
val index = spannable.lastIndexOf("*")
if (index != -1) {
AppCompatResources.getDrawable(context, R.drawable.ic_info_16dp)?.let {
+ it.setTintList(tint)
it.setBounds(0, 0, it.intrinsicWidth, it.intrinsicHeight)
spannable.setSpan(
ImageSpan(it),