feat: 구매 확인 Dialog
- 포인트 사용이 가능한 경우 포인트를 같이 표시하도록 수정
This commit is contained in:
@@ -1105,6 +1105,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
} else {
|
||||
audioContent.price
|
||||
},
|
||||
isAvailableUsePoint = binding.ivPoint.visibility == View.VISIBLE,
|
||||
confirmButtonClick = {
|
||||
startService(
|
||||
Intent(this, AudioContentPlayService::class.java).apply {
|
||||
|
||||
@@ -29,6 +29,7 @@ class AudioContentOrderConfirmDialog(
|
||||
duration: String,
|
||||
orderType: OrderType,
|
||||
price: Int,
|
||||
isAvailableUsePoint: Boolean,
|
||||
confirmButtonClick: () -> Unit,
|
||||
) {
|
||||
|
||||
@@ -62,12 +63,52 @@ class AudioContentOrderConfirmDialog(
|
||||
|
||||
dialogView.tvDuration.text = duration
|
||||
|
||||
if (SharedPreferenceManager.userId == 17958L) {
|
||||
dialogView.ivCan.visibility = View.GONE
|
||||
dialogView.tvPrice.text = "${(price * 110).moneyFormat()}원"
|
||||
val maxUsablePoint = if (orderType == OrderType.RENTAL && isAvailableUsePoint) {
|
||||
price * 10
|
||||
} else {
|
||||
dialogView.ivCan.visibility = View.VISIBLE
|
||||
dialogView.tvPrice.text = price.moneyFormat()
|
||||
0
|
||||
}
|
||||
|
||||
val totalAvailablePoint = if (orderType == OrderType.RENTAL && isAvailableUsePoint) {
|
||||
SharedPreferenceManager.point
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
||||
val usablePoint = (minOf(totalAvailablePoint, maxUsablePoint) / 10) * 10
|
||||
|
||||
if (SharedPreferenceManager.userId == 17958L) {
|
||||
dialogView.ivPoint.visibility = View.GONE
|
||||
dialogView.tvPoint.visibility = View.GONE
|
||||
dialogView.tvPlus.visibility = View.GONE
|
||||
dialogView.ivCan.visibility = View.GONE
|
||||
dialogView.tvCan.text = "${(price * 110).moneyFormat()}원"
|
||||
} else {
|
||||
if (usablePoint > 0) {
|
||||
dialogView.ivPoint.visibility = View.VISIBLE
|
||||
dialogView.tvPoint.visibility = View.VISIBLE
|
||||
dialogView.tvPoint.text = usablePoint.moneyFormat()
|
||||
} else {
|
||||
dialogView.ivPoint.visibility = View.GONE
|
||||
dialogView.tvPoint.visibility = View.GONE
|
||||
}
|
||||
|
||||
val remainingCan = ((price * 10) - usablePoint) / 10
|
||||
|
||||
dialogView.tvPlus.visibility = if (usablePoint > 0 && remainingCan > 0) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
|
||||
if (remainingCan > 0) {
|
||||
dialogView.ivCan.visibility = View.VISIBLE
|
||||
dialogView.tvCan.visibility = View.VISIBLE
|
||||
dialogView.tvCan.text = remainingCan.moneyFormat()
|
||||
} else {
|
||||
dialogView.ivCan.visibility = View.GONE
|
||||
dialogView.tvCan.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
if (SharedPreferenceManager.userId == 17958L) {
|
||||
@@ -78,9 +119,9 @@ class AudioContentOrderConfirmDialog(
|
||||
}
|
||||
} else {
|
||||
dialogView.tvNotice.text = if (orderType == OrderType.RENTAL) {
|
||||
"콘텐츠를 대여하시겠습니까?\n아래 캔이 차감됩니다."
|
||||
"콘텐츠를 대여하시겠습니까?\n아래 금액이 차감됩니다."
|
||||
} else {
|
||||
"콘텐츠를 소장하시겠습니까?\n아래 캔이 차감됩니다."
|
||||
"콘텐츠를 소장하시겠습니까?\n아래 금액이 차감됩니다."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user