2020-12-14 21:18:58 +00:00
|
|
|
package com.vanced.manager.ui.core
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.util.AttributeSet
|
|
|
|
import androidx.appcompat.widget.AppCompatTextView
|
2021-01-16 17:00:38 +00:00
|
|
|
import com.vanced.manager.utils.accentColor
|
|
|
|
import com.vanced.manager.utils.lifecycleOwner
|
2020-12-14 21:18:58 +00:00
|
|
|
|
|
|
|
class ThemedTextView @JvmOverloads constructor(
|
|
|
|
context: Context,
|
|
|
|
attributeSet: AttributeSet? = null,
|
|
|
|
defStyleAttr: Int = 0
|
|
|
|
) : AppCompatTextView(context, attributeSet, defStyleAttr) {
|
|
|
|
init {
|
2021-02-28 10:58:34 +00:00
|
|
|
context.lifecycleOwner?.let { owner ->
|
2020-12-14 21:18:58 +00:00
|
|
|
accentColor.observe(owner) { color ->
|
|
|
|
setTextColor(color.toInt())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|