From f5bab798ee102b5f47de21e2abc00dd68068804c Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Mon, 2 Sep 2024 04:12:31 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[UI/#34]=20=EB=8D=B0=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=ED=94=BC=EC=BB=A4=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/layout/activity_sell_progress.xml | 6 +- .../src/main/res/layout/bottom_sheet_date.xml | 59 +++++++++++++++++++ presentation/src/main/res/values/strings.xml | 1 + 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 presentation/src/main/res/layout/bottom_sheet_date.xml diff --git a/presentation/src/main/res/layout/activity_sell_progress.xml b/presentation/src/main/res/layout/activity_sell_progress.xml index ded43044..a5e25c73 100644 --- a/presentation/src/main/res/layout/activity_sell_progress.xml +++ b/presentation/src/main/res/layout/activity_sell_progress.xml @@ -185,18 +185,18 @@ + app:layout_constraintTop_toBottomOf="@id/tv_sell_date_subtitle" /> + + + + + + + + + + + + + + + + + diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 4080a94b..665bc417 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -160,6 +160,7 @@ 판매 가격 받은 날짜 배송지 입력 기간 이내의 상품만 등록 가능합니다. + 클릭해서 날짜를 선택하세요 해당 상품이 맞나요? 네 맞아요 From 3f8d373173b64070a1251000deba99b72d57c759 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Mon, 2 Sep 2024 04:19:11 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[ADD/#34]=20=EB=8D=B0=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=ED=94=BC=EC=BB=A4=20=EC=B5=9C=EB=8C=80=20=EC=B5=9C=EC=86=8C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sell/progress/SellDateBottomSheet.kt | 44 +++++++++++++++++++ ...et_date.xml => bottom_sheet_sell_date.xml} | 0 2 files changed, 44 insertions(+) create mode 100644 presentation/src/main/java/co/orange/presentation/sell/progress/SellDateBottomSheet.kt rename presentation/src/main/res/layout/{bottom_sheet_date.xml => bottom_sheet_sell_date.xml} (100%) 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 new file mode 100644 index 00000000..a98428d7 --- /dev/null +++ b/presentation/src/main/java/co/orange/presentation/sell/progress/SellDateBottomSheet.kt @@ -0,0 +1,44 @@ +package co.orange.presentation.sell.progress + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.activityViewModels +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.util.Calendar + +class SellDateBottomSheet : + BaseBottomSheet(R.layout.bottom_sheet_sell_date) { + private val viewModel by activityViewModels() + + override fun onStart() { + super.onStart() + dialog?.window?.setBackgroundDrawableResource(R.color.transparent) + } + + override fun onViewCreated( + view: View, + savedInstanceState: Bundle?, + ) { + super.onViewCreated(view, savedInstanceState) + + initSubmitBtnListener() + setDatePicker() + } + + private fun initSubmitBtnListener() { + binding.btnSubmit.setOnSingleClickListener { } + } + + private fun setDatePicker() { + binding.dpSell.apply { + val calendar = Calendar.getInstance() + calendar.add(Calendar.DAY_OF_YEAR, -7) + minDate = calendar.timeInMillis + calendar.add(Calendar.DAY_OF_YEAR, 14) + maxDate = calendar.timeInMillis + } + } +} diff --git a/presentation/src/main/res/layout/bottom_sheet_date.xml b/presentation/src/main/res/layout/bottom_sheet_sell_date.xml similarity index 100% rename from presentation/src/main/res/layout/bottom_sheet_date.xml rename to presentation/src/main/res/layout/bottom_sheet_sell_date.xml From 61f5151054c45a1cefdc058e5ce1d40a17d1a709 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Mon, 2 Sep 2024 04:31:21 +0900 Subject: [PATCH 3/3] =?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