-
Notifications
You must be signed in to change notification settings - Fork 1
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
[feat] 이용예정/완료 뷰 구현 #12
Changes from all commits
48dc11c
a789ed5
96b426a
c404ee9
f6d8fbc
7c8681c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.sopt.tabling.data.model.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ResponseOrdersDto( | ||
@SerialName("order_id") | ||
val orderId: Int, | ||
@SerialName("order_status") | ||
val orderStatus: String, | ||
) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.sopt.tabling.domain.model | ||
|
||
sealed class ReservationItem { | ||
data class ReservationView( | ||
val reservationDate: String, | ||
val reserveNum: String, | ||
val reserveName: String, | ||
val waitingNum: String, | ||
val realWaitNum: String | ||
) : ReservationItem() | ||
|
||
data class ReservationDoneView( | ||
val reserveDate: String, | ||
val reserveNum: String, | ||
val reserveName: String, | ||
val remainReviewNum: String | ||
) : ReservationItem() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.sopt.tabling.presentation.common | ||
|
||
import androidx.lifecycle.ViewModel | ||
import org.sopt.tabling.domain.model.ReservationItem | ||
|
||
class ReservationViewModel : ViewModel() { | ||
// 가짜 데이터(이용예정) | ||
val mockReservationList = listOf( | ||
ReservationItem.ReservationView( | ||
reservationDate = "11월 24일 (금)", | ||
reserveNum = "2", | ||
reserveName = "파이브가이즈 여의도", | ||
waitingNum = "42", | ||
realWaitNum = "15", | ||
), | ||
ReservationItem.ReservationView( | ||
reservationDate = "11월 24일 (금)", | ||
reserveNum = "1", | ||
reserveName = "영덕집", | ||
waitingNum = "10", | ||
realWaitNum = "10", | ||
), | ||
ReservationItem.ReservationDoneView( | ||
reserveDate = "11월 24일 (금)", | ||
reserveName = "영덕집", | ||
reserveNum = "4", | ||
remainReviewNum = "3", | ||
), | ||
ReservationItem.ReservationDoneView( | ||
reserveDate = "11월 24일 (금)", | ||
reserveName = "봄불고기", | ||
reserveNum = "3", | ||
remainReviewNum = "3", | ||
), | ||
ReservationItem.ReservationDoneView( | ||
reserveDate = "11월 24일 (금)", | ||
reserveName = "요요마의 키친", | ||
reserveNum = "2", | ||
remainReviewNum = "3", | ||
), | ||
) | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.sopt.tabling.presentation.queue | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import org.sopt.tabling.databinding.FragmentQueueCancelBinding | ||
|
||
class QueueCancelFragment : Fragment() { | ||
private var _binding: FragmentQueueCancelBinding? = null | ||
private val binding get() = _binding!! | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle?, | ||
): View? { | ||
_binding = FragmentQueueCancelBinding.inflate(inflater, container, false) | ||
return binding.root | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.sopt.tabling.presentation.queue | ||
|
||
import android.os.Bundle | ||
import org.sopt.tabling.R | ||
import org.sopt.tabling.databinding.ActivityQueueDetailsBinding | ||
import org.sopt.tabling.util.binding.BindingActivity | ||
|
||
class QueueDetailsActivity : | ||
BindingActivity<ActivityQueueDetailsBinding>(R.layout.activity_queue_details) { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
val currentFragment = supportFragmentManager.findFragmentById(R.id.fcv_reservation) | ||
if (currentFragment == null) { | ||
supportFragmentManager.beginTransaction() | ||
.add(R.id.fcv_reservation, QueueReservationFragment()) | ||
.commit() | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.sopt.tabling.presentation.queue | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import androidx.fragment.app.viewModels | ||
import org.sopt.tabling.databinding.FragmentQueueReservationBinding | ||
import org.sopt.tabling.presentation.common.ReservationViewModel | ||
|
||
class QueueReservationFragment : Fragment() { | ||
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. 여기두요 !! |
||
private var _binding: FragmentQueueReservationBinding? = null | ||
private val binding: FragmentQueueReservationBinding | ||
get() = requireNotNull(_binding) { "바인딩 객체가 생성되지 않았습니다." } | ||
private val viewModel by viewModels<ReservationViewModel>() | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle?, | ||
): View? { | ||
_binding = FragmentQueueReservationBinding.inflate(inflater, container, false) | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
val reservationAdapter = ReservationAdapter(requireContext()) | ||
binding.rvReservationItems.adapter = reservationAdapter | ||
reservationAdapter.setReservationList(viewModel.mockReservationList) | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.sopt.tabling.presentation.queue | ||
|
||
import android.content.Context | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import org.sopt.tabling.databinding.ItemDoneReservationBinding | ||
import org.sopt.tabling.databinding.ItemReservationBinding | ||
import org.sopt.tabling.domain.model.ReservationItem | ||
|
||
class ReservationAdapter(context: Context) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { | ||
private val inflater by lazy { LayoutInflater.from(context) } | ||
|
||
private var reservationList: List<ReservationItem> = emptyList() | ||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { | ||
return when (viewType) { | ||
1 -> ReservationViewHolder( | ||
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. 상수 const로 빼주면 가독석 좋을 것 같아요 |
||
ItemReservationBinding.inflate(inflater, parent, false), | ||
) | ||
|
||
2 -> ReservationDoneViewHolder( | ||
ItemDoneReservationBinding.inflate(inflater, parent, false), | ||
) | ||
|
||
else -> throw RuntimeException() | ||
} | ||
} | ||
|
||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { | ||
when (holder) { | ||
is ReservationViewHolder -> holder.onBind(reservationList[position] as ReservationItem.ReservationView) | ||
is ReservationDoneViewHolder -> holder.onBind(reservationList[position] as ReservationItem.ReservationDoneView) | ||
} | ||
} | ||
|
||
override fun getItemViewType(position: Int): Int { | ||
return when (reservationList[position]) { | ||
is ReservationItem.ReservationView -> 1 | ||
is ReservationItem.ReservationDoneView -> 2 | ||
} | ||
} | ||
|
||
override fun getItemCount(): Int = reservationList.size | ||
|
||
fun setReservationList(mockReservationList: List<ReservationItem>) { | ||
reservationList = mockReservationList | ||
notifyDataSetChanged() | ||
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. 지은이두 !! 합세 끝나고 나중에라두 diffutil이랑 listAdapter 공부해보고 적용해보깅 ! 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.
넵!@!@@!첨 들어보는 군여.... 앱잼 전에 공부 마니마니 해야겟다 |
||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,15 @@ | ||||||
package org.sopt.tabling.presentation.queue | ||||||
|
||||||
import androidx.recyclerview.widget.RecyclerView | ||||||
import org.sopt.tabling.databinding.ItemDoneReservationBinding | ||||||
import org.sopt.tabling.domain.model.ReservationItem | ||||||
|
||||||
class ReservationDoneViewHolder(private val binding: ItemDoneReservationBinding) : | ||||||
RecyclerView.ViewHolder(binding.root) { | ||||||
fun onBind(item: ReservationItem.ReservationDoneView) { | ||||||
binding.tvReservationDate.text = item.reserveDate | ||||||
binding.tvReservationPeople.text = item.reserveNum + "명" | ||||||
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. 요런 것도 스트링 추출 해서 사용할 수 있어용
Suggested change
얘처럼 하면 됨요 ! 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. 데이터바인딩 안 쓰면 안 되는 군여...............ㅜㅜ 하아 데이터바인딩 공부도 얼른 해야되는데ㅜㅜㅜ 감사합니다 조은 방법 |
||||||
binding.tvStoreName.text = item.reserveName | ||||||
binding.tvRemainReviewNum.text = item.remainReviewNum + "일" | ||||||
} | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.sopt.tabling.presentation.queue | ||
|
||
import androidx.recyclerview.widget.RecyclerView | ||
import org.sopt.tabling.databinding.ItemReservationBinding | ||
import org.sopt.tabling.domain.model.ReservationItem | ||
|
||
class ReservationViewHolder(private val binding: ItemReservationBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
fun onBind(item: ReservationItem.ReservationView) { | ||
binding.tvReservationDate.text = item.reservationDate | ||
binding.tvReservationPeople.text = item.reserveNum + "명" | ||
binding.tvStoreName.text = item.reserveName | ||
binding.tvWaitingNum.text = item.waitingNum | ||
binding.tvWaitingInfoNum.text = item.realWaitNum + "팀" | ||
} | ||
} |
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="45dp" | ||
android:height="45dp" | ||
android:viewportWidth="45" | ||
android:viewportHeight="45"> | ||
<group> | ||
<clip-path | ||
android:pathData="M22.5,5.024L22.5,5.024A17.476,17.476 0,0 1,39.976 22.5L39.976,22.5A17.476,17.476 0,0 1,22.5 39.976L22.5,39.976A17.476,17.476 0,0 1,5.024 22.5L5.024,22.5A17.476,17.476 0,0 1,22.5 5.024z"/> | ||
<path | ||
android:pathData="M29.49,21.626H18.856L23.741,16.742L22.5,15.509L15.51,22.5L22.5,29.49L23.732,28.258L18.856,23.374H29.49V21.626Z" | ||
android:fillColor="#202026"/> | ||
</group> | ||
</vector> |
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="31dp" | ||
android:height="31dp" | ||
android:viewportWidth="31" | ||
android:viewportHeight="31"> | ||
<path | ||
android:pathData="M18.005,15.5L10.94,22.565L12.31,23.935L20.745,15.5L12.31,7.065L10.94,8.435L18.005,15.5Z" | ||
android:fillColor="#202026" | ||
android:fillType="evenOdd"/> | ||
</vector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/white" /> | ||
<corners android:radius="8dp" /> | ||
<stroke | ||
android:width="1dp" | ||
android:color="@color/gray_100" /> | ||
<size | ||
android:width="282dp" | ||
android:height="49dp" /> | ||
</shape> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="#FFFFFF" /> | ||
<corners android:radius="8dp" /> | ||
</shape> |
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.
BindingFragment 사용해줍시당
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.
잘,, 모르게쑵니다 넘 바빠서ㅜㅜㅜㅜ 학교 프젝 끝나구 찬찬히 공부해바도 될까여 엉엉😱😱😱
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.
그럽시당 !!