Fixed display issue with latest changes

This commit is contained in:
Sylvain Berfini 2019-02-14 15:37:14 +01:00
parent d3ee5dd349
commit db936fb2cc
3 changed files with 6 additions and 10 deletions

View file

@ -125,11 +125,6 @@ public class ChatMessageViewHolder extends RecyclerView.ViewHolder implements Vi
} }
} }
private boolean isTooLarge(TextView text, String newText) {
float textWidth = text.getPaint().measureText(newText);
return (textWidth >= text.getMeasuredWidth());
}
public void bindMessage(final ChatMessage message, LinphoneContact contact) { public void bindMessage(final ChatMessage message, LinphoneContact contact) {
eventLayout.setVisibility(View.GONE); eventLayout.setVisibility(View.GONE);
securityEventLayout.setVisibility(View.GONE); securityEventLayout.setVisibility(View.GONE);

View file

@ -27,8 +27,8 @@ import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* The purpose of this class is to have a TextView declared with wrap_content * The purpose of this class is to have a TextView declared with wrap_content as width that won't
* as width that won't fill it's parent if it is multi line * fill it's parent if it is multi line
*/ */
@SuppressLint("AppCompatCustomView") @SuppressLint("AppCompatCustomView")
public class MultiLineWrapContentWidthTextView extends TextView { public class MultiLineWrapContentWidthTextView extends TextView {
@ -55,8 +55,8 @@ public class MultiLineWrapContentWidthTextView extends TextView {
if (layout != null) { if (layout != null) {
int maxWidth = int maxWidth =
(int) Math.ceil(getMaxLineWidth(layout)) (int) Math.ceil(getMaxLineWidth(layout))
+ getCompoundPaddingLeft() + getTotalPaddingLeft()
+ getCompoundPaddingRight(); + getTotalPaddingRight();
widthSpec = MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.AT_MOST); widthSpec = MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.AT_MOST);
} }
} }

View file

@ -88,7 +88,8 @@
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingBottom="5dp"> android:paddingBottom="5dp">
<com.google.android.flexbox.FlexboxLayout xmlns:app="http://schemas.android.com/apk/res-auto" <com.google.android.flexbox.FlexboxLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/pictures" android:id="@+id/pictures"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"