Fix home icon dark mode

This commit is contained in:
Valere 2021-03-25 16:34:50 +01:00
parent a5af1a6ebd
commit 4c4f68f654
2 changed files with 11 additions and 1 deletions

View file

@ -17,6 +17,7 @@
package im.vector.app.features.grouplist
import android.content.res.ColorStateList
import android.content.res.Resources
import android.util.TypedValue
import android.widget.ImageView
@ -29,6 +30,7 @@ import im.vector.app.R
import im.vector.app.core.epoxy.VectorEpoxyHolder
import im.vector.app.core.epoxy.VectorEpoxyModel
import im.vector.app.core.platform.CheckableConstraintLayout
import im.vector.app.features.themes.ThemeUtils
@EpoxyModelClass(layout = R.layout.item_space)
abstract class HomeSpaceSummaryItem : VectorEpoxyModel<HomeSpaceSummaryItem.Holder>() {
@ -40,6 +42,7 @@ abstract class HomeSpaceSummaryItem : VectorEpoxyModel<HomeSpaceSummaryItem.Hold
// mm.. it's reusing the same layout for basic space item
return R.id.space_item_home
}
override fun bind(holder: Holder) {
super.bind(holder)
holder.rootView.setOnClickListener { listener?.invoke() }
@ -48,6 +51,7 @@ abstract class HomeSpaceSummaryItem : VectorEpoxyModel<HomeSpaceSummaryItem.Hold
holder.rootView.context.resources
holder.avatarImageView.background = ContextCompat.getDrawable(holder.view.context, R.drawable.space_home_background)
holder.avatarImageView.setImageResource(R.drawable.ic_space_home)
holder.avatarImageView.imageTintList = ColorStateList.valueOf(ThemeUtils.getColor(holder.view.context, R.attr.riot_primary_text_color))
holder.avatarImageView.scaleType = ImageView.ScaleType.CENTER_INSIDE
holder.leaveView.isVisible = false
}

View file

@ -258,7 +258,13 @@ class HomeDetailFragment @Inject constructor(
// Special case
views.groupToolbarAvatarImageView.background = ContextCompat.getDrawable(requireContext(), R.drawable.space_home_background)
views.groupToolbarAvatarImageView.scaleType = ImageView.ScaleType.CENTER_INSIDE
views.groupToolbarAvatarImageView.setImageResource(R.drawable.ic_space_home)
ThemeUtils.tintDrawableWithColor(
ContextCompat.getDrawable(requireContext(), R.drawable.ic_space_home)!!,
ThemeUtils.getColor(requireContext(), R.attr.riot_primary_text_color)
).let {
views.groupToolbarAvatarImageView.setImageDrawable(it)
}
views.groupToolbarSpaceTitleView.isVisible = false
} else {
views.groupToolbarAvatarImageView.background = null