Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCCT-485 || Connect Messaging Implementation Part-1 #2870

Open
wants to merge 5 commits into
base: connect_qa
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 59 additions & 70 deletions app/AndroidManifest.xml

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions app/res/drawable/ic_connect_menu_3_dot.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M12,19.269C11.587,19.269 11.234,19.122 10.941,18.829C10.647,18.535 10.5,18.182 10.5,17.769C10.5,17.357 10.647,17.003 10.941,16.71C11.234,16.416 11.587,16.269 12,16.269C12.413,16.269 12.766,16.416 13.059,16.71C13.353,17.003 13.5,17.357 13.5,17.769C13.5,18.182 13.353,18.535 13.059,18.829C12.766,19.122 12.413,19.269 12,19.269ZM12,13.5C11.587,13.5 11.234,13.353 10.941,13.059C10.647,12.766 10.5,12.413 10.5,12C10.5,11.587 10.647,11.234 10.941,10.941C11.234,10.647 11.587,10.5 12,10.5C12.413,10.5 12.766,10.647 13.059,10.941C13.353,11.234 13.5,11.587 13.5,12C13.5,12.413 13.353,12.766 13.059,13.059C12.766,13.353 12.413,13.5 12,13.5ZM12,7.731C11.587,7.731 11.234,7.584 10.941,7.29C10.647,6.996 10.5,6.643 10.5,6.231C10.5,5.818 10.647,5.465 10.941,5.171C11.234,4.878 11.587,4.731 12,4.731C12.413,4.731 12.766,4.878 13.059,5.171C13.353,5.465 13.5,5.818 13.5,6.231C13.5,6.643 13.353,6.996 13.059,7.29C12.766,7.584 12.413,7.731 12,7.731Z"
android:fillColor="#ffffff"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions app/res/drawable/ic_connect_menu_notification.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M11.998,21.692C11.501,21.692 11.075,21.515 10.722,21.161C10.369,20.807 10.192,20.382 10.192,19.885H13.808C13.808,20.383 13.631,20.809 13.276,21.163C12.922,21.516 12.496,21.692 11.998,21.692ZM4.5,18.885V17.385H6.308V9.923C6.308,8.578 6.723,7.389 7.553,6.356C8.383,5.322 9.449,4.661 10.75,4.373V3.75C10.75,3.403 10.871,3.108 11.114,2.865C11.357,2.622 11.652,2.5 11.999,2.5C12.346,2.5 12.641,2.622 12.884,2.865C13.128,3.108 13.25,3.403 13.25,3.75V3.95C13.086,4.246 12.956,4.547 12.859,4.854C12.763,5.16 12.704,5.478 12.683,5.808C12.569,5.787 12.458,5.769 12.35,5.754C12.242,5.738 12.125,5.731 12,5.731C10.842,5.731 9.854,6.14 9.035,6.959C8.217,7.777 7.808,8.765 7.808,9.923V17.385H16.192V11.133C16.422,11.215 16.664,11.279 16.919,11.325C17.174,11.371 17.432,11.391 17.692,11.385V17.385H19.5V18.885H4.5ZM17.482,9.202C16.718,9.202 16.069,8.935 15.534,8.4C14.998,7.866 14.731,7.217 14.731,6.453C14.731,5.689 14.998,5.04 15.533,4.505C16.067,3.97 16.716,3.702 17.479,3.702C18.243,3.702 18.893,3.969 19.428,4.504C19.963,5.038 20.231,5.687 20.231,6.451C20.231,7.214 19.963,7.864 19.429,8.399C18.895,8.934 18.245,9.202 17.482,9.202Z"
android:fillColor="#ffffff"/>
</group>
</vector>
10 changes: 10 additions & 0 deletions app/res/drawable/ic_connect_menu_search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M14.76,13.27L20.49,19L19,20.49L13.27,14.76C12.2,15.53 10.91,16 9.5,16C5.91,16 3,13.09 3,9.5C3,5.91 5.91,3 9.5,3C13.09,3 16,5.91 16,9.5C16,10.91 15.53,12.2 14.76,13.27ZM9.5,5C7.01,5 5,7.01 5,9.5C5,11.99 7.01,14 9.5,14C11.99,14 14,11.99 14,9.5C14,7.01 11.99,5 9.5,5Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>
9 changes: 9 additions & 0 deletions app/res/drawable/ic_connect_message_editext_bg_24_border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/connect_message_sender_bg" />
<corners android:radius="50dp" />
<stroke
android:width="0.5dp"
android:color="@color/connect_divider_color" />
</shape>
13 changes: 13 additions & 0 deletions app/res/drawable/ic_connect_message_photo_camera.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M12,17.115C13.148,17.115 14.12,16.716 14.918,15.918C15.716,15.12 16.115,14.148 16.115,13C16.115,11.852 15.716,10.88 14.918,10.082C14.12,9.284 13.148,8.885 12,8.885C10.852,8.885 9.88,9.284 9.082,10.082C8.284,10.88 7.885,11.852 7.885,13C7.885,14.148 8.284,15.12 9.082,15.918C9.88,16.716 10.852,17.115 12,17.115ZM12,15.616C11.262,15.616 10.641,15.364 10.139,14.861C9.636,14.359 9.384,13.738 9.384,13C9.384,12.262 9.636,11.641 10.139,11.139C10.641,10.636 11.262,10.384 12,10.384C12.738,10.384 13.359,10.636 13.861,11.139C14.364,11.641 14.616,12.262 14.616,13C14.616,13.738 14.364,14.359 13.861,14.861C13.359,15.364 12.738,15.616 12,15.616ZM4.308,20.5C3.803,20.5 3.375,20.325 3.025,19.975C2.675,19.625 2.5,19.197 2.5,18.692V7.308C2.5,6.803 2.675,6.375 3.025,6.025C3.375,5.675 3.803,5.5 4.308,5.5H7.361L9.212,3.5H14.788L16.639,5.5H19.692C20.197,5.5 20.625,5.675 20.975,6.025C21.325,6.375 21.5,6.803 21.5,7.308V18.692C21.5,19.197 21.325,19.625 20.975,19.975C20.625,20.325 20.197,20.5 19.692,20.5H4.308ZM4.308,19H19.692C19.782,19 19.856,18.971 19.913,18.913C19.971,18.856 20,18.782 20,18.692V7.308C20,7.218 19.971,7.144 19.913,7.087C19.856,7.029 19.782,7 19.692,7H15.969L14.134,5H9.866L8.031,7H4.308C4.218,7 4.144,7.029 4.087,7.087C4.029,7.144 4,7.218 4,7.308V18.692C4,18.782 4.029,18.856 4.087,18.913C4.144,18.971 4.218,19 4.308,19Z"
android:fillColor="#150168"/>
</group>
</vector>
10 changes: 10 additions & 0 deletions app/res/drawable/ic_connect_message_read.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="14dp"
android:viewportWidth="16"
android:viewportHeight="14">
<path
android:pathData="M8.114,10.986L15.094,2.986L13.963,2L7.506,9.401L7.054,8.958L6.003,10.029L7.023,11.029L7.591,11.585L8.114,10.986ZM4.131,10.965L10.611,2.965L9.446,2.021L3.488,9.376L1.057,6.961L0,8.025L3.02,11.025L3.609,11.61L4.131,10.965Z"
android:fillColor="#3A42C7"
android:fillType="evenOdd"/>
</vector>
9 changes: 9 additions & 0 deletions app/res/drawable/ic_connect_message_receiver_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/connect_message_receiver_bg" />
<corners
android:bottomLeftRadius="16dp"
android:bottomRightRadius="16dp"
android:topRightRadius="16dp" />
</shape>
9 changes: 9 additions & 0 deletions app/res/drawable/ic_connect_message_receiver_edge.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="8dp"
android:viewportWidth="8"
android:viewportHeight="8">
<path
android:pathData="M8,8V0C8,0 8,0 2.3324,0C-5.2245,0 8,8 8,8Z"
android:fillColor="@color/connect_message_receiver_bg"/>
</vector>
Binary file added app/res/drawable/ic_connect_message_send.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions app/res/drawable/ic_connect_message_sender_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/connect_message_sender_bg" />
<corners
android:bottomLeftRadius="16dp"
android:bottomRightRadius="16dp"
android:topLeftRadius="16dp" />
</shape>
9 changes: 9 additions & 0 deletions app/res/drawable/ic_connect_message_sender_edge.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="8dp"
android:viewportWidth="8"
android:viewportHeight="8">
<path
android:pathData="M0,8V0C0,0 0,0 5.6677,0C13.2245,0 0,8 0,8Z"
android:fillColor="@color/connect_message_sender_bg"/>
</vector>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/res/drawable/ic_connect_message_unread.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="14dp"
android:viewportWidth="16"
android:viewportHeight="14">
<path
android:pathData="M8.114,10.986L15.094,2.986L13.963,2L7.506,9.401L7.054,8.958L6.003,10.029L7.023,11.029L7.591,11.585L8.114,10.986ZM4.131,10.965L10.611,2.965L9.446,2.021L3.488,9.376L1.057,6.961L0,8.025L3.02,11.025L3.609,11.61L4.131,10.965Z"
android:fillColor="#94A3B8"
android:fillType="evenOdd"/>
</vector>
22 changes: 22 additions & 0 deletions app/res/layout/activity_connect_messaging.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<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/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.commcare.activities.connect.ConnectMessagingActivity">

