mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2025-07-03 23:25:03 +00:00
Use RecyclerView for conversation messages
This commit is contained in:
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<android.support.constraint.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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<org.communiquons.android.comunic.client.ui.views.WebUserAccountImage
|
||||
android:id="@+id/account_image"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:src="@drawable/default_account_image"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_name"
|
||||
tools:text="John Doe"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/account_image"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message_body"
|
||||
tools:text="Hello man, how are you?"
|
||||
android:background="@drawable/conversation_message_otheruser_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="240dp"
|
||||
android:padding="8dp"
|
||||
android:textColor="@color/conversation_otheruser_messages_textColor"
|
||||
android:layout_marginTop="4dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/user_name"
|
||||
app:layout_constraintLeft_toRightOf="@+id/account_image"
|
||||
android:layout_marginStart="8dp" />
|
||||
|
||||
<!---<TextView
|
||||
android:id="@+id/text_message_time"
|
||||
tools:text="5min"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/message_body"
|
||||
android:layout_marginLeft="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/message_body" />-->
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
34
app/src/main/res/layout/conversation_message_item_sent.xml
Normal file
34
app/src/main/res/layout/conversation_message_item_sent.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<android.support.constraint.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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message_body"
|
||||
tools:text="Hello, hello!"
|
||||
android:background="@drawable/conversation_message_currentuser_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="240dp"
|
||||
android:padding="8dp"
|
||||
android:textColor="#ffffff"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--<TextView
|
||||
android:id="@+id/text_message_time"
|
||||
android:text="11:40"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="10sp"
|
||||
android:layout_marginRight="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/message_body"
|
||||
app:layout_constraintRight_toLeftOf="@+id/message_body" />-->
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
@ -27,7 +27,7 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- Messages -->
|
||||
<org.communiquons.android.comunic.client.ui.views.ScrollListView
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/fragment_conversation_messageslist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
|
@ -1,65 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fragment_conversation_message_item_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="User name" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fragment_conversation_message_item_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/fragment_conversation_message_otheruser_bg">
|
||||
|
||||
<org.communiquons.android.comunic.client.ui.views.WebUserAccountImage
|
||||
android:id="@+id/fragment_conversation_message_item_left_account_image"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/user_image_description"
|
||||
android:src="@drawable/default_account_image"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fragment_conversation_message_item_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center"
|
||||
android:padding="5dp"
|
||||
android:textColor="@color/conversation_otheruser_messages_textColor"
|
||||
tools:text="A message"/>
|
||||
|
||||
<org.communiquons.android.comunic.client.ui.views.EnlargeableWebImageView
|
||||
android:id="@+id/fragment_conversation_message_item_messageimage"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/fragment_conversation_message_image"
|
||||
android:scaleType="fitCenter"
|
||||
tools:background="@android:color/black"
|
||||
tools:layout_height="40dp"
|
||||
tools:layout_width="40dp"/>
|
||||
|
||||
<org.communiquons.android.comunic.client.ui.views.WebUserAccountImage
|
||||
android:id="@+id/fragment_conversation_message_item_right_account_image"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/user_image_description"
|
||||
android:src="@drawable/default_account_image"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
Reference in New Issue
Block a user