Remove EllipsizingTextView as it provokes more issue than it solves

This commit is contained in:
ganfra 2020-07-10 22:35:51 +02:00
parent 3fc9fe3017
commit 253582219c
33 changed files with 44 additions and 465 deletions

View file

@ -1,421 +0,0 @@
/*
* Copyright (C) 2011 Micah Hainline
* Copyright (C) 2012 Triposo
* Copyright (C) 2013 Paul Imhoff
* Copyright (C) 2014 Shahin Yousefi
* Copyright 2020 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package im.vector.riotx.core.platform
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.text.Layout
import android.text.Spannable
import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.StaticLayout
import android.text.TextUtils.TruncateAt
import android.text.TextUtils.concat
import android.text.TextUtils.copySpansFrom
import android.text.TextUtils.indexOf
import android.text.TextUtils.lastIndexOf
import android.text.TextUtils.substring
import android.text.style.ForegroundColorSpan
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.content.withStyledAttributes
import timber.log.Timber
import java.util.ArrayList
import java.util.regex.Pattern
/*
* Imported from https://gist.github.com/hateum/d2095575b441007d62b8
*
* Use it in your layout to avoid this issue: https://issuetracker.google.com/issues/121092510
*/
/**
* A [android.widget.TextView] that ellipsizes more intelligently.
* This class supports ellipsizing multiline text through setting `android:ellipsize`
* and `android:maxLines`.
*
*
* Note: [TruncateAt.MARQUEE] ellipsizing type is not supported.
* This as to be used to get rid of the StaticLayout issue with maxLines and ellipsize causing some performance issues.
*/
class EllipsizingTextView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = android.R.attr.textViewStyle)
: AppCompatTextView(context, attrs, defStyle) {
private val ELLIPSIS = SpannableString("\u2026")
private val ellipsizeListeners: MutableList<EllipsizeListener> = ArrayList()
private var ellipsizeStrategy: EllipsizeStrategy? = null
var isEllipsized = false
private set
private var isStale = false
private var programmaticChange = false
private var fullText: CharSequence? = null
private var maxLines = 0
private var lineSpacingMult = 1.0f
private var lineAddVertPad = 0.0f
/**
* The end punctuation which will be removed when appending [.ELLIPSIS].
*/
private var mEndPunctPattern: Pattern? = null
fun setEndPunctuationPattern(pattern: Pattern?) {
mEndPunctPattern = pattern
}
fun addEllipsizeListener(listener: EllipsizeListener) {
ellipsizeListeners.add(listener)
}
fun removeEllipsizeListener(listener: EllipsizeListener) {
ellipsizeListeners.remove(listener)
}
/**
* @return The maximum number of lines displayed in this [android.widget.TextView].
*/
override fun getMaxLines(): Int {
return maxLines
}
override fun setMaxLines(maxLines: Int) {
super.setMaxLines(maxLines)
this.maxLines = maxLines
isStale = true
}
/**
* Determines if the last fully visible line is being ellipsized.
*
* @return `true` if the last fully visible line is being ellipsized;
* otherwise, returns `false`.
*/
fun ellipsizingLastFullyVisibleLine(): Boolean {
return maxLines == Int.MAX_VALUE
}
override fun setLineSpacing(add: Float, mult: Float) {
lineAddVertPad = add
lineSpacingMult = mult
super.setLineSpacing(add, mult)
}
override fun setText(text: CharSequence?, type: BufferType) {
if (!programmaticChange) {
fullText = if (text is Spanned) text else text
isStale = true
}
super.setText(text, type)
}
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
if (ellipsizingLastFullyVisibleLine()) {
isStale = true
}
}
override fun setPadding(left: Int, top: Int, right: Int, bottom: Int) {
super.setPadding(left, top, right, bottom)
if (ellipsizingLastFullyVisibleLine()) {
isStale = true
}
}
override fun onDraw(canvas: Canvas) {
if (isStale) {
resetText()
}
super.onDraw(canvas)
}
/**
* Sets the ellipsized text if appropriate.
*/
private fun resetText() {
val maxLines = maxLines
var workingText = fullText
var ellipsized = false
if (maxLines != -1) {
if (ellipsizeStrategy == null) setEllipsize(null)
workingText = ellipsizeStrategy!!.processText(fullText)
ellipsized = !ellipsizeStrategy!!.isInLayout(fullText)
}
if (workingText != text) {
programmaticChange = true
text = try {
workingText
} finally {
programmaticChange = false
}
}
isStale = false
if (ellipsized != isEllipsized) {
isEllipsized = ellipsized
for (listener in ellipsizeListeners) {
listener.ellipsizeStateChanged(ellipsized)
}
}
}
/**
* Causes words in the text that are longer than the view is wide to be ellipsized
* instead of broken in the middle. Use `null` to turn off ellipsizing.
*
*
* Note: Method does nothing for [TruncateAt.MARQUEE]
* ellipsizing type.
*
* @param where part of text to ellipsize
*/
override fun setEllipsize(where: TruncateAt?) {
if (where == null) {
ellipsizeStrategy = EllipsizeNoneStrategy()
return
}
ellipsizeStrategy = when (where) {
TruncateAt.END -> EllipsizeEndStrategy()
TruncateAt.START -> EllipsizeStartStrategy()
TruncateAt.MIDDLE -> EllipsizeMiddleStrategy()
TruncateAt.MARQUEE -> EllipsizeNoneStrategy()
else -> EllipsizeNoneStrategy()
}
}
/**
* A listener that notifies when the ellipsize state has changed.
*/
interface EllipsizeListener {
fun ellipsizeStateChanged(ellipsized: Boolean)
}
/**
* A base class for an ellipsize strategy.
*/
private abstract inner class EllipsizeStrategy {
/**
* Returns ellipsized text if the text does not fit inside of the layout;
* otherwise, returns the full text.
*
* @param text text to process
* @return Ellipsized text if the text does not fit inside of the layout;
* otherwise, returns the full text.
*/
fun processText(text: CharSequence?): CharSequence? {
return if (!isInLayout(text)) createEllipsizedText(text) else text
}
/**
* Determines if the text fits inside of the layout.
*
* @param text text to fit
* @return `true` if the text fits inside of the layout;
* otherwise, returns `false`.
*/
fun isInLayout(text: CharSequence?): Boolean {
val layout = createWorkingLayout(text)
return layout.lineCount <= linesCount
}
/**
* Creates a working layout with the given text.
*
* @param workingText text to create layout with
* @return [android.text.Layout] with the given text.
*/
@Suppress("DEPRECATION")
protected fun createWorkingLayout(workingText: CharSequence?): Layout {
return StaticLayout(
workingText ?: "",
paint,
width - compoundPaddingLeft - compoundPaddingRight,
Layout.Alignment.ALIGN_NORMAL,
lineSpacingMult,
lineAddVertPad,
false
)
}
/**
* Get how many lines of text we are allowed to display.
*/
protected val linesCount: Int
get() = if (ellipsizingLastFullyVisibleLine()) {
val fullyVisibleLinesCount = fullyVisibleLinesCount
if (fullyVisibleLinesCount == -1) 1 else fullyVisibleLinesCount
} else {
maxLines
}
/**
* Get how many lines of text we can display so their full height is visible.
*/
protected val fullyVisibleLinesCount: Int
get() {
val layout = createWorkingLayout("")
val height = height - compoundPaddingTop - compoundPaddingBottom
val lineHeight = layout.getLineBottom(0)
return height / lineHeight
}
/**
* Creates ellipsized text from the given text.
*
* @param fullText text to ellipsize
* @return Ellipsized text
*/
protected abstract fun createEllipsizedText(fullText: CharSequence?): CharSequence?
}
/**
* An [EllipsizingTextView.EllipsizeStrategy] that
* does not ellipsize text.
*/
private inner class EllipsizeNoneStrategy : EllipsizeStrategy() {
override fun createEllipsizedText(fullText: CharSequence?): CharSequence? {
return fullText
}
}
/**
* An [EllipsizingTextView.EllipsizeStrategy] that
* ellipsizes text at the end.
*/
private inner class EllipsizeEndStrategy : EllipsizeStrategy() {
override fun createEllipsizedText(fullText: CharSequence?): CharSequence? {
val layout = createWorkingLayout(fullText)
val cutOffIndex = try {
layout.getLineEnd(maxLines - 1)
} catch (exception: IndexOutOfBoundsException) {
// Not sure to understand why this is happening
Timber.e(exception, "IndexOutOfBoundsException, maxLine: $maxLines")
0
}
val textLength = fullText!!.length
var cutOffLength = textLength - cutOffIndex
if (cutOffLength < ELLIPSIS.length) cutOffLength = ELLIPSIS.length
var workingText: CharSequence = substring(fullText, 0, textLength - cutOffLength).trim()
while (!isInLayout(concat(stripEndPunctuation(workingText), ELLIPSIS))) {
val lastSpace = lastIndexOf(workingText, ' ')
if (lastSpace == -1) {
break
}
workingText = substring(workingText, 0, lastSpace).trim()
}
workingText = concat(stripEndPunctuation(workingText), ELLIPSIS)
val dest = SpannableStringBuilder(workingText)
if (fullText is Spanned) {
copySpansFrom(fullText as Spanned?, 0, workingText.length, null, dest, 0)
}
return dest
}
/**
* Strips the end punctuation from a given text according to [.mEndPunctPattern].
*
* @param workingText text to strip end punctuation from
* @return Text without end punctuation.
*/
fun stripEndPunctuation(workingText: CharSequence): String {
return mEndPunctPattern!!.matcher(workingText).replaceFirst("")
}
}
/**
* An [EllipsizingTextView.EllipsizeStrategy] that
* ellipsizes text at the start.
*/
private inner class EllipsizeStartStrategy : EllipsizeStrategy() {
override fun createEllipsizedText(fullText: CharSequence?): CharSequence? {
val layout = createWorkingLayout(fullText)
val cutOffIndex = layout.getLineEnd(maxLines - 1)
val textLength = fullText!!.length
var cutOffLength = textLength - cutOffIndex
if (cutOffLength < ELLIPSIS.length) cutOffLength = ELLIPSIS.length
var workingText: CharSequence = substring(fullText, cutOffLength, textLength).trim()
while (!isInLayout(concat(ELLIPSIS, workingText))) {
val firstSpace = indexOf(workingText, ' ')
if (firstSpace == -1) {
break
}
workingText = substring(workingText, firstSpace, workingText.length).trim()
}
workingText = concat(ELLIPSIS, workingText)
val dest = SpannableStringBuilder(workingText)
if (fullText is Spanned) {
copySpansFrom(fullText as Spanned?, textLength - workingText.length,
textLength, null, dest, 0)
}
return dest
}
}
/**
* An [EllipsizingTextView.EllipsizeStrategy] that
* ellipsizes text in the middle.
*/
private inner class EllipsizeMiddleStrategy : EllipsizeStrategy() {
override fun createEllipsizedText(fullText: CharSequence?): CharSequence? {
val layout = createWorkingLayout(fullText)
val cutOffIndex = layout.getLineEnd(maxLines - 1)
val textLength = fullText!!.length
var cutOffLength = textLength - cutOffIndex
if (cutOffLength < ELLIPSIS.length) cutOffLength = ELLIPSIS.length
cutOffLength += cutOffIndex % 2 // Make it even.
var firstPart = substring(
fullText, 0, textLength / 2 - cutOffLength / 2).trim()
var secondPart = substring(
fullText, textLength / 2 + cutOffLength / 2, textLength).trim()
while (!isInLayout(concat(firstPart, ELLIPSIS, secondPart))) {
val lastSpaceFirstPart = firstPart.lastIndexOf(' ')
val firstSpaceSecondPart = secondPart.indexOf(' ')
if (lastSpaceFirstPart == -1 || firstSpaceSecondPart == -1) break
firstPart = firstPart.substring(0, lastSpaceFirstPart).trim()
secondPart = secondPart.substring(firstSpaceSecondPart, secondPart.length).trim()
}
val firstDest = SpannableStringBuilder(firstPart)
val secondDest = SpannableStringBuilder(secondPart)
if (fullText is Spanned) {
copySpansFrom(fullText as Spanned?, 0, firstPart.length,
null, firstDest, 0)
copySpansFrom(fullText as Spanned?, textLength - secondPart.length,
textLength, null, secondDest, 0)
}
return concat(firstDest, ELLIPSIS, secondDest)
}
}
companion object {
const val ELLIPSIZE_ALPHA = 0x88
private val DEFAULT_END_PUNCTUATION = Pattern.compile("[.!?,;:\u2026]*$", Pattern.DOTALL)
}
init {
context.withStyledAttributes(attrs, intArrayOf(android.R.attr.maxLines, android.R.attr.ellipsize), defStyle) {
maxLines = getInt(0, Int.MAX_VALUE)
}
setEndPunctuationPattern(DEFAULT_END_PUNCTUATION)
val currentTextColor = currentTextColor
val ellipsizeColor = Color.argb(ELLIPSIZE_ALPHA, Color.red(currentTextColor), Color.green(currentTextColor), Color.blue(currentTextColor))
ELLIPSIS.setSpan(ForegroundColorSpan(ellipsizeColor), 0, ELLIPSIS.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
}
}