<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment_connect_messaging"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_graph_connect_messaging" />

</androidx.constraintlayout.widget.ConstraintLayout>
14 changes: 14 additions & 0 deletions app/res/layout/fragment_channel_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
tools:context="org.commcare.fragments.connectMessaging.ConnectMessageChannelListFragment">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvChannel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"/>

</androidx.constraintlayout.widget.ConstraintLayout>
72 changes: 72 additions & 0 deletions app/res/layout/fragment_connect_message.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context="org.commcare.fragments.connectMessaging.ConnectMessageFragment">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvChat"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginHorizontal="4dp"
android:orientation="vertical"
android:overScrollMode="never"
android:paddingBottom="10dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@+id/cardMessage"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<RelativeLayout
android:id="@+id/cardMessage"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginBottom="15dp"
android:layout_marginHorizontal="10dp"
android:background="@drawable/ic_connect_message_editext_bg_24_border"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/imgSendMessage"
app:layout_constraintStart_toStartOf="parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<!-- android:drawableEnd="@drawable/ic_connect_message_photo_camera"-->
<androidx.appcompat.widget.AppCompatEditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/etMessage"
android:background="@null"
android:hint="Type message"
android:textColorHint="@color/black"
android:inputType="textMultiLine"
android:gravity="center_vertical"
android:fontFamily="@font/roboto_medium"
android:paddingVertical="10dp"
android:textColor="@color/black"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:scrollbars="vertical"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>

