theme text buttons's ripple color for Material 3

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-08-01 22:40:46 +02:00
parent 0d52e8a882
commit e629932262
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
2 changed files with 17 additions and 0 deletions

View File

@ -117,6 +117,10 @@ public class ChooseAccountDialogFragment extends DialogFragment {
viewThemeUtils.themeDialog(binding.getRoot());
viewThemeUtils.themeDialogDivider(binding.divider);
viewThemeUtils.colorMaterialTextButton(binding.setStatus);
viewThemeUtils.colorMaterialTextButton(binding.addAccount);
viewThemeUtils.colorMaterialTextButton(binding.manageSettings);
// Defining user picture
binding.currentAccount.userIcon.setTag("");

View File

@ -247,6 +247,19 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
imageView.imageTintList = ColorStateList.valueOf(theme.colorText)
}
fun colorMaterialTextButton(button: MaterialButton) {
withScheme(button) { scheme ->
button.rippleColor = ColorStateList(
arrayOf(
intArrayOf(android.R.attr.state_pressed)
),
intArrayOf(
calculateDisabledColor(scheme.primary, SURFACE_OPACITY_BUTTON_DISABLED)
)
)
}
}
fun colorMaterialButtonText(button: MaterialButton) {
withScheme(button) { scheme ->
val disabledColor = ContextCompat.getColor(button.context, R.color.disabled_text)