diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 035f6249..0b4ff4e2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -31,6 +31,11 @@ android:exported="false" android:screenOrientation="portrait" /> + + \ No newline at end of file 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 new file mode 100644 index 00000000..f4d45727 --- /dev/null +++ b/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmActivity.kt @@ -0,0 +1,95 @@ +package co.orange.presentation.buy.confirm + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import androidx.activity.viewModels +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.ActivityBuyConfirmBinding + +@AndroidEntryPoint +class BuyConfirmActivity : BaseActivity(R.layout.activity_buy_confirm) { + private val viewModel by viewModels() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + initExitBtnListener() + initDeliveryChangeBtnListener() + initTermBtnListener() + initConfirmBtnListener() + getIntentInfo() + setIntentUi() + } + + private fun initExitBtnListener() { + binding.btnExit.setOnSingleClickListener { finish() } + } + + private fun initDeliveryChangeBtnListener() { + // TODO + binding.btnChangeDelivery.setOnSingleClickListener { } + } + + private fun initTermBtnListener() { + //TODO + binding.btnTermAll.setOnSingleClickListener { } + binding.btnTermFirst.setOnSingleClickListener { } + binding.btnTermSecond.setOnSingleClickListener { } + binding.btnTermThird.setOnSingleClickListener { } + } + + private fun initConfirmBtnListener() { + // TODO + binding.btnConfirmPurchase.setOnSingleClickListener { } + } + + 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() + } + } + + private fun setIntentUi() { + 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" + } + } + + + 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" + + @JvmStatic + fun createIntent( + context: Context, + productUrl: String, + originPrice: Int, + salePrice: Int, + name: String + ): 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) + } + } +} \ 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 new file mode 100644 index 00000000..d3ad63d3 --- /dev/null +++ b/presentation/src/main/java/co/orange/presentation/buy/confirm/BuyConfirmViewModel.kt @@ -0,0 +1,19 @@ +package co.orange.presentation.buy.confirm + +import androidx.lifecycle.ViewModel +import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject + +@HiltViewModel +class BuyConfirmViewModel +@Inject +constructor( + // private val feedRepository: FeedRepository, +) : ViewModel() { + + var imageUrl: String = "" + var originPrice: Int = 0 + var salePrice: Int = 0 + var name: String = "" + +} \ No newline at end of file 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 6a189dfd..8f989e3c 100644 --- a/presentation/src/main/java/co/orange/presentation/detail/DetailActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/detail/DetailActivity.kt @@ -62,13 +62,18 @@ class DetailActivity : BaseActivity(R.layout.activity_det } 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) + } with(binding) { - ivDetailProduct.load(intent.getStringExtra(EXTRA_PRODUCT_URL)) + ivDetailProduct.load(viewModel.imageUrl) tvDetailRealPrice.apply { - text = intent.getIntExtra(EXTRA_ORIGIN_PRICE, 0).setNumberForm() + text = viewModel.originPrice.setNumberForm() setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG) } - tvDetailNowPrice.text = intent.getIntExtra(EXTRA_SALE_PRICE, 0).setNumberForm() + tvDetailNowPrice.text = viewModel.salePrice.setNumberForm() } } @@ -107,7 +112,7 @@ class DetailActivity : BaseActivity(R.layout.activity_det context: Context, productUrl: String, originPrice: Int, - salePrice: Int + salePrice: Int, ): Intent = Intent(context, DetailActivity::class.java).apply { putExtra(EXTRA_PRODUCT_URL, productUrl) putExtra(EXTRA_ORIGIN_PRICE, originPrice) 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 a7502ff9..95d0c8f1 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,10 @@ class DetailViewModel constructor( // private val feedRepository: FeedRepository, ) : ViewModel() { + var imageUrl: String = "" + var originPrice: Int = 0 + var salePrice: Int = 0 + val mockProduct = ProductDetailModel( "퓨어 오일 퍼퓸 10 ml 긴제목테스트트트트트", "카테고리", 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 60159b8d..b17ea82f 100644 --- a/presentation/src/main/java/co/orange/presentation/detail/OptionBottomSheet.kt +++ b/presentation/src/main/java/co/orange/presentation/detail/OptionBottomSheet.kt @@ -5,6 +5,7 @@ import android.net.Uri import android.os.Bundle import android.view.View import androidx.fragment.app.activityViewModels +import co.orange.presentation.buy.confirm.BuyConfirmActivity import co.orange.presentation.main.home.HomeProductViewHolder.Companion.OVER_999 import kr.genti.core.base.BaseBottomSheet import kr.genti.core.extension.setOnSingleClickListener @@ -29,6 +30,7 @@ class OptionBottomSheet : super.onViewCreated(view, savedInstanceState) initDetailViewBtnListener() + initPurchaseBtnListener() initAdapter() setInterestCount() setOptionData() @@ -42,6 +44,21 @@ class OptionBottomSheet : } } + private fun initPurchaseBtnListener() { + binding.btnPurchase.setOnSingleClickListener { + // TODO 버튼 활성화 설정 + BuyConfirmActivity.createIntent( + requireContext(), + viewModel.imageUrl, + viewModel.originPrice, + viewModel.salePrice, + viewModel.mockProduct.name + ).apply { + startActivity(this) + } + } + } + private fun initAdapter() { _adapter = OptionAdapter( itemClick = ::initItemClickListener, diff --git a/presentation/src/main/res/drawable/ic_check_term_selected.xml b/presentation/src/main/res/drawable/ic_check_term_selected.xml new file mode 100644 index 00000000..d2836e87 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_check_term_selected.xml @@ -0,0 +1,9 @@ + + + diff --git a/presentation/src/main/res/drawable/ic_check_term_unselected.xml b/presentation/src/main/res/drawable/ic_check_term_unselected.xml new file mode 100644 index 00000000..498d5bef --- /dev/null +++ b/presentation/src/main/res/drawable/ic_check_term_unselected.xml @@ -0,0 +1,9 @@ + + + diff --git a/presentation/src/main/res/drawable/ic_exit.xml b/presentation/src/main/res/drawable/ic_exit.xml new file mode 100644 index 00000000..5fedf8e2 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_exit.xml @@ -0,0 +1,9 @@ + + + diff --git a/presentation/src/main/res/drawable/sel_term_check.xml b/presentation/src/main/res/drawable/sel_term_check.xml new file mode 100644 index 00000000..8bebcd13 --- /dev/null +++ b/presentation/src/main/res/drawable/sel_term_check.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/drawable/shape_gray1_line_5_rect.xml b/presentation/src/main/res/drawable/shape_gray1_line_5_rect.xml new file mode 100644 index 00000000..0e5a6c45 --- /dev/null +++ b/presentation/src/main/res/drawable/shape_gray1_line_5_rect.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/drawable/shape_gray2_dash_line_5_rect.xml b/presentation/src/main/res/drawable/shape_gray2_dash_line_5_rect.xml new file mode 100644 index 00000000..094ce75c --- /dev/null +++ b/presentation/src/main/res/drawable/shape_gray2_dash_line_5_rect.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/drawable/shape_gray3_line_5_rect.xml b/presentation/src/main/res/drawable/shape_gray3_line_5_rect.xml new file mode 100644 index 00000000..829317b0 --- /dev/null +++ b/presentation/src/main/res/drawable/shape_gray3_line_5_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 new file mode 100644 index 00000000..b80c99f1 --- /dev/null +++ b/presentation/src/main/res/layout/activity_buy_confirm.xml @@ -0,0 +1,415 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/values/colors.xml b/presentation/src/main/res/values/colors.xml index 55669040..3089f0d2 100644 --- a/presentation/src/main/res/values/colors.xml +++ b/presentation/src/main/res/values/colors.xml @@ -19,6 +19,7 @@ #FFFEE500 #AFB1B6 #3527D7 + #FF002E #00000000 diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index ec54e386..02e2092a 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -32,4 +32,6 @@ 원하는 옵션을 선택해주세요 *각인 옵션은 사용할 수 없습니다. + + 구매하기 \ No newline at end of file