-
Notifications
You must be signed in to change notification settings - Fork 3
CT-42/CT-153 #72
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
base: develop
Are you sure you want to change the base?
CT-42/CT-153 #72
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package br.com.connectattoo.adapter | ||
|
|
||
| import android.content.Context | ||
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import androidx.recyclerview.widget.RecyclerView | ||
| import br.com.connectattoo.data.MessageUser | ||
| import br.com.connectattoo.databinding.ChatUserItemLayoutBinding | ||
|
|
||
| class ChatAdapter (private val context: Context, private val listChat: MutableList<MessageUser>): | ||
| RecyclerView.Adapter<ChatAdapter.ChatViewHolder>(){ | ||
|
|
||
|
|
||
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChatViewHolder { | ||
| val itemList = ChatUserItemLayoutBinding.inflate(LayoutInflater.from(context),parent, false) | ||
| return ChatViewHolder(itemList) | ||
| } | ||
|
|
||
| override fun getItemCount() = listChat.size | ||
|
|
||
| override fun onBindViewHolder(holder: ChatViewHolder, position: Int) { | ||
| holder.name.text = listChat.get(position).name | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alterar a estrutura |
||
| } | ||
|
|
||
| inner class ChatViewHolder(binding: ChatUserItemLayoutBinding) : RecyclerView.ViewHolder(binding.root){ | ||
|
|
||
| val name = binding.name | ||
|
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package br.com.connectattoo.data | ||
|
|
||
| data class MessageUser( | ||
| val name: String? = null | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,21 +3,60 @@ package br.com.connectattoo.ui.chat | |
|
|
||
| import android.view.LayoutInflater | ||
| import android.view.ViewGroup | ||
| import androidx.recyclerview.widget.GridLayoutManager | ||
| import androidx.recyclerview.widget.LinearLayoutManager | ||
| import br.com.connectattoo.R | ||
| import br.com.connectattoo.adapter.ChatAdapter | ||
| import br.com.connectattoo.data.MessageUser | ||
| import br.com.connectattoo.databinding.FragmentUserChatBinding | ||
| import br.com.connectattoo.ui.BaseFragment | ||
|
|
||
|
|
||
| class UserChatFragment : BaseFragment<FragmentUserChatBinding>() { | ||
|
|
||
| lateinit var adapterChat: ChatAdapter | ||
| var listChat: MutableList<MessageUser> = mutableListOf() | ||
|
|
||
| override fun inflateBinding( | ||
| inflater: LayoutInflater, | ||
| container: ViewGroup? | ||
| ): FragmentUserChatBinding { | ||
| return FragmentUserChatBinding.inflate(inflater, container, false) | ||
| } | ||
|
|
||
| override fun setupViews() = Unit | ||
| override fun setupViews(){ | ||
| val recyclerChat = binding.RecyclerViewChat | ||
| recyclerChat.layoutManager = LinearLayoutManager(context) | ||
| recyclerChat.setHasFixedSize(true) | ||
| adapterChat = ChatAdapter(requireContext(), listChat) | ||
| recyclerChat.adapter = adapterChat | ||
| messageItemList() | ||
| } | ||
|
|
||
| fun messageItemList(){ | ||
| val messade1 = MessageUser("Larissa Dias") | ||
| listChat.add(messade1) | ||
| val messade2 = MessageUser("Larissa Dias") | ||
| listChat.add(messade2) | ||
| val messade3 = MessageUser("Larissa Dias") | ||
| listChat.add(messade3) | ||
| val messade4 = MessageUser("Larissa Dias") | ||
| listChat.add(messade4) | ||
| val messade5 = MessageUser("Larissa Dias") | ||
| listChat.add(messade5) | ||
| val messade6 = MessageUser("Larissa Dias") | ||
| listChat.add(messade6) | ||
| val messade7 = MessageUser("Larissa Dias") | ||
| listChat.add(messade7) | ||
| val messade8 = MessageUser("Larissa Dias8") | ||
| listChat.add(messade8) | ||
| val messade9 = MessageUser("Larissa Dias9") | ||
| listChat.add(messade9) | ||
| val messade10 = MessageUser("Larissa Dias10") | ||
| listChat.add(messade10) | ||
|
|
||
|
|
||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fica ligado na estética do código. Remove os espaços desnecessários. |
||
|
|
||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:shape="oval"> | ||
|
|
||
| <solid android:color="@color/purple700"/> | ||
|
|
||
| </shape> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:shape="oval"> | ||
|
|
||
| <solid android:color="@color/green_status"/> | ||
|
|
||
| </shape> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:padding="5dp" | ||
| android:background="@color/black25" | ||
| xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
|
||
| <de.hdodenhof.circleimageview.CircleImageView | ||
| android:id="@+id/profileImage" | ||
| android:layout_width="60dp" | ||
| android:layout_height="60dp" | ||
| app:civ_border_color="@color/purple500" | ||
| app:civ_border_width="1dp" | ||
| android:layout_marginStart="8dp" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintBottom_toBottomOf="parent" | ||
| /> | ||
|
|
||
| <de.hdodenhof.circleimageview.CircleImageView | ||
| android:visibility="gone" | ||
| android:layout_width="10dp" | ||
| android:layout_height="10dp" | ||
| android:layout_marginTop="48dp" | ||
| android:layout_marginStart="-18dp" | ||
| android:background="@drawable/status_chat_user" | ||
| app:layout_constraintStart_toEndOf="@id/profileImage" | ||
| app:layout_constraintTop_toTopOf="parent" /> | ||
|
|
||
| <TextView | ||
| android:id="@+id/name" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Larissa Dias" | ||
| android:textColor="@color/purple700" | ||
| android:fontFamily="@font/raleway_extrabold" | ||
| android:textStyle="bold" | ||
| app:layout_constraintStart_toEndOf="@id/profileImage" | ||
| android:layout_marginStart="10dp" | ||
| android:layout_marginTop="10dp" | ||
| app:layout_constraintTop_toTopOf="parent"/> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Olá, estou interessada numa..." | ||
| android:textColor="@color/black" | ||
| android:fontFamily="@font/raleway_extrabold" | ||
| android:layout_marginTop="20dp" | ||
| android:layout_marginStart="10dp" | ||
| app:layout_constraintTop_toTopOf="@id/name" | ||
| app:layout_constraintStart_toEndOf="@id/profileImage"/> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Hoje, 12:25pm" | ||
| android:textSize="12sp" | ||
| android:layout_marginEnd="10dp" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintTop_toTopOf="parent"/> | ||
|
|
||
| <androidx.constraintlayout.widget.ConstraintLayout | ||
| android:id="@+id/amount_of_unread_message" | ||
| android:layout_width="25dp" | ||
| android:layout_height="25dp" | ||
| android:layout_marginEnd="10dp" | ||
| android:background="@drawable/amount_of_unread_message_item" | ||
| app:layout_constraintBottom_toBottomOf="parent" | ||
| app:layout_constraintEnd_toEndOf="parent"> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="1" | ||
| android:textColor="@color/white" | ||
| android:fontFamily="@font/raleway_semibold" | ||
| app:layout_constraintTop_toTopOf="parent" | ||
| app:layout_constraintBottom_toBottomOf="parent" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| /> | ||
|
|
||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||
|
|
||
|
|
||
|
|
||
| </androidx.constraintlayout.widget.ConstraintLayout> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,66 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| <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" | ||
| tools:context=".ui.chat.UserChatFragment"> | ||
| xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| tools:context=".ui.chat.UserChatFragment" | ||
| android:background="@color/black25"> | ||
|
|
||
| <!-- TODO: Update blank fragment layout --> | ||
| <TextView | ||
| <androidx.coordinatorlayout.widget.CoordinatorLayout | ||
| android:id="@+id/CoordinatorLayout" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:text="@string/hello_blank_fragment" /> | ||
| android:layout_height="wrap_content" | ||
| app:layout_constraintTop_toTopOf="parent"> | ||
|
|
||
| </FrameLayout> | ||
| <com.google.android.material.appbar.AppBarLayout | ||
| android:layout_width="match_parent" | ||
| android:layout_height="120dp" | ||
| android:background="@color/black25" | ||
| > | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:fontFamily="@font/raleway_extrabold" | ||
| android:text="Chat" | ||
| android:layout_marginStart="175dp" | ||
| android:layout_marginTop="15dp" | ||
| android:textColor="@color/black" | ||
| android:textSize="20sp" | ||
| android:textStyle="normal" /> | ||
|
|
||
| <com.google.android.material.search.SearchBar | ||
| android:id="@+id/search_bar" | ||
| android:layout_width="355dp" | ||
| android:layout_height="48dp" | ||
| android:layout_marginStart="30dp" | ||
| app:menu="@menu/menu" | ||
| app:tintNavigationIcon="false" | ||
| app:navigationIcon="@drawable/search_icon" | ||
| app:theme="@style/CustomSearchBarTheme" /> | ||
|
|
||
| </com.google.android.material.appbar.AppBarLayout> | ||
| </androidx.coordinatorlayout.widget.CoordinatorLayout> | ||
|
|
||
| <ScrollView | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:paddingBottom="130dp" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@id/CoordinatorLayout"> | ||
|
|
||
| <androidx.recyclerview.widget.RecyclerView | ||
| android:id="@+id/RecyclerViewChat" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginBottom="5dp" | ||
| android:clipToPadding="false" | ||
| android:orientation="vertical" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintStart_toStartOf="parent" /> | ||
| </ScrollView> | ||
|
|
||
| </androidx.constraintlayout.widget.ConstraintLayout> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
|
||
| <item | ||
| android:icon="@drawable/microphone_icon" | ||
| android:title="Voice Search" | ||
| app:showAsAction="always"/> | ||
|
|
||
| </menu> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remover importação não utilizada.