mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
cleanup text theming methods, migrate image button theming
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
ab14d9afff
commit
51cf6061c3
@ -74,7 +74,7 @@ public class GenericTextHeaderItem extends AbstractHeaderItem<GenericTextHeaderI
|
||||
Log.d(TAG, "We have payloads, so ignoring!");
|
||||
} else {
|
||||
holder.binding.titleTextView.setText(title);
|
||||
viewThemeUtils.colorTextViewElement(holder.binding.titleTextView);
|
||||
viewThemeUtils.colorPrimaryTextViewElement(holder.binding.titleTextView);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,9 +99,9 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener
|
||||
}
|
||||
|
||||
private fun themeDialog() {
|
||||
viewThemeUtils.colorTextViewText(binding.pollQuestion)
|
||||
viewThemeUtils.colorTextViewText(binding.pollOptions)
|
||||
viewThemeUtils.colorTextViewText(binding.pollSettings)
|
||||
viewThemeUtils.colorPrimaryTextViewElement(binding.pollQuestion)
|
||||
viewThemeUtils.colorPrimaryTextViewElement(binding.pollOptions)
|
||||
viewThemeUtils.colorPrimaryTextViewElement(binding.pollSettings)
|
||||
|
||||
viewThemeUtils.colorEditText(binding.pollCreateQuestionTextEdit)
|
||||
|
||||
|
@ -416,7 +416,7 @@ class SetStatusDialogFragment :
|
||||
}
|
||||
}
|
||||
viewThemeUtils.colorCardViewBackground(views.first)
|
||||
viewThemeUtils.colorTextViewText(views.second)
|
||||
viewThemeUtils.colorPrimaryTextViewElement(views.second)
|
||||
}
|
||||
|
||||
private fun clearTopStatus() {
|
||||
|
@ -165,7 +165,7 @@ public class SortingOrderDialogFragment extends DialogFragment implements View.O
|
||||
viewThemeUtils.colorMaterialButtonText((MaterialButton) view);
|
||||
}
|
||||
if (view instanceof TextView) {
|
||||
viewThemeUtils.colorTextViewElement((TextView) view);
|
||||
viewThemeUtils.colorPrimaryTextViewElement((TextView) view);
|
||||
((TextView) view).setTypeface(Typeface.DEFAULT_BOLD);
|
||||
}
|
||||
}
|
||||
|
@ -162,8 +162,8 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
|
||||
}
|
||||
|
||||
fun themeHorizontalSeekBar(seekBar: SeekBar) {
|
||||
withElementColor(seekBar) { color ->
|
||||
themeHorizontalSeekBar(seekBar, color)
|
||||
withScheme(seekBar) { scheme ->
|
||||
themeHorizontalSeekBar(seekBar, scheme.primary)
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,23 +179,19 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
|
||||
}
|
||||
}
|
||||
|
||||
fun colorTextViewElement(textView: TextView) {
|
||||
withElementColor(textView) { color ->
|
||||
textView.setTextColor(color)
|
||||
fun colorPrimaryTextViewElement(textView: TextView) {
|
||||
withScheme(textView) { scheme ->
|
||||
textView.setTextColor(scheme.primary)
|
||||
}
|
||||
}
|
||||
|
||||
fun colorTextViewText(textView: TextView) {
|
||||
textView.setTextColor(theme.colorText)
|
||||
}
|
||||
|
||||
/**
|
||||
* Colors the background as element color and the foreground as text color.
|
||||
*/
|
||||
fun colorImageViewButton(imageView: ImageView) {
|
||||
withElementColor(imageView) { color ->
|
||||
imageView.imageTintList = ColorStateList.valueOf(theme.colorText)
|
||||
imageView.backgroundTintList = ColorStateList.valueOf(color)
|
||||
withScheme(imageView) { scheme ->
|
||||
imageView.imageTintList = ColorStateList.valueOf(scheme.onPrimaryContainer)
|
||||
imageView.backgroundTintList = ColorStateList.valueOf(scheme.primaryContainer)
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,15 +266,15 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
|
||||
}
|
||||
|
||||
fun colorCardViewBackground(card: MaterialCardView) {
|
||||
withElementColor(card) { color ->
|
||||
card.setCardBackgroundColor(color)
|
||||
withScheme(card) { scheme ->
|
||||
card.setCardBackgroundColor(scheme.surfaceVariant)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO split this util into classes depending on framework views vs library views
|
||||
fun colorPreferenceCategory(category: MaterialPreferenceCategory) {
|
||||
withElementColor(category) { color ->
|
||||
category.setTitleColor(color)
|
||||
withScheme(category) { scheme ->
|
||||
category.setTitleColor(scheme.primary)
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,8 +354,8 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
|
||||
}
|
||||
|
||||
fun colorProgressBar(progressIndicator: LinearProgressIndicator) {
|
||||
withElementColor(progressIndicator) { color ->
|
||||
progressIndicator.setIndicatorColor(progressColor(progressIndicator.context, color))
|
||||
withScheme(progressIndicator) { scheme ->
|
||||
progressIndicator.setIndicatorColor(scheme.primary)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user