Fix issue in dark theme. Also do not limit subtitles to 2 lines

This commit is contained in:
Benoit Marty 2020-02-02 03:11:27 +01:00
parent 96a556f449
commit 40b0f60964
3 changed files with 11 additions and 4 deletions

View file

@ -16,11 +16,13 @@
package im.vector.riotx.core.epoxy.profiles package im.vector.riotx.core.epoxy.profiles
import android.content.res.ColorStateList
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.core.widget.ImageViewCompat
import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass import com.airbnb.epoxy.EpoxyModelClass
import im.vector.riotx.R import im.vector.riotx.R
@ -68,13 +70,20 @@ abstract class ProfileActionItem : VectorEpoxyModel<ProfileActionItem.Holder>()
holder.subtitle.setTextOrHide(subtitle) holder.subtitle.setTextOrHide(subtitle)
if (iconRes != 0) { if (iconRes != 0) {
holder.icon.setImageResource(iconRes) holder.icon.setImageResource(iconRes)
ImageViewCompat.setImageTintList(holder.icon, ColorStateList.valueOf(tintColor))
holder.icon.isVisible = true holder.icon.isVisible = true
} else { } else {
holder.icon.isVisible = false holder.icon.isVisible = false
} }
if (editableRes != 0) { if (editableRes != 0) {
val tintColorSecondary = if (destructive) {
tintColor
} else {
ThemeUtils.getColor(holder.view.context, R.attr.riotx_text_secondary)
}
holder.editable.setImageResource(editableRes) holder.editable.setImageResource(editableRes)
ImageViewCompat.setImageTintList(holder.editable, ColorStateList.valueOf(tintColorSecondary))
holder.editable.isVisible = true holder.editable.isVisible = true
} else { } else {
holder.editable.isVisible = false holder.editable.isVisible = false

View file

@ -46,9 +46,7 @@ fun EpoxyController.buildProfileAction(
id("action_$id") id("action_$id")
subtitle(subtitle) subtitle(subtitle)
editable(editable) editable(editable)
apply {
editableRes?.let { editableRes(editableRes) } editableRes?.let { editableRes(editableRes) }
}
destructive(destructive) destructive(destructive)
title(title) title(title)
listener { _ -> listener { _ ->

View file

@ -20,6 +20,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:scaleType="center" android:scaleType="center"
android:tint="?riotx_text_primary"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -55,7 +56,6 @@
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:drawablePadding="16dp" android:drawablePadding="16dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2"
android:textColor="?riotx_text_secondary" android:textColor="?riotx_text_secondary"
android:textSize="12sp" android:textSize="12sp"
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"