limiting the chat bubbles width to 70%

This commit is contained in:
tibbi 2020-04-03 22:24:05 +02:00
parent d8b00aa4c9
commit 9a47de4a30
4 changed files with 42 additions and 21 deletions

View File

@ -37,4 +37,5 @@ android {
dependencies {
implementation 'com.simplemobiletools:commons:5.24.11'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
}

View File

@ -91,7 +91,7 @@ class ThreadAdapter(
if (message.isReceivedMessage()) {
thread_message_body.setTextColor(textColor)
} else {
thread_message_holder.background.applyColorFilter(primaryColor.adjustAlpha(0.8f))
thread_message_wrapper.background.applyColorFilter(primaryColor.adjustAlpha(0.8f))
thread_message_body.setTextColor(primaryColor.getContrastColor())
}
}

View File

@ -1,19 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/thread_message_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:layout_marginBottom="@dimen/medium_margin"
android:background="@drawable/item_received_background"
android:padding="@dimen/activity_margin">
android:layout_marginBottom="@dimen/medium_margin">
<TextView
android:id="@+id/thread_message_body"
android:layout_width="match_parent"
<RelativeLayout
android:id="@+id/thread_message_wrapper"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="@dimen/normal_text_size"
tools:text="Received message" />
android:background="@drawable/item_received_background"
android:padding="@dimen/activity_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.7">
</RelativeLayout>
<TextView
android:id="@+id/thread_message_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/normal_text_size"
tools:text="Received message" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,19 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/thread_message_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:layout_marginBottom="@dimen/medium_margin"
android:background="@drawable/item_sent_background"
android:padding="@dimen/activity_margin">
android:layout_marginBottom="@dimen/medium_margin">
<TextView
android:id="@+id/thread_message_body"
android:layout_width="match_parent"
<RelativeLayout
android:id="@+id/thread_message_wrapper"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="@dimen/normal_text_size"
tools:text="Sent message" />
android:background="@drawable/item_sent_background"
android:padding="@dimen/activity_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.7">
</RelativeLayout>
<TextView
android:id="@+id/thread_message_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/normal_text_size"
tools:text="Sent message" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>