File tree Expand file tree Collapse file tree 2 files changed +3
-14
lines changed
session/libsession/utilities
thoughtcrime/securesms/conversation/v2/messages Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -34,14 +34,7 @@ fun TextView.needsCollapsing(
34
34
availableWidthPx : Int ,
35
35
maxLines : Int
36
36
): Boolean {
37
- // Pick the width the TextView will actually respect before draw
38
- val rawWidth = when {
39
- measuredWidth > 0 -> measuredWidth
40
- // if maxWidth is set, we check it
41
- maxWidth in 1 until Int .MAX_VALUE -> minOf(availableWidthPx, maxWidth)
42
- else -> availableWidthPx
43
- }
44
- val contentWidth = (rawWidth - paddingLeft - paddingRight).coerceAtLeast(0 )
37
+ val contentWidth = (availableWidthPx - paddingLeft - paddingRight).coerceAtLeast(0 )
45
38
if (contentWidth <= 0 || text.isNullOrEmpty()) return false
46
39
47
40
val textForLayout = transformationMethod?.getTransformation(text, this ) ? : text
@@ -67,7 +60,7 @@ fun TextView.needsCollapsing(
67
60
.setAlignment(alignment)
68
61
.setTextDirection(direction)
69
62
.setMaxLines(maxLines) // cap at maxLines
70
- .setEllipsize(ellipsize ? : TextUtils . TruncateAt . END ) // compute ellipsis
63
+ .setEllipsize(ellipsize) // compute ellipsis
71
64
72
65
builder.setJustificationMode(justificationMode)
73
66
Original file line number Diff line number Diff line change @@ -356,13 +356,9 @@ class VisibleMessageContentView : ConstraintLayout {
356
356
}
357
357
}
358
358
359
- val widthCap = binding.bodyTextView.maxWidth
360
- .takeIf { it > 0 && it < Int .MAX_VALUE }
361
- ? : resources.getDimensionPixelSize(R .dimen.max_bubble_width)
362
-
363
359
// if the text was already manually expanded, we can skip this logic
364
360
if (! isTextExpanded && binding.bodyTextView.needsCollapsing(
365
- availableWidthPx = widthCap ,
361
+ availableWidthPx = binding.bodyTextView.maxWidth ,
366
362
maxLines = MAX_COLLAPSED_LINE_COUNT )
367
363
){
368
364
// show the "Read mode" button
You can’t perform that action at this time.
0 commit comments