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

View file

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

View file

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