mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
add proper button-state coloring for button text/icon
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
aef9b69175
commit
907386e9b7
@ -32,6 +32,7 @@ import android.widget.ImageView
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.content.res.AppCompatResources
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
import androidx.appcompat.widget.SwitchCompat
|
import androidx.appcompat.widget.SwitchCompat
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.core.view.children
|
import androidx.core.view.children
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
@ -113,8 +114,17 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun colorMaterialButtonText(button: MaterialButton) {
|
fun colorMaterialButtonText(button: MaterialButton) {
|
||||||
colorTextViewElement(button)
|
withElementColor(button) { color ->
|
||||||
button.iconTint = ColorStateList.valueOf(getElementColor(button.context))
|
val disabledColor = ContextCompat.getColor(button.context, R.color.disabled_text)
|
||||||
|
val colorStateList = ColorStateList(
|
||||||
|
arrayOf(
|
||||||
|
intArrayOf(android.R.attr.state_enabled),
|
||||||
|
intArrayOf(-android.R.attr.state_enabled)),
|
||||||
|
intArrayOf(color, disabledColor)
|
||||||
|
)
|
||||||
|
button.setTextColor(colorStateList)
|
||||||
|
button.iconTint = colorStateList
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun colorMaterialButtonBackground(button: MaterialButton) {
|
fun colorMaterialButtonBackground(button: MaterialButton) {
|
||||||
|
Loading…
Reference in New Issue
Block a user