Merge pull request #4087 from nextcloud/issue-4075-filter-conversation-constrast

Fixing contrast for the filter conversation dialog
This commit is contained in:
Sowjanya Kota 2024-08-21 16:58:15 +02:00 committed by GitHub
commit e06f2e394b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 49 additions and 2 deletions

View File

@ -71,7 +71,7 @@ class FilterConversationFragment : DialogFragment() {
unreadFilterChip,
mentionedFilterChip
)
}.forEach(viewThemeUtils.material::themeChipFilter)
}.forEach(viewThemeUtils.talk::themeChipFilter)
setUpChips()
}

View File

@ -7,6 +7,7 @@
*/
package com.nextcloud.talk.ui.theme
import android.annotation.SuppressLint
import android.annotation.TargetApi
import android.content.Context
import android.content.res.ColorStateList
@ -36,10 +37,12 @@ import androidx.core.graphics.drawable.DrawableCompat
import androidx.core.view.ViewCompat
import com.google.android.material.button.MaterialButton
import com.google.android.material.card.MaterialCardView
import com.google.android.material.chip.Chip
import com.google.android.material.materialswitch.MaterialSwitch
import com.nextcloud.android.common.ui.theme.MaterialSchemes
import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase
import com.nextcloud.android.common.ui.theme.utils.AndroidXViewThemeUtils
import com.nextcloud.android.common.ui.util.buildColorStateList
import com.nextcloud.talk.R
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding
import com.nextcloud.talk.ui.MicInputCloud
@ -50,6 +53,7 @@ import com.nextcloud.talk.utils.DrawableUtils
import com.nextcloud.talk.utils.message.MessageUtils
import com.vanniktech.emoji.EmojiTextView
import com.wooplr.spotlight.SpotlightView
import dynamiccolor.DynamicScheme
import dynamiccolor.MaterialDynamicColors
import eu.davidea.flexibleadapter.utils.FlexibleUtils
import javax.inject.Inject
@ -214,6 +218,7 @@ class TalkSpecificViewThemeUtils @Inject constructor(
return drawable
}
@SuppressLint("RestrictedApi")
fun themeSearchView(searchView: SearchView) {
withScheme(searchView) { scheme ->
// hacky as no default way is provided
@ -376,6 +381,48 @@ class TalkSpecificViewThemeUtils @Inject constructor(
}
}
private fun chipOutlineFilterColorList(scheme: DynamicScheme) =
buildColorStateList(
android.R.attr.state_checked to dynamicColor.secondaryContainer().getArgb(scheme),
-android.R.attr.state_checked to dynamicColor.outline().getArgb(scheme)
)
fun themeChipFilter(chip: Chip) {
withScheme(chip.context) { scheme ->
val backgroundColors =
buildColorStateList(
android.R.attr.state_checked to dynamicColor.secondaryContainer().getArgb(scheme),
-android.R.attr.state_checked to dynamicColor.surface().getArgb(scheme),
android.R.attr.state_focused to dynamicColor.secondaryContainer().getArgb(scheme),
android.R.attr.state_hovered to dynamicColor.secondaryContainer().getArgb(scheme),
android.R.attr.state_pressed to dynamicColor.secondaryContainer().getArgb(scheme)
)
val iconColors =
buildColorStateList(
android.R.attr.state_checked to dynamicColor.onSecondaryContainer().getArgb(scheme),
-android.R.attr.state_checked to dynamicColor.surfaceVariant().getArgb(scheme),
android.R.attr.state_focused to dynamicColor.onSecondaryContainer().getArgb(scheme),
android.R.attr.state_hovered to dynamicColor.onSecondaryContainer().getArgb(scheme),
android.R.attr.state_pressed to dynamicColor.onSecondaryContainer().getArgb(scheme)
)
val textColors =
buildColorStateList(
android.R.attr.state_checked to dynamicColor.onSecondaryContainer().getArgb(scheme),
-android.R.attr.state_checked to dynamicColor.onSecondaryContainer().getArgb(scheme),
android.R.attr.state_hovered to dynamicColor.onSecondaryContainer().getArgb(scheme),
android.R.attr.state_focused to dynamicColor.onSecondaryContainer().getArgb(scheme),
android.R.attr.state_pressed to dynamicColor.onSecondaryContainer().getArgb(scheme)
)
chip.chipBackgroundColor = backgroundColors
chip.chipStrokeColor = chipOutlineFilterColorList(scheme)
chip.setTextColor(textColors)
chip.checkedIconTint = iconColors
}
}
companion object {
private val THEMEABLE_PLACEHOLDER_IDS = listOf(
R.drawable.ic_mimetype_package_x_generic,

View File

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 132 errors and 86 warnings</span>
<span class="mdl-layout-title">Lint Report: 131 errors and 86 warnings</span>