Skip to content
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
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>

<meta-data
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/br/com/connectattoo/HomeUserActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class HomeUserActivity : AppCompatActivity() {
navController.addOnDestinationChangedListener { _, destination, _ ->
binding.homeTrue.isVisible = destination.id == R.id.homeUserFragment
binding.profileTrue.isVisible = destination.id == R.id.clientUserProfileFragment
binding.chatTrue.isVisible = destination.id == R.id.userChatFragment
binding.explorarTrue.isVisible = destination.id == R.id.userSearchFragment
}

binding.homeFalse.setOnClickListener {
Expand Down
31 changes: 31 additions & 0 deletions app/src/main/java/br/com/connectattoo/adapter/ChatAdapter.kt
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
Copy link
Copy Markdown
Contributor

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.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alterar a estrutura listChat.get(position).name para listChat[position].name.
A IDE chama a atenção desse aspecto. Não vai alterar a forma como o código funciona

}

inner class ChatViewHolder(binding: ChatUserItemLayoutBinding) : RecyclerView.ViewHolder(binding.root){

val name = binding.name

}
}
5 changes: 5 additions & 0 deletions app/src/main/java/br/com/connectattoo/data/MessageUser.kt
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
Expand Up @@ -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)


}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.
Na sua IDE baixe o plugin "EditorConfig". Habilite em Settings → Editor → Code Style → Enable EditorConfig support.
Vai te ajudar a fazer isso no momento que o arquivo for salvo.



}
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/amount_of_unread_message_item.xml
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>
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/status_chat_user.xml
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>
88 changes: 88 additions & 0 deletions app/src/main/res/layout/chat_user_item_layout.xml
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>
66 changes: 59 additions & 7 deletions app/src/main/res/layout/fragment_user_chat.xml
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>
10 changes: 10 additions & 0 deletions app/src/main/res/menu/menu.xml
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>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
<color name="gray400">#cbc9ca</color>
<color name="green">#037D00</color>
<color name="black25">#efefef</color>
<color name="green_status">#13be10</color>

</resources>
7 changes: 4 additions & 3 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
<item name="colorPrimary">@color/white</item>
<item name="android:windowLightStatusBar" tools:ignore="NewApi">true</item>
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimary</item>


</style>

<style name="Theme.Connectattoo" parent="Base.Theme.Connectattoo" />

<style name="CustomSearchBarTheme" parent="Theme.Material3.Light.NoActionBar">
<item name="android:backgroundTint">@color/white</item>
</style>
</resources>