<ImageView
android:id="@+id/imgSendMessage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="10dp"
android:visibility="gone"
android:src="@drawable/ic_connect_message_send"
app:layout_constraintBottom_toBottomOf="@+id/cardMessage"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/cardMessage" />
</androidx.constraintlayout.widget.ConstraintLayout>
91 changes: 91 additions & 0 deletions app/res/layout/item_channel.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:id="@+id/itemRootLayout"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:orientation="vertical">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<androidx.cardview.widget.CardView
android:id="@+id/imgChannel"
android:layout_width="45dp"
android:layout_height="45dp"
app:cardBackgroundColor="@color/connect_light_grey"
app:cardCornerRadius="7dp"
app:cardElevation="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<org.commcare.views.connect.connecttextview.ConnectMediumTextView
android:id="@+id/tvChannelName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="Channel Name"
android:textColor="@color/black"
android:textSize="15sp"
app:layout_constraintStart_toEndOf="@+id/imgChannel"
app:layout_constraintTop_toTopOf="@+id/imgChannel" />

<org.commcare.views.connect.connecttextview.ConnectRegularTextView
android:id="@+id/tvChannelDescription"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:text="message preview on top of the card..."
android:textColor="@color/connect_grey"
android:textSize="13sp"
app:layout_constraintEnd_toStartOf="@+id/tvLastChatTime"
app:layout_constraintStart_toEndOf="@+id/imgChannel"
app:layout_constraintTop_toBottomOf="@+id/tvChannelName" />

<org.commcare.views.connect.connecttextview.ConnectRegularTextView
android:id="@+id/tvLastChatTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:text="10:00"
android:textColor="@color/connect_grey"
android:textSize="13sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<org.commcare.views.connect.connecttextview.ConnectRegularTextView
android:id="@+id/tvUnreadCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="10dp"
android:background="@drawable/shape_border_10px_blue"
android:paddingHorizontal="8dp"
android:paddingVertical="2dp"
android:text="15"
android:textColor="@color/white"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvLastChatTime" />

</androidx.constraintlayout.widget.ConstraintLayout>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="2dp"
android:layout_marginHorizontal="10dp"
android:background="@color/connect_divider_color"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraint" />
</androidx.constraintlayout.widget.ConstraintLayout>
63 changes: 63 additions & 0 deletions app/res/layout/item_chat_left_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="5dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/edge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_connect_message_receiver_edge" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@+id/edge"
android:background="@drawable/ic_connect_message_receiver_bg"
android:orientation="vertical"
android:padding="10dp">

<org.commcare.views.connect.connecttextview.ConnectRegularTextView
android:id="@+id/tvChatMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_regular"
android:text="Some dummy text message from user A"
android:textColor="@color/white"
android:textSize="14sp" />

<org.commcare.views.connect.connecttextview.ConnectRegularTextView
android:id="@+id/tvUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="3dp"
android:fontFamily="@font/roboto_regular"
android:text="11:00 AM"
android:textColor="@color/white"
android:textSize="11sp" />

</LinearLayout>
</RelativeLayout>

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.7" />
</androidx.constraintlayout.widget.ConstraintLayout>
Loading