From 61f5151054c45a1cefdc058e5ce1d40a17d1a709 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Mon, 2 Sep 2024 04:31:21 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT/#34]=20=EB=8D=B0=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=ED=94=BC=EC=BB=A4=20=EA=B2=B0=EA=B3=BC=EA=B0=92=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sell/progress/SellDateBottomSheet.kt | 16 +++++++++++++++- .../sell/progress/SellProgressViewModel.kt | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/presentation/src/main/java/co/orange/presentation/sell/progress/SellDateBottomSheet.kt b/presentation/src/main/java/co/orange/presentation/sell/progress/SellDateBottomSheet.kt index a98428d7..3bab71b4 100644 --- a/presentation/src/main/java/co/orange/presentation/sell/progress/SellDateBottomSheet.kt +++ b/presentation/src/main/java/co/orange/presentation/sell/progress/SellDateBottomSheet.kt @@ -7,7 +7,9 @@ import co.orange.core.base.BaseBottomSheet import co.orange.core.extension.setOnSingleClickListener import kr.genti.presentation.R import kr.genti.presentation.databinding.BottomSheetSellDateBinding +import java.text.SimpleDateFormat import java.util.Calendar +import java.util.Locale class SellDateBottomSheet : BaseBottomSheet(R.layout.bottom_sheet_sell_date) { @@ -29,9 +31,21 @@ class SellDateBottomSheet : } private fun initSubmitBtnListener() { - binding.btnSubmit.setOnSingleClickListener { } + binding.btnSubmit.setOnSingleClickListener { + viewModel.sellDate = getDateFromDatePicker() + dismiss() + } } + private fun getDateFromDatePicker(): String = + with(binding.dpSell) { + SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format( + Calendar.getInstance().apply { + set(year, month, dayOfMonth) + }.time, + ) + } + private fun setDatePicker() { binding.dpSell.apply { val calendar = Calendar.getInstance() diff --git a/presentation/src/main/java/co/orange/presentation/sell/progress/SellProgressViewModel.kt b/presentation/src/main/java/co/orange/presentation/sell/progress/SellProgressViewModel.kt index 3d67ecf3..1c2d25a9 100644 --- a/presentation/src/main/java/co/orange/presentation/sell/progress/SellProgressViewModel.kt +++ b/presentation/src/main/java/co/orange/presentation/sell/progress/SellProgressViewModel.kt @@ -20,6 +20,8 @@ class SellProgressViewModel var productId = "" var isAccountExist = false + var sellDate = "" + private val _getProductState = MutableStateFlow>(UiState.Empty) val getProductState: StateFlow> = _getProductState