Skip to content

Commit

Permalink
[MERGE] #13 -> develop
Browse files Browse the repository at this point in the history
[UI/#13] 구매진행뷰 / UI 구현
  • Loading branch information
Marchbreeze authored Jun 14, 2024
2 parents fd2f0ec + 8ee6893 commit cd385af
Show file tree
Hide file tree
Showing 16 changed files with 619 additions and 4 deletions.
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name="co.orange.presentation.buy.confirm.BuyConfirmActivity"
android:exported="false"
android:screenOrientation="portrait" />

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -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<ActivityBuyConfirmBinding>(R.layout.activity_buy_confirm) {
private val viewModel by viewModels<BuyConfirmViewModel>()

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)
}
}
}
Original file line number Diff line number Diff line change
@@ -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 = ""

}
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,18 @@ class DetailActivity : BaseActivity<ActivityDetailBinding>(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()
}
}

Expand Down Expand Up @@ -107,7 +112,7 @@ class DetailActivity : BaseActivity<ActivityDetailBinding>(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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 긴제목테스트트트트트",
"카테고리",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,6 +30,7 @@ class OptionBottomSheet :
super.onViewCreated(view, savedInstanceState)

initDetailViewBtnListener()
initPurchaseBtnListener()
initAdapter()
setInterestCount()
setOptionData()
Expand All @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions presentation/src/main/res/drawable/ic_check_term_selected.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M6.102,14.445C5.766,14.445 5.523,14.297 5.289,13.992L1.234,8.828C1.086,8.641 1.008,8.438 1.008,8.258C1.008,7.828 1.313,7.523 1.758,7.523C2.039,7.523 2.234,7.633 2.43,7.906L6.07,12.672L13.086,1.492C13.273,1.195 13.445,1.094 13.758,1.094C14.188,1.094 14.469,1.375 14.469,1.805C14.469,1.984 14.414,2.156 14.273,2.383L6.891,14.008C6.703,14.297 6.438,14.445 6.102,14.445Z"
android:fillColor="#484848"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M6.102,14.445C5.766,14.445 5.523,14.297 5.289,13.992L1.234,8.828C1.086,8.641 1.008,8.438 1.008,8.258C1.008,7.828 1.313,7.523 1.758,7.523C2.039,7.523 2.234,7.633 2.43,7.906L6.07,12.672L13.086,1.492C13.273,1.195 13.445,1.094 13.758,1.094C14.188,1.094 14.469,1.375 14.469,1.805C14.469,1.984 14.414,2.156 14.273,2.383L6.891,14.008C6.703,14.297 6.438,14.445 6.102,14.445Z"
android:fillColor="#D9D9D9"/>
</vector>
9 changes: 9 additions & 0 deletions presentation/src/main/res/drawable/ic_exit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M4.744,19.449C4.402,19.117 4.412,18.551 4.744,18.219L10.994,11.959L4.744,5.709C4.412,5.377 4.412,4.82 4.744,4.479C5.076,4.127 5.652,4.137 5.984,4.479L12.234,10.729L18.484,4.479C18.816,4.137 19.383,4.137 19.725,4.479C20.066,4.811 20.057,5.377 19.725,5.709L13.475,11.959L19.725,18.219C20.057,18.551 20.057,19.107 19.725,19.449C19.393,19.791 18.816,19.781 18.484,19.449L12.234,13.199L5.984,19.449C5.652,19.781 5.086,19.781 4.744,19.449Z"
android:fillColor="#000000"/>
</vector>
5 changes: 5 additions & 0 deletions presentation/src/main/res/drawable/sel_term_check.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_check_term_selected" android:state_checked="true" />
<item android:drawable="@drawable/ic_check_term_unselected" android:state_checked="false" />
</selector>
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">
<stroke android:width="1dp" />
<stroke android:color="@color/gray_1" />
<corners android:radius="5dp"/>
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dp"
android:dashWidth="10dp"
android:dashGap="5dp"/>
<stroke android:color="@color/gray_2" />
<corners android:radius="5dp"/>
</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">
<stroke android:width="1dp" />
<stroke android:color="@color/gray_3" />
<corners android:radius="5dp"/>
</shape>
Loading

0 comments on commit cd385af

Please sign in to comment.