Skip to content

Commit

Permalink
[FEAT/#5] 모임탐색 UI 구현
Browse files Browse the repository at this point in the history
[FEAT] 모임탐색 UI 구현
  • Loading branch information
kkk5474096 authored Dec 31, 2023
2 parents 88d28c9 + 57f0941 commit 6cb2b90
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".presentation.group.GroupListActivity"
android:exported="false" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.teumteum.teumteum.presentation.group

import android.os.Bundle
import android.widget.Toast
import com.teumteum.base.BindingActivity
import com.teumteum.domain.entity.Group
import com.teumteum.teumteum.R
import com.teumteum.teumteum.databinding.ActivityGroupListBinding

class GroupListActivity : BindingActivity<ActivityGroupListBinding>(R.layout.activity_group_list) {
private lateinit var adapter: GroupListAdapter

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initView()
}

private fun initView() {
binding.tvTitle.text = "모각작"

adapter = GroupListAdapter {
Toast.makeText(this, it.name, Toast.LENGTH_SHORT).show()
}

binding.rvGroupList.adapter = adapter
adapter.setItems(
listOf(
Group(1L, "모각작", "모여서 작업할 사람", "나는 소개", listOf("", ""), "1월 10일 오후 07:00"),
Group(2L, "모각작", "모여서 작업 안할 사람", "나는 소개", listOf("", ""), "1월 21일 오후 04:00"),
Group(3L, "모각작", "모여서 작업 하기 싫은 사람", "나는 소개", listOf("", ""), "1월 26일 오후 11:00"),
Group(4L, "모각작", "모여서 작업 하고 싶은 사람", "나는 소개", listOf("", ""), "2월 13일 오전 11:00"),
Group(5L, "모각작", "모일 사람", "나는 소개", listOf("", ""), "4월 06일 오후 04:00"),
Group(6L, "모각작", "안 모일 사람", "나는 소개", listOf("", ""), "11월 16일 오후 08:00"),
)
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.teumteum.teumteum.presentation.group

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.teumteum.domain.entity.Group
import com.teumteum.teumteum.databinding.ItemGroupListBinding

class GroupListAdapter(private val itemClick: (Group) -> (Unit)) :
RecyclerView.Adapter<GroupListAdapter.GroupListViewHolder>() {
private val groupList = mutableListOf<Group>()

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GroupListViewHolder {
val binding = ItemGroupListBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false,
)
return GroupListViewHolder(binding, itemClick)
}

override fun onBindViewHolder(holder: GroupListViewHolder, position: Int) {
holder.onBind(groupList[position])
}

override fun getItemCount(): Int = groupList.size

fun setItems(newItems: List<Group>) {
groupList.clear()
groupList.addAll(newItems)
notifyDataSetChanged()
}

class GroupListViewHolder(
private val binding: ItemGroupListBinding,
private val itemClick: (Group) -> (Unit)
) : RecyclerView.ViewHolder(binding.root) {
fun onBind(item: Group) {
binding.tvGroupName.text = item.name
binding.tvTitleBadge.text = item.topic
binding.tvDate.text = item.date

binding.root.setOnClickListener {
itemClick(item)
}
}
}
}
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/sample_left.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="M6.293,11.293C5.902,11.683 5.902,12.317 6.293,12.707L14.293,20.707C14.683,21.098 15.317,21.098 15.707,20.707C16.098,20.317 16.098,19.683 15.707,19.293L8.414,12L15.707,4.707C16.098,4.317 16.098,3.683 15.707,3.293C15.317,2.902 14.683,2.902 14.293,3.293L6.293,11.293Z"
android:fillColor="#191E28"
android:fillType="evenOdd"/>
</vector>
50 changes: 50 additions & 0 deletions app/src/main/res/layout/activity_group_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<layout 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">

<data>

</data>

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

<ImageView
android:id="@+id/iv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:src="@drawable/sample_left"
app:layout_constraintBottom_toBottomOf="@id/tv_title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_title"
app:tint="@color/black" />

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/pretendard_semibold"
android:paddingVertical="13dp"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="모여서 각자 작업" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_group_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title"
tools:listitem="@layout/item_group_list" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
67 changes: 67 additions & 0 deletions app/src/main/res/layout/item_group_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?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:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/tv_title_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@color/grey_50"
android:fontFamily="@font/pretendard_medium"
android:paddingHorizontal="6dp"
android:paddingVertical="4dp"
android:textColor="@color/grey_700"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@id/tv_group_name"
app:layout_constraintTop_toTopOf="parent"
tools:text="모각일" />

<TextView
android:id="@+id/tv_group_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/pretendard_medium"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title_badge"
tools:text="모여서 각자 일하기!" />

<TextView
android:id="@+id/tv_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="20dp"
android:textColor="@color/grey_700"
android:textSize="11sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/tv_group_name"
app:layout_constraintTop_toBottomOf="@id/tv_group_name"
tools:text="12월 10일 오후 7:00" />

<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginEnd="20dp"
android:background="@color/grey_500"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.6" />

<View
android:id="@+id/view_division_button"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/grey_100"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
10 changes: 10 additions & 0 deletions core/domain/src/main/java/com/teumteum/domain/entity/Group.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.teumteum.domain.entity

data class Group(
val id: Long,
val topic: String,
val name: String,
val introduction: String,
val photoUrls: List<String>,
val date: String
)

0 comments on commit 6cb2b90

Please sign in to comment.