View file

@ -60,7 +60,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/first_names" /> tools:text="@tools:sample/first_names" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/composer_related_message_preview" android:id="@+id/composer_related_message_preview"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"

View file

@ -36,7 +36,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/createDirectRoomTitle" android:id="@+id/createDirectRoomTitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -37,7 +37,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/createDirectRoomTitle" android:id="@+id/createDirectRoomTitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -33,7 +33,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/createRoomTitle" android:id="@+id/createRoomTitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -28,7 +28,7 @@
android:contentDescription="@string/a11y_open_drawer" android:contentDescription="@string/a11y_open_drawer"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/groupToolbarTitleView" android:id="@+id/groupToolbarTitleView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -36,7 +36,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/knownUsersTitle" android:id="@+id/knownUsersTitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -71,7 +71,7 @@
tools:ignore="MissingConstraints" tools:ignore="MissingConstraints"
tools:src="@drawable/ic_shield_trusted" /> tools:src="@drawable/ic_shield_trusted" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/matrixProfileToolbarTitleView" android:id="@+id/matrixProfileToolbarTitleView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -43,7 +43,7 @@
tools:ignore="MissingConstraints" tools:ignore="MissingConstraints"
tools:src="@drawable/ic_shield_trusted" /> tools:src="@drawable/ic_shield_trusted" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomToolbarTitleView" android:id="@+id/roomToolbarTitleView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -60,7 +60,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="@sample/matrix.json/data/roomName" /> tools:text="@sample/matrix.json/data/roomName" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomToolbarSubtitleView" android:id="@+id/roomToolbarSubtitleView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -33,7 +33,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomPreviewNoPreviewToolbarTitle" android:id="@+id/roomPreviewNoPreviewToolbarTitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -33,7 +33,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomSettingsToolbarTitleView" android:id="@+id/roomSettingsToolbarTitleView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -48,7 +48,7 @@
tools:ignore="MissingConstraints" tools:ignore="MissingConstraints"
tools:src="@drawable/ic_shield_trusted" /> tools:src="@drawable/ic_shield_trusted" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomUploadsToolbarTitleView" android:id="@+id/roomUploadsToolbarTitleView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -37,7 +37,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/userDirectoryTitle" android:id="@+id/userDirectoryTitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -37,7 +37,7 @@
android:textStyle="bold" android:textStyle="bold"
tools:text="name" /> tools:text="name" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/itemAutocompleteEmojiSubname" android:id="@+id/itemAutocompleteEmojiSubname"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -36,7 +36,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_room_actions_notifications_all" /> tools:src="@drawable/ic_room_actions_notifications_all" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/actionTitle" android:id="@+id/actionTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -21,7 +21,7 @@
app:layout_constraintVertical_bias="0" app:layout_constraintVertical_bias="0"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/bottom_sheet_message_preview_sender" android:id="@+id/bottom_sheet_message_preview_sender"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -41,7 +41,7 @@
app:layout_constraintTop_toTopOf="@id/bottom_sheet_message_preview_avatar" app:layout_constraintTop_toTopOf="@id/bottom_sheet_message_preview_avatar"
tools:text="@tools:sample/full_names" /> tools:text="@tools:sample/full_names" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/bottom_sheet_message_preview_body" android:id="@+id/bottom_sheet_message_preview_body"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -25,7 +25,7 @@
app:layout_constraintVertical_bias="0" app:layout_constraintVertical_bias="0"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/bottomSheetRoomPreviewName" android:id="@+id/bottomSheetRoomPreviewName"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -36,7 +36,7 @@
android:visibility="visible" /> android:visibility="visible" />
</FrameLayout> </FrameLayout>
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/createDirectRoomUserName" android:id="@+id/createDirectRoomUserName"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -54,7 +54,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/full_names" /> tools:text="@tools:sample/full_names" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/createDirectRoomUserID" android:id="@+id/createDirectRoomUserID"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -55,7 +55,7 @@
android:textColor="?riotx_text_secondary" android:textColor="?riotx_text_secondary"
android:textSize="12sp" /> android:textSize="12sp" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/itemDeviceId" android:id="@+id/itemDeviceId"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -8,7 +8,7 @@
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
android:minHeight="@dimen/item_form_min_height"> android:minHeight="@dimen/item_form_min_height">
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/formSwitchTitle" android:id="@+id/formSwitchTitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -23,7 +23,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/groupNameView" android:id="@+id/groupNameView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -36,7 +36,7 @@
android:visibility="visible" /> android:visibility="visible" />
</FrameLayout> </FrameLayout>
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/knownUserName" android:id="@+id/knownUserName"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -54,7 +54,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/full_names" /> tools:text="@tools:sample/full_names" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/knownUserID" android:id="@+id/knownUserID"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -27,7 +27,7 @@
tools:src="@drawable/ic_room_profile_notification" tools:src="@drawable/ic_room_profile_notification"
tools:visibility="visible" /> tools:visibility="visible" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/actionTitle" android:id="@+id/actionTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -47,7 +47,7 @@
app:layout_goneMarginStart="0dp" app:layout_goneMarginStart="0dp"
tools:text="@string/room_profile_section_security_learn_more" /> tools:text="@string/room_profile_section_security_learn_more" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/actionSubtitle" android:id="@+id/actionSubtitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -35,7 +35,7 @@
tools:ignore="MissingConstraints" tools:ignore="MissingConstraints"
tools:src="@drawable/ic_shield_trusted" /> tools:src="@drawable/ic_shield_trusted" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/matrixItemTitle" android:id="@+id/matrixItemTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -55,7 +55,7 @@
app:layout_goneMarginStart="0dp" app:layout_goneMarginStart="0dp"
tools:text="@sample/matrix.json/data/displayName" /> tools:text="@sample/matrix.json/data/displayName" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/matrixItemSubtitle" android:id="@+id/matrixItemSubtitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -23,7 +23,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/itemPublicRoomName" android:id="@+id/itemPublicRoomName"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -66,7 +66,7 @@
app:layout_constraintTop_toBottomOf="@id/roomAvatarContainer" app:layout_constraintTop_toBottomOf="@id/roomAvatarContainer"
tools:layout_marginStart="20dp" /> tools:layout_marginStart="20dp" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomNameView" android:id="@+id/roomNameView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -138,7 +138,7 @@
app:layout_constraintTop_toTopOf="@+id/roomNameView" app:layout_constraintTop_toTopOf="@+id/roomNameView"
tools:text="@tools:sample/date/hhmm" /> tools:text="@tools:sample/date/hhmm" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomLastEventView" android:id="@+id/roomLastEventView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -154,7 +154,7 @@
app:layout_constraintTop_toBottomOf="@+id/roomNameView" app:layout_constraintTop_toBottomOf="@+id/roomNameView"
tools:text="@sample/matrix.json/data/message" /> tools:text="@sample/matrix.json/data/message" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomTypingView" android:id="@+id/roomTypingView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -17,7 +17,7 @@
android:paddingRight="@dimen/layout_horizontal_margin" android:paddingRight="@dimen/layout_horizontal_margin"
android:paddingBottom="4dp"> android:paddingBottom="4dp">
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomCategoryTitleView" android:id="@+id/roomCategoryTitleView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -24,7 +24,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/itemRoomDirectoryName" android:id="@+id/itemRoomDirectoryName"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -43,7 +43,7 @@
app:layout_constraintVertical_chainStyle="packed" app:layout_constraintVertical_chainStyle="packed"
tools:text="@tools:sample/lorem/random" /> tools:text="@tools:sample/lorem/random" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/itemRoomDirectoryDescription" android:id="@+id/itemRoomDirectoryDescription"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -30,7 +30,7 @@
app:layout_constraintTop_toBottomOf="@+id/roomInvitationAvatarImageView" app:layout_constraintTop_toBottomOf="@+id/roomInvitationAvatarImageView"
tools:layout_marginStart="20dp" /> tools:layout_marginStart="20dp" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomInvitationNameView" android:id="@+id/roomInvitationNameView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -54,7 +54,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="@sample/matrix.json/data/displayName" /> tools:text="@sample/matrix.json/data/displayName" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/roomInvitationSubTitle" android:id="@+id/roomInvitationSubTitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -23,7 +23,7 @@
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/messageMemberNameView" android:id="@+id/messageMemberNameView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -18,7 +18,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/uploadsFileTitle" android:id="@+id/uploadsFileTitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -35,7 +35,7 @@
app:layout_constraintVertical_chainStyle="packed" app:layout_constraintVertical_chainStyle="packed"
tools:text="Filename.file" /> tools:text="Filename.file" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/uploadsFileSubtitle" android:id="@+id/uploadsFileSubtitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -20,7 +20,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/itemUserId" android:id="@+id/itemUserId"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -38,7 +38,7 @@
app:layout_constraintVertical_chainStyle="packed" app:layout_constraintVertical_chainStyle="packed"
tools:text="@sample/matrix.json/data/mxid" /> tools:text="@sample/matrix.json/data/mxid" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/itemUserName" android:id="@+id/itemUserName"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -55,7 +55,7 @@
tools:text="@tools:sample/first_names" tools:text="@tools:sample/first_names"
tools:visibility="gone" /> tools:visibility="gone" />
<im.vector.riotx.core.platform.EllipsizingTextView <TextView
android:id="@+id/composer_related_message_preview" android:id="@+id/composer_related_message_preview"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"