Do not ellipsize content while expanding.

This commit is contained in:
Onuray Sahin 2020-10-09 15:06:54 +03:00
parent c3a423fdbe
commit beeb840436
1 changed files with 6 additions and 3 deletions

View File

@ -17,6 +17,7 @@
package im.vector.app.core.epoxy package im.vector.app.core.epoxy
import android.animation.ObjectAnimator import android.animation.ObjectAnimator
import android.text.TextUtils
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.core.view.doOnPreDraw import androidx.core.view.doOnPreDraw
@ -63,18 +64,20 @@ abstract class ExpandableTextItem : VectorEpoxyModel<ExpandableTextItem.Holder>(
private fun expand(holder: Holder) { private fun expand(holder: Holder) {
ObjectAnimator.ofInt(holder.content, "maxLines", expandedLines) ObjectAnimator.ofInt(holder.content, "maxLines", expandedLines)
.apply { duration = 500 } .apply { duration = 200 }
.also { it.start() } .also { it.start() }
holder.content.ellipsize = null
holder.arrow.setImageResource(R.drawable.ic_expand_less) holder.arrow.setImageResource(R.drawable.ic_expand_less)
isExpanded = true isExpanded = true
} }
private fun collapse(holder: Holder) { private fun collapse(holder: Holder) {
ObjectAnimator.ofInt(holder.content, "maxLines", maxLines) ObjectAnimator.ofInt(holder.content, "maxLines", maxLines)
.apply { duration = 500 } .apply { duration = 200 }
.also { it.start() } .also { it.start() }
holder.content.ellipsize = TextUtils.TruncateAt.END
holder.arrow.setImageResource(R.drawable.ic_expand_more) holder.arrow.setImageResource(R.drawable.ic_expand_more)
isExpanded = false isExpanded = false
} }