From 6e955ab0226e1e09593fdc4cf4004619d63337d1 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Fri, 14 Jun 2024 10:25:44 +0900 Subject: [PATCH 01/11] =?UTF-8?q?[UI/#15]=20=ED=91=B8=EC=8B=9C=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=EB=B7=B0=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/drawable/ic_push_alarm.xml | 35 ++++++++ .../src/main/res/layout/activity_push.xml | 88 +++++++++++++++++++ presentation/src/main/res/values/strings.xml | 5 ++ 3 files changed, 128 insertions(+) create mode 100644 presentation/src/main/res/drawable/ic_push_alarm.xml create mode 100644 presentation/src/main/res/layout/activity_push.xml diff --git a/presentation/src/main/res/drawable/ic_push_alarm.xml b/presentation/src/main/res/drawable/ic_push_alarm.xml new file mode 100644 index 00000000..23bd1abc --- /dev/null +++ b/presentation/src/main/res/drawable/ic_push_alarm.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + diff --git a/presentation/src/main/res/layout/activity_push.xml b/presentation/src/main/res/layout/activity_push.xml new file mode 100644 index 00000000..80838ecd --- /dev/null +++ b/presentation/src/main/res/layout/activity_push.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 02e2092a..a431357d 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -34,4 +34,9 @@ *각인 옵션은 사용할 수 없습니다. 구매하기 + + 푸시 알림이\n설정되어 있지 않아요! + 원만한 거래를 위해서는\n푸시알림 설정이 필요해요 + 나중에 받을게요 + 알림받기 \ No newline at end of file From 2dae8cc9296a5f5df3019f129a82127d833d552a Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Fri, 14 Jun 2024 10:57:28 +0900 Subject: [PATCH 02/11] =?UTF-8?q?[FEAT/#15]=20=ED=91=B8=EC=8B=9C=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=EB=B7=B0=20=EB=A6=AC=EC=8A=A4=EB=84=88=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../buy/confirm/BuyConfirmActivity.kt | 9 ++- .../presentation/buy/push/BuyPushActivity.kt | 60 +++++++++++++++++++ .../src/main/res/layout/activity_push.xml | 2 +- 3 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt diff --git a/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmActivity.kt b/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmActivity.kt index f4d45727..53626dd2 100644 --- a/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmActivity.kt @@ -4,6 +4,7 @@ import android.content.Context import android.content.Intent import android.os.Bundle import androidx.activity.viewModels +import co.orange.presentation.buy.push.BuyPushActivity import coil.load import dagger.hilt.android.AndroidEntryPoint import kr.genti.core.base.BaseActivity @@ -45,8 +46,12 @@ class BuyConfirmActivity : BaseActivity(R.layout.acti } private fun initConfirmBtnListener() { - // TODO - binding.btnConfirmPurchase.setOnSingleClickListener { } + binding.btnConfirmPurchase.setOnSingleClickListener { + // TODO 구매 요청 서버통신 이후 + BuyPushActivity.createIntent(this, viewModel.imageUrl, viewModel.name).apply { + startActivity(this) + } + } } private fun getIntentInfo() { diff --git a/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt b/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt new file mode 100644 index 00000000..292055b9 --- /dev/null +++ b/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt @@ -0,0 +1,60 @@ +package co.orange.presentation.buy.push + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import dagger.hilt.android.AndroidEntryPoint +import kr.genti.core.base.BaseActivity +import kr.genti.core.extension.setOnSingleClickListener +import kr.genti.presentation.R +import kr.genti.presentation.databinding.ActivityPushBinding + +@AndroidEntryPoint +class BuyPushActivity : BaseActivity(R.layout.activity_push) { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + initExitBtnListener() + initAlarmBtnListener() + } + + private fun initExitBtnListener() { + with(binding) { + btnExit.setOnSingleClickListener { + navigateToFinishedActivity() + } + btnLater.setOnSingleClickListener { + navigateToFinishedActivity() + } + } + } + + private fun initAlarmBtnListener() { + binding.btnAlarm.setOnSingleClickListener { + // TODO 푸시알람 + navigateToFinishedActivity() + } + } + + private fun navigateToFinishedActivity() { + val imageUrl = intent.getStringExtra(EXTRA_PRODUCT_URL).orEmpty() + val name = intent.getStringExtra(EXTRA_NAME).orEmpty() + + } + + companion object { + private const val EXTRA_PRODUCT_URL = "EXTRA_PRODUCT_URL" + private const val EXTRA_NAME = "EXTRA_NAME" + + @JvmStatic + fun createIntent( + context: Context, + productUrl: String, + name: String + ): Intent = Intent(context, BuyPushActivity::class.java).apply { + putExtra(EXTRA_PRODUCT_URL, productUrl) + putExtra(EXTRA_NAME, name) + } + } +} \ No newline at end of file diff --git a/presentation/src/main/res/layout/activity_push.xml b/presentation/src/main/res/layout/activity_push.xml index 80838ecd..0f8199f2 100644 --- a/presentation/src/main/res/layout/activity_push.xml +++ b/presentation/src/main/res/layout/activity_push.xml @@ -83,6 +83,6 @@ app:layout_constraintBottom_toTopOf="@id/btn_later" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> - + \ No newline at end of file From 00dc6578999dc4230c4245aee00c325e93ee933d Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Fri, 14 Jun 2024 10:58:06 +0900 Subject: [PATCH 03/11] =?UTF-8?q?[ADD/#13]=20=EA=B5=AC=EB=A7=A4=ED=91=B8?= =?UTF-8?q?=EC=8B=9C=EB=B7=B0=20manifest=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0b4ff4e2..0293b156 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -36,6 +36,11 @@ android:exported="false" android:screenOrientation="portrait" /> + + \ No newline at end of file From 34c0a9f5e0f730d4d8d5a2b3102d7f2494db37de Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Fri, 14 Jun 2024 11:08:11 +0900 Subject: [PATCH 04/11] =?UTF-8?q?[ADD/#15]=20=EA=B5=AC=EB=A7=A4=EC=99=84?= =?UTF-8?q?=EB=A3=8C=EB=B7=B0=20data=20class=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/entity/response/AddressInfoModel.kt | 8 ++++++++ .../orange/domain/entity/response/BuyInfoModel.kt | 10 ++++++++++ .../domain/entity/response/PaymentInfoModel.kt | 6 ++++++ .../orange/presentation/buy/push/BuyPushActivity.kt | 1 + .../src/main/res/layout/activity_buy_confirm.xml | 2 +- .../src/main/res/layout/activity_buy_finished.xml | 13 +++++++++++++ 6 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 domain/src/main/kotlin/co/orange/domain/entity/response/AddressInfoModel.kt create mode 100644 domain/src/main/kotlin/co/orange/domain/entity/response/BuyInfoModel.kt create mode 100644 domain/src/main/kotlin/co/orange/domain/entity/response/PaymentInfoModel.kt create mode 100644 presentation/src/main/res/layout/activity_buy_finished.xml diff --git a/domain/src/main/kotlin/co/orange/domain/entity/response/AddressInfoModel.kt b/domain/src/main/kotlin/co/orange/domain/entity/response/AddressInfoModel.kt new file mode 100644 index 00000000..7ed6eaab --- /dev/null +++ b/domain/src/main/kotlin/co/orange/domain/entity/response/AddressInfoModel.kt @@ -0,0 +1,8 @@ +package co.orange.domain.entity.response + +data class AddressInfoModel( + val recipient: String, + val zipCode: Int, + val address: String, + val phone: String +) \ No newline at end of file diff --git a/domain/src/main/kotlin/co/orange/domain/entity/response/BuyInfoModel.kt b/domain/src/main/kotlin/co/orange/domain/entity/response/BuyInfoModel.kt new file mode 100644 index 00000000..90e0b468 --- /dev/null +++ b/domain/src/main/kotlin/co/orange/domain/entity/response/BuyInfoModel.kt @@ -0,0 +1,10 @@ +package co.orange.domain.entity.response + +data class BuyInfoModel( + val addressInfo: List, + val paymentInfo: List, + val originPrice: Int, + val discountPrice: Int, + val charge: Int, + val totalPrice: Int, +) \ No newline at end of file diff --git a/domain/src/main/kotlin/co/orange/domain/entity/response/PaymentInfoModel.kt b/domain/src/main/kotlin/co/orange/domain/entity/response/PaymentInfoModel.kt new file mode 100644 index 00000000..1e6c46f3 --- /dev/null +++ b/domain/src/main/kotlin/co/orange/domain/entity/response/PaymentInfoModel.kt @@ -0,0 +1,6 @@ +package co.orange.domain.entity.response + +data class PaymentInfoModel( + val method: String, + val completedAt: String +) \ No newline at end of file diff --git a/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt b/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt index 292055b9..d1f2fe79 100644 --- a/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt @@ -15,6 +15,7 @@ class BuyPushActivity : BaseActivity(R.layout.activity_push override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + // TODO: 뒤로가기 방지 추가 initExitBtnListener() initAlarmBtnListener() } diff --git a/presentation/src/main/res/layout/activity_buy_confirm.xml b/presentation/src/main/res/layout/activity_buy_confirm.xml index b80c99f1..fef51433 100644 --- a/presentation/src/main/res/layout/activity_buy_confirm.xml +++ b/presentation/src/main/res/layout/activity_buy_confirm.xml @@ -36,7 +36,7 @@ android:id="@+id/btn_exit" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="20dp" + android:layout_marginEnd="8dp" android:padding="12dp" android:src="@drawable/ic_exit" app:layout_constraintBottom_toBottomOf="@id/tv_confirm_title" diff --git a/presentation/src/main/res/layout/activity_buy_finished.xml b/presentation/src/main/res/layout/activity_buy_finished.xml new file mode 100644 index 00000000..67ed5d4c --- /dev/null +++ b/presentation/src/main/res/layout/activity_buy_finished.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file From 3a525f70c52f511d67a0faf4077c5eb3b9493b18 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Sat, 15 Jun 2024 19:36:15 +0900 Subject: [PATCH 05/11] =?UTF-8?q?[UI/#15]=20=EA=B5=AC=EB=A7=A4=EC=99=84?= =?UTF-8?q?=EB=A3=8C=EB=B7=B0=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/drawable/ic_check_circle.xml | 9 + .../res/drawable/shape_black_line_10_rect.xml | 6 + .../res/drawable/shape_gray2_line_10_rect.xml | 6 + .../main/res/layout/activity_buy_confirm.xml | 2 +- .../main/res/layout/activity_buy_finished.xml | 394 +++++++++++++++++- presentation/src/main/res/values/strings.xml | 14 + 6 files changed, 429 insertions(+), 2 deletions(-) create mode 100644 presentation/src/main/res/drawable/ic_check_circle.xml create mode 100644 presentation/src/main/res/drawable/shape_black_line_10_rect.xml create mode 100644 presentation/src/main/res/drawable/shape_gray2_line_10_rect.xml diff --git a/presentation/src/main/res/drawable/ic_check_circle.xml b/presentation/src/main/res/drawable/ic_check_circle.xml new file mode 100644 index 00000000..0b5448e2 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_check_circle.xml @@ -0,0 +1,9 @@ + + + diff --git a/presentation/src/main/res/drawable/shape_black_line_10_rect.xml b/presentation/src/main/res/drawable/shape_black_line_10_rect.xml new file mode 100644 index 00000000..9db14977 --- /dev/null +++ b/presentation/src/main/res/drawable/shape_black_line_10_rect.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/drawable/shape_gray2_line_10_rect.xml b/presentation/src/main/res/drawable/shape_gray2_line_10_rect.xml new file mode 100644 index 00000000..7f438bf9 --- /dev/null +++ b/presentation/src/main/res/drawable/shape_gray2_line_10_rect.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/layout/activity_buy_confirm.xml b/presentation/src/main/res/layout/activity_buy_confirm.xml index fef51433..321f9e48 100644 --- a/presentation/src/main/res/layout/activity_buy_confirm.xml +++ b/presentation/src/main/res/layout/activity_buy_confirm.xml @@ -280,7 +280,7 @@ + android:src="@drawable/ic_check_circle" /> - + @@ -9,5 +11,395 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index a431357d..1fe9cd8c 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -39,4 +39,18 @@ 원만한 거래를 위해서는\n푸시알림 설정이 필요해요 나중에 받을게요 알림받기 + + 주문 완료 + 주문 완료되었습니다 + 주문 확인 후 거래가 진행됩니다. + 배송지 + 거래 정보 + 결제 수단 + 결제 일자 + 결제 정보 + 상품 금액 + 할인가 + 수수료 + 계속 쇼핑하기 + 상세 내역 보러가기 \ No newline at end of file From 49d5a6bc8d6a0ad822f35a0747e46b45be10bfdd Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Sat, 15 Jun 2024 20:36:24 +0900 Subject: [PATCH 06/11] =?UTF-8?q?[FIX/#15]=20=EA=B5=AC=EB=A7=A4=EC=A7=84?= =?UTF-8?q?=ED=96=89=EB=B7=B0=20=EC=84=9C=EB=B2=84=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EC=82=AC=ED=95=AD=20=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/response/AddressInfoModel.kt | 2 +- .../domain/entity/response/BuyInfoModel.kt | 5 +- .../buy/confirm/BuyConfirmActivity.kt | 56 ++++++++----------- .../buy/confirm/BuyConfirmViewModel.kt | 23 ++++++-- .../presentation/buy/push/BuyPushActivity.kt | 13 ++--- presentation/src/main/res/values/strings.xml | 3 + 6 files changed, 53 insertions(+), 49 deletions(-) diff --git a/domain/src/main/kotlin/co/orange/domain/entity/response/AddressInfoModel.kt b/domain/src/main/kotlin/co/orange/domain/entity/response/AddressInfoModel.kt index 7ed6eaab..cbcecb88 100644 --- a/domain/src/main/kotlin/co/orange/domain/entity/response/AddressInfoModel.kt +++ b/domain/src/main/kotlin/co/orange/domain/entity/response/AddressInfoModel.kt @@ -2,7 +2,7 @@ package co.orange.domain.entity.response data class AddressInfoModel( val recipient: String, - val zipCode: Int, + val zipCode: String, val address: String, val phone: String ) \ No newline at end of file diff --git a/domain/src/main/kotlin/co/orange/domain/entity/response/BuyInfoModel.kt b/domain/src/main/kotlin/co/orange/domain/entity/response/BuyInfoModel.kt index 90e0b468..42404921 100644 --- a/domain/src/main/kotlin/co/orange/domain/entity/response/BuyInfoModel.kt +++ b/domain/src/main/kotlin/co/orange/domain/entity/response/BuyInfoModel.kt @@ -1,9 +1,10 @@ package co.orange.domain.entity.response data class BuyInfoModel( - val addressInfo: List, - val paymentInfo: List, + val productName: String, + val imgUrl: String, val originPrice: Int, + val addressInfo: List, val discountPrice: Int, val charge: Int, val totalPrice: Int, diff --git a/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmActivity.kt b/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmActivity.kt index 53626dd2..1d248cf3 100644 --- a/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmActivity.kt @@ -4,6 +4,7 @@ import android.content.Context import android.content.Intent import android.os.Bundle import androidx.activity.viewModels +import co.orange.domain.entity.response.BuyInfoModel import co.orange.presentation.buy.push.BuyPushActivity import coil.load import dagger.hilt.android.AndroidEntryPoint @@ -25,7 +26,7 @@ class BuyConfirmActivity : BaseActivity(R.layout.acti initTermBtnListener() initConfirmBtnListener() getIntentInfo() - setIntentUi() + setIntentUi(viewModel.mockBuyInfo) } private fun initExitBtnListener() { @@ -34,67 +35,54 @@ class BuyConfirmActivity : BaseActivity(R.layout.acti private fun initDeliveryChangeBtnListener() { // TODO - binding.btnChangeDelivery.setOnSingleClickListener { } + binding.btnChangeDelivery.setOnSingleClickListener { } } private fun initTermBtnListener() { //TODO - binding.btnTermAll.setOnSingleClickListener { } - binding.btnTermFirst.setOnSingleClickListener { } - binding.btnTermSecond.setOnSingleClickListener { } - binding.btnTermThird.setOnSingleClickListener { } + binding.btnTermAll.setOnSingleClickListener { } + binding.btnTermFirst.setOnSingleClickListener { } + binding.btnTermSecond.setOnSingleClickListener { } + binding.btnTermThird.setOnSingleClickListener { } } private fun initConfirmBtnListener() { binding.btnConfirmPurchase.setOnSingleClickListener { // TODO 구매 요청 서버통신 이후 - BuyPushActivity.createIntent(this, viewModel.imageUrl, viewModel.name).apply { + BuyPushActivity.createIntent(this, viewModel.productId).apply { startActivity(this) } } } private fun getIntentInfo() { - with(viewModel) { - imageUrl = intent.getStringExtra(EXTRA_PRODUCT_URL).orEmpty() - originPrice = intent.getIntExtra(EXTRA_ORIGIN_PRICE, 0) - salePrice = intent.getIntExtra(EXTRA_SALE_PRICE, 0) - name = intent.getStringExtra(EXTRA_NAME).orEmpty() - } + viewModel.productId = intent.getLongExtra(EXTRA_PRODUCT_ID, -1) } - private fun setIntentUi() { + private fun setIntentUi(item: BuyInfoModel) { with(binding) { - tvConfirmProductName.text = viewModel.name - ivConfirmProduct.load(viewModel.imageUrl) - tvConfirmProductPrice.text = viewModel.salePrice.setNumberForm() - tvConfirmPriceMoney.text = viewModel.salePrice.setNumberForm() - // TODO - tvConfirmPriceDiscount.text = "-3,000" - tvConfirmPriceCharge.text = "+350" - tvConfirmPriceTotal.text = "21,350" + tvConfirmProductName.text = item.productName + ivConfirmProduct.load(item.imgUrl) + tvConfirmProductPrice.text = item.originPrice.setNumberForm() + tvConfirmPriceMoney.text = item.originPrice.setNumberForm() + tvConfirmPriceDiscount.text = + getString(R.string.add_minus, item.discountPrice.setNumberForm()) + tvConfirmPriceCharge.text = + getString(R.string.add_plus, item.charge.setNumberForm()) + tvConfirmPriceTotal.text = item.totalPrice.setNumberForm() } } companion object { - private const val EXTRA_PRODUCT_URL = "EXTRA_PRODUCT_URL" - private const val EXTRA_ORIGIN_PRICE = "EXTRA_ORIGIN_PRICE" - private const val EXTRA_SALE_PRICE = "EXTRA_SALE_PRICE" - private const val EXTRA_NAME = "EXTRA_NAME" + private const val EXTRA_PRODUCT_ID = "EXTRA_PRODUCT_ID" @JvmStatic fun createIntent( context: Context, - productUrl: String, - originPrice: Int, - salePrice: Int, - name: String + productId: Long ): Intent = Intent(context, BuyConfirmActivity::class.java).apply { - putExtra(EXTRA_PRODUCT_URL, productUrl) - putExtra(EXTRA_ORIGIN_PRICE, originPrice) - putExtra(EXTRA_SALE_PRICE, salePrice) - putExtra(EXTRA_NAME, name) + putExtra(EXTRA_PRODUCT_ID, productId) } } } \ No newline at end of file diff --git a/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmViewModel.kt b/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmViewModel.kt index d3ad63d3..4730655f 100644 --- a/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmViewModel.kt +++ b/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmViewModel.kt @@ -1,6 +1,8 @@ package co.orange.presentation.buy.confirm import androidx.lifecycle.ViewModel +import co.orange.domain.entity.response.AddressInfoModel +import co.orange.domain.entity.response.BuyInfoModel import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject @@ -11,9 +13,22 @@ constructor( // private val feedRepository: FeedRepository, ) : ViewModel() { - var imageUrl: String = "" - var originPrice: Int = 0 - var salePrice: Int = 0 - var name: String = "" + var productId: Long = -1 + val mockBuyInfo = BuyInfoModel( + "상품이름은 한줄로만 보여줄거에야야야야야야", + "https://github.com/Marchbreeze/Marchbreeze/assets/97405341/cd2c0454-92b4-41e7-ae2f-319f83e2426f", + 24000, + listOf( + AddressInfoModel( + "김상호", + "04567", + "서울특벌시 성동구 성수이로 137 107동 903호", + "010-3259-0327" + ) + ), + 3000, + 350, + 21350 + ) } \ No newline at end of file diff --git a/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt b/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt index d1f2fe79..8b63985a 100644 --- a/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt @@ -38,24 +38,21 @@ class BuyPushActivity : BaseActivity(R.layout.activity_push } } + private fun navigateToFinishedActivity() { - val imageUrl = intent.getStringExtra(EXTRA_PRODUCT_URL).orEmpty() - val name = intent.getStringExtra(EXTRA_NAME).orEmpty() + val productId = intent.getStringExtra(EXTRA_PRODUCT_ID).orEmpty() } companion object { - private const val EXTRA_PRODUCT_URL = "EXTRA_PRODUCT_URL" - private const val EXTRA_NAME = "EXTRA_NAME" + private const val EXTRA_PRODUCT_ID = "EXTRA_PRODUCT_ID" @JvmStatic fun createIntent( context: Context, - productUrl: String, - name: String + productId: Long, ): Intent = Intent(context, BuyPushActivity::class.java).apply { - putExtra(EXTRA_PRODUCT_URL, productUrl) - putExtra(EXTRA_NAME, name) + putExtra(EXTRA_PRODUCT_ID, productId) } } } \ No newline at end of file diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 1fe9cd8c..c8439924 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -11,6 +11,9 @@ Billing Manager is not initialized Unknown View Type : %d + +%s + -%s + 마이페이지 From 61bfaead1afb3a9aeee5bd307f70f1e874da3b8c Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Sat, 15 Jun 2024 20:47:30 +0900 Subject: [PATCH 07/11] =?UTF-8?q?[ADD/#15]=20=EA=B5=AC=EB=A7=A4=EC=83=81?= =?UTF-8?q?=EC=84=B8=20data=20class=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/entity/response/BuyDetailModel.kt | 17 +++++++++++++++++ .../co/orange/domain/enums/OrderStatus.kt | 5 +++++ 2 files changed, 22 insertions(+) create mode 100644 domain/src/main/kotlin/co/orange/domain/entity/response/BuyDetailModel.kt create mode 100644 domain/src/main/kotlin/co/orange/domain/enums/OrderStatus.kt diff --git a/domain/src/main/kotlin/co/orange/domain/entity/response/BuyDetailModel.kt b/domain/src/main/kotlin/co/orange/domain/entity/response/BuyDetailModel.kt new file mode 100644 index 00000000..92b058a6 --- /dev/null +++ b/domain/src/main/kotlin/co/orange/domain/entity/response/BuyDetailModel.kt @@ -0,0 +1,17 @@ +package co.orange.domain.entity.response + +import co.orange.domain.enums.OrderStatus + +data class BuyDetailModel( + val orderId: Long, + val orderStatus: OrderStatus, + val productName: String, + val imgUrl: String, + val originPrice: Int, + val sellerNickname: String, + val addressInfo: List, + val paymentInfoModel: List, + val discountPrice: Int, + val charge: Int, + val totalPrice: Int, +) \ No newline at end of file diff --git a/domain/src/main/kotlin/co/orange/domain/enums/OrderStatus.kt b/domain/src/main/kotlin/co/orange/domain/enums/OrderStatus.kt new file mode 100644 index 00000000..fe36c2d7 --- /dev/null +++ b/domain/src/main/kotlin/co/orange/domain/enums/OrderStatus.kt @@ -0,0 +1,5 @@ +package co.orange.domain.enums + +enum class OrderStatus { + ORDER_PLACED, SHIPPING, COMPLETED, CANCELLED +} \ No newline at end of file From e985f95b0c010bfc94244e22f93120a9ce9f29a9 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Sat, 15 Jun 2024 20:53:36 +0900 Subject: [PATCH 08/11] =?UTF-8?q?[ADD/#15]=20BuyFinishedActivity=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 --- .../buy/finished/BuyFinishedActivity.kt | 79 +++++++++++++++++++ .../buy/finished/BuyFinishedViewModel.kt | 34 ++++++++ 2 files changed, 113 insertions(+) create mode 100644 presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt create mode 100644 presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedViewModel.kt diff --git a/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt b/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt new file mode 100644 index 00000000..8f92bdd5 --- /dev/null +++ b/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt @@ -0,0 +1,79 @@ +package co.orange.presentation.buy.finished + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import androidx.activity.viewModels +import co.orange.domain.entity.response.BuyInfoModel +import co.orange.presentation.main.MainActivity +import coil.load +import dagger.hilt.android.AndroidEntryPoint +import kr.genti.core.base.BaseActivity +import kr.genti.core.extension.setNumberForm +import kr.genti.core.extension.setOnSingleClickListener +import kr.genti.presentation.R +import kr.genti.presentation.databinding.ActivityBuyFinishedBinding + +@AndroidEntryPoint +class BuyFinishedActivity : + BaseActivity(R.layout.activity_buy_finished) { + private val viewModel by viewModels() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + initReturnBtnListener() + initDetailBtnListener() + getIntentInfo() + setIntentUi(viewModel.mockBuyInfo) + } + + private fun initReturnBtnListener() { + binding.btnHome.setOnSingleClickListener { navigateToHome() } + binding.btnKeepShopping.setOnSingleClickListener { navigateToHome() } + } + + private fun navigateToHome() { + Intent(this, MainActivity::class.java).apply { + addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) + addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) + startActivity(this) + } + } + + private fun initDetailBtnListener() { + // TODO + binding.btnShowDetail.setOnSingleClickListener { } + } + + private fun getIntentInfo() { + viewModel.productId = intent.getLongExtra(EXTRA_PRODUCT_ID, -1) + } + + private fun setIntentUi(item: BuyInfoModel) { + with(binding) { + tvConfirmProductName.text = item.productName + ivConfirmProduct.load(item.imgUrl) + tvConfirmProductPrice.text = item.originPrice.setNumberForm() + tvConfirmPriceMoney.text = item.originPrice.setNumberForm() + tvConfirmPriceDiscount.text = + getString(R.string.add_minus, item.discountPrice.setNumberForm()) + tvConfirmPriceCharge.text = + getString(R.string.add_plus, item.charge.setNumberForm()) + tvConfirmPriceTotal.text = item.totalPrice.setNumberForm() + } + } + + + companion object { + private const val EXTRA_PRODUCT_ID = "EXTRA_PRODUCT_ID" + + @JvmStatic + fun createIntent( + context: Context, + productId: Long + ): Intent = Intent(context, BuyFinishedActivity::class.java).apply { + putExtra(EXTRA_PRODUCT_ID, productId) + } + } +} \ No newline at end of file diff --git a/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedViewModel.kt b/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedViewModel.kt new file mode 100644 index 00000000..c9df28a6 --- /dev/null +++ b/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedViewModel.kt @@ -0,0 +1,34 @@ +package co.orange.presentation.buy.finished + +import androidx.lifecycle.ViewModel +import co.orange.domain.entity.response.AddressInfoModel +import co.orange.domain.entity.response.BuyInfoModel +import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject + +@HiltViewModel +class BuyFinishedViewModel +@Inject +constructor( + // private val feedRepository: FeedRepository, +) : ViewModel() { + + var productId: Long = -1 + + val mockBuyInfo = BuyInfoModel( + "상품이름은 한줄로만 보여줄거에야야야야야야", + "https://github.com/Marchbreeze/Marchbreeze/assets/97405341/cd2c0454-92b4-41e7-ae2f-319f83e2426f", + 24000, + listOf( + AddressInfoModel( + "김상호", + "04567", + "서울특벌시 성동구 성수이로 137 107동 903호", + "010-3259-0327" + ) + ), + 3000, + 350, + 21350 + ) +} \ No newline at end of file From 232096108912a8ba5827f7b4f4df7d638ba95673 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Sat, 15 Jun 2024 20:54:09 +0900 Subject: [PATCH 09/11] =?UTF-8?q?[ADD/#15]=20manifest=EC=97=90=20=EA=B5=AC?= =?UTF-8?q?=EB=A7=A4=EC=99=84=EB=A3=8C=EB=B7=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0293b156..40472a6f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -41,6 +41,11 @@ android:exported="false" android:screenOrientation="portrait" /> + + \ No newline at end of file From 6136d0662ac599d692b5a8952e2ad8b5f0ef152f Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Sat, 15 Jun 2024 21:19:25 +0900 Subject: [PATCH 10/11] =?UTF-8?q?[FIX/#15]=20=EA=B5=AC=EB=A7=A4=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20data=20=EC=84=9C=EB=B2=84=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=82=AC=ED=95=AD=20=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/entity/response/BuyDetailModel.kt | 4 +- .../buy/finished/BuyFinishedActivity.kt | 32 +++++++++------ .../buy/finished/BuyFinishedViewModel.kt | 15 ++++++- .../presentation/buy/push/BuyPushActivity.kt | 6 ++- .../presentation/detail/OptionBottomSheet.kt | 5 +-- .../main/res/layout/activity_buy_finished.xml | 39 ++++++++++++++----- presentation/src/main/res/values/strings.xml | 4 ++ 7 files changed, 76 insertions(+), 29 deletions(-) diff --git a/domain/src/main/kotlin/co/orange/domain/entity/response/BuyDetailModel.kt b/domain/src/main/kotlin/co/orange/domain/entity/response/BuyDetailModel.kt index 92b058a6..b38662e8 100644 --- a/domain/src/main/kotlin/co/orange/domain/entity/response/BuyDetailModel.kt +++ b/domain/src/main/kotlin/co/orange/domain/entity/response/BuyDetailModel.kt @@ -3,14 +3,14 @@ package co.orange.domain.entity.response import co.orange.domain.enums.OrderStatus data class BuyDetailModel( - val orderId: Long, + val orderId: String, val orderStatus: OrderStatus, val productName: String, val imgUrl: String, val originPrice: Int, val sellerNickname: String, val addressInfo: List, - val paymentInfoModel: List, + val paymentInfo: List, val discountPrice: Int, val charge: Int, val totalPrice: Int, diff --git a/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt b/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt index 8f92bdd5..2c177e4b 100644 --- a/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt @@ -4,11 +4,12 @@ import android.content.Context import android.content.Intent import android.os.Bundle import androidx.activity.viewModels -import co.orange.domain.entity.response.BuyInfoModel +import co.orange.domain.entity.response.BuyDetailModel import co.orange.presentation.main.MainActivity import coil.load import dagger.hilt.android.AndroidEntryPoint import kr.genti.core.base.BaseActivity +import kr.genti.core.extension.breakLines import kr.genti.core.extension.setNumberForm import kr.genti.core.extension.setOnSingleClickListener import kr.genti.presentation.R @@ -50,17 +51,26 @@ class BuyFinishedActivity : viewModel.productId = intent.getLongExtra(EXTRA_PRODUCT_ID, -1) } - private fun setIntentUi(item: BuyInfoModel) { + private fun setIntentUi(item: BuyDetailModel) { with(binding) { - tvConfirmProductName.text = item.productName - ivConfirmProduct.load(item.imgUrl) - tvConfirmProductPrice.text = item.originPrice.setNumberForm() - tvConfirmPriceMoney.text = item.originPrice.setNumberForm() - tvConfirmPriceDiscount.text = - getString(R.string.add_minus, item.discountPrice.setNumberForm()) - tvConfirmPriceCharge.text = - getString(R.string.add_plus, item.charge.setNumberForm()) - tvConfirmPriceTotal.text = item.totalPrice.setNumberForm() + tvFinishedTransaction.text = + getString(R.string.transaction_id, item.orderId).breakLines() + ivFinishedItem.load(item.imgUrl) + tvFinishedItemName.text = item.productName + tvFinishedItemPrice.text = item.originPrice.setNumberForm() + tvFinishedDeliveryName.text = item.addressInfo[0].recipient + tvFinishedDeliveryAddress.text = getString( + R.string.address_format, + item.addressInfo[0].zipCode, + item.addressInfo[0].address + ) + tvFinishedDeliveryPhone.text = item.addressInfo[0].phone + tvFinishedTransactionMethod.text = item.paymentInfo[0].method + tvFinishedTransactionDate.text = item.paymentInfo[0].completedAt + tvFinishedPayMoney.text = item.originPrice.setNumberForm() + tvFinishedPayDiscount.text = getString(R.string.add_minus, item.discountPrice.setNumberForm()) + tvFinishedPayCharge.text = getString(R.string.add_plus, item.charge.setNumberForm()) + tvFinishedPayTotal.text = item.totalPrice.setNumberForm() } } diff --git a/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedViewModel.kt b/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedViewModel.kt index c9df28a6..5b74ec54 100644 --- a/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedViewModel.kt +++ b/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedViewModel.kt @@ -2,7 +2,9 @@ package co.orange.presentation.buy.finished import androidx.lifecycle.ViewModel import co.orange.domain.entity.response.AddressInfoModel -import co.orange.domain.entity.response.BuyInfoModel +import co.orange.domain.entity.response.BuyDetailModel +import co.orange.domain.entity.response.PaymentInfoModel +import co.orange.domain.enums.OrderStatus import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject @@ -15,10 +17,13 @@ constructor( var productId: Long = -1 - val mockBuyInfo = BuyInfoModel( + val mockBuyInfo = BuyDetailModel( + "123e4567-e89b-12d3-a456-426614174000", + OrderStatus.ORDER_PLACED, "상품이름은 한줄로만 보여줄거에야야야야야야", "https://github.com/Marchbreeze/Marchbreeze/assets/97405341/cd2c0454-92b4-41e7-ae2f-319f83e2426f", 24000, + "등둔", listOf( AddressInfoModel( "김상호", @@ -27,6 +32,12 @@ constructor( "010-3259-0327" ) ), + listOf( + PaymentInfoModel( + "NAVERPAY", + "2024.06.06" + ) + ), 3000, 350, 21350 diff --git a/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt b/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt index 8b63985a..52e2096c 100644 --- a/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/buy/push/BuyPushActivity.kt @@ -3,6 +3,7 @@ package co.orange.presentation.buy.push import android.content.Context import android.content.Intent import android.os.Bundle +import co.orange.presentation.buy.finished.BuyFinishedActivity import dagger.hilt.android.AndroidEntryPoint import kr.genti.core.base.BaseActivity import kr.genti.core.extension.setOnSingleClickListener @@ -40,7 +41,10 @@ class BuyPushActivity : BaseActivity(R.layout.activity_push private fun navigateToFinishedActivity() { - val productId = intent.getStringExtra(EXTRA_PRODUCT_ID).orEmpty() + val productId = intent.getLongExtra(EXTRA_PRODUCT_ID,-1) + BuyFinishedActivity.createIntent(this, productId).apply { + startActivity(this) + } } diff --git a/presentation/src/main/java/co/orange/presentation/detail/OptionBottomSheet.kt b/presentation/src/main/java/co/orange/presentation/detail/OptionBottomSheet.kt index b17ea82f..6143aee3 100644 --- a/presentation/src/main/java/co/orange/presentation/detail/OptionBottomSheet.kt +++ b/presentation/src/main/java/co/orange/presentation/detail/OptionBottomSheet.kt @@ -49,10 +49,7 @@ class OptionBottomSheet : // TODO 버튼 활성화 설정 BuyConfirmActivity.createIntent( requireContext(), - viewModel.imageUrl, - viewModel.originPrice, - viewModel.salePrice, - viewModel.mockProduct.name + viewModel.mockProduct. ).apply { startActivity(this) } diff --git a/presentation/src/main/res/layout/activity_buy_finished.xml b/presentation/src/main/res/layout/activity_buy_finished.xml index 6b452ef2..2f8e6288 100644 --- a/presentation/src/main/res/layout/activity_buy_finished.xml +++ b/presentation/src/main/res/layout/activity_buy_finished.xml @@ -352,6 +352,27 @@ app:layout_constraintTop_toTopOf="@id/tv_finished_pay_charge_title" tools:text="+350" /> + + + + @@ -361,35 +382,35 @@ style="@style/TextAppearance.DDanzi.Body3" android:layout_width="0dp" android:layout_height="wrap_content" - app:layout_constraintEnd_toStartOf="@id/btn_show_detail" android:layout_marginStart="22dp" + android:layout_marginEnd="5dp" + android:layout_marginBottom="30dp" android:background="@drawable/shape_black_line_10_rect" android:gravity="center" android:paddingVertical="16dp" - android:layout_marginEnd="5dp" - android:layout_marginBottom="30dp" - app:layout_constraintHorizontal_chainStyle="packed" android:text="@string/buy_finished_btn_keep_shopping" app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@id/btn_show_detail" + app:layout_constraintHorizontal_chainStyle="packed" app:layout_constraintStart_toStartOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_chainStyle="packed" + app:layout_constraintStart_toEndOf="@id/btn_keep_shopping" /> 상품 금액 할인가 수수료 + 최종 결제 금액 계속 쇼핑하기 상세 내역 보러가기 + + 거래 번호 %s + (%s) %s \ No newline at end of file From 2c137d916b5b7e9789dc7c6a67e715adb9cdd325 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Sat, 15 Jun 2024 21:30:46 +0900 Subject: [PATCH 11/11] =?UTF-8?q?[ADD/#15]=20productId=EB=A1=9C=20intent?= =?UTF-8?q?=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/buy/finished/BuyFinishedActivity.kt | 2 +- .../java/co/orange/presentation/detail/DetailActivity.kt | 4 ++++ .../co/orange/presentation/detail/DetailViewModel.kt | 9 +++++---- .../co/orange/presentation/detail/OptionBottomSheet.kt | 2 +- .../co/orange/presentation/main/home/HomeFragment.kt | 2 +- .../src/main/res/layout/activity_buy_finished.xml | 1 + 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt b/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt index 2c177e4b..2904a84a 100644 --- a/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt @@ -63,7 +63,7 @@ class BuyFinishedActivity : R.string.address_format, item.addressInfo[0].zipCode, item.addressInfo[0].address - ) + ).breakLines() tvFinishedDeliveryPhone.text = item.addressInfo[0].phone tvFinishedTransactionMethod.text = item.paymentInfo[0].method tvFinishedTransactionDate.text = item.paymentInfo[0].completedAt diff --git a/presentation/src/main/java/co/orange/presentation/detail/DetailActivity.kt b/presentation/src/main/java/co/orange/presentation/detail/DetailActivity.kt index 8f989e3c..946ddbd5 100644 --- a/presentation/src/main/java/co/orange/presentation/detail/DetailActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/detail/DetailActivity.kt @@ -63,6 +63,7 @@ class DetailActivity : BaseActivity(R.layout.activity_det private fun getIntentInfo() { with(viewModel) { + productId =intent.getLongExtra(EXTRA_PRODUCT_ID, -1) imageUrl = intent.getStringExtra(EXTRA_PRODUCT_URL).orEmpty() originPrice = intent.getIntExtra(EXTRA_ORIGIN_PRICE, 0) salePrice = intent.getIntExtra(EXTRA_SALE_PRICE, 0) @@ -101,6 +102,7 @@ class DetailActivity : BaseActivity(R.layout.activity_det } companion object { + private const val EXTRA_PRODUCT_ID = "EXTRA_PRODUCT_ID" private const val EXTRA_PRODUCT_URL = "EXTRA_PRODUCT_URL" private const val EXTRA_ORIGIN_PRICE = "EXTRA_ORIGIN_PRICE" private const val EXTRA_SALE_PRICE = "EXTRA_SALE_PRICE" @@ -110,10 +112,12 @@ class DetailActivity : BaseActivity(R.layout.activity_det @JvmStatic fun createIntent( context: Context, + productId: Long, productUrl: String, originPrice: Int, salePrice: Int, ): Intent = Intent(context, DetailActivity::class.java).apply { + putExtra(EXTRA_PRODUCT_ID, productId) putExtra(EXTRA_PRODUCT_URL, productUrl) putExtra(EXTRA_ORIGIN_PRICE, originPrice) putExtra(EXTRA_SALE_PRICE, salePrice) diff --git a/presentation/src/main/java/co/orange/presentation/detail/DetailViewModel.kt b/presentation/src/main/java/co/orange/presentation/detail/DetailViewModel.kt index 95d0c8f1..dbb58796 100644 --- a/presentation/src/main/java/co/orange/presentation/detail/DetailViewModel.kt +++ b/presentation/src/main/java/co/orange/presentation/detail/DetailViewModel.kt @@ -12,6 +12,7 @@ class DetailViewModel constructor( // private val feedRepository: FeedRepository, ) : ViewModel() { + var productId: Long = -1 var imageUrl: String = "" var originPrice: Int = 0 var salePrice: Int = 0 @@ -26,10 +27,10 @@ constructor( "", 123, listOf( - OptionModel(1,"옵션 1", listOf()), - OptionModel(2,"옵션 2", listOf()), - OptionModel(3,"옵션 3", listOf()), - OptionModel(4,"옵션 4", listOf()) + OptionModel(1, "옵션 1", listOf()), + OptionModel(2, "옵션 2", listOf()), + OptionModel(3, "옵션 3", listOf()), + OptionModel(4, "옵션 4", listOf()) ) ) } \ No newline at end of file diff --git a/presentation/src/main/java/co/orange/presentation/detail/OptionBottomSheet.kt b/presentation/src/main/java/co/orange/presentation/detail/OptionBottomSheet.kt index 6143aee3..4cf4025e 100644 --- a/presentation/src/main/java/co/orange/presentation/detail/OptionBottomSheet.kt +++ b/presentation/src/main/java/co/orange/presentation/detail/OptionBottomSheet.kt @@ -49,7 +49,7 @@ class OptionBottomSheet : // TODO 버튼 활성화 설정 BuyConfirmActivity.createIntent( requireContext(), - viewModel.mockProduct. + viewModel.productId ).apply { startActivity(this) } diff --git a/presentation/src/main/java/co/orange/presentation/main/home/HomeFragment.kt b/presentation/src/main/java/co/orange/presentation/main/home/HomeFragment.kt index d77de9af..2102b5ca 100644 --- a/presentation/src/main/java/co/orange/presentation/main/home/HomeFragment.kt +++ b/presentation/src/main/java/co/orange/presentation/main/home/HomeFragment.kt @@ -55,7 +55,7 @@ class HomeFragment() : BaseFragment(R.layout.fragment_home) private fun initBannerClickListener(unit: Unit) {} private fun initProductClickListener(item: ProductModel) { - DetailActivity.createIntent(requireContext(), item.imgUrl, item.originPrice, item.salePrice) + DetailActivity.createIntent(requireContext(), item.productId, item.imgUrl, item.originPrice, item.salePrice) .apply { startActivity(this) } } diff --git a/presentation/src/main/res/layout/activity_buy_finished.xml b/presentation/src/main/res/layout/activity_buy_finished.xml index 2f8e6288..74bb480e 100644 --- a/presentation/src/main/res/layout/activity_buy_finished.xml +++ b/presentation/src/main/res/layout/activity_buy_finished.xml @@ -97,6 +97,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="center" + android:layout_marginHorizontal="20dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tv_finished_message"