콘텐츠 상세
- 소장만, 대여만 가능시 구매하기 버튼 배경색 변경 - 소장만, 대여만 가능시 구매하기 버튼을 터치하면 바로 구매확인 다이얼로그 표시
This commit is contained in:
parent
140f933db7
commit
6689932393
|
@ -30,6 +30,7 @@ import com.bumptech.glide.request.RequestOptions
|
|||
import com.google.gson.Gson
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.AudioContentPlayService
|
||||
import kr.co.vividnext.sodalive.audio_content.PurchaseOption
|
||||
import kr.co.vividnext.sodalive.audio_content.comment.AudioContentCommentFragment
|
||||
import kr.co.vividnext.sodalive.audio_content.modify.AudioContentModifyActivity
|
||||
import kr.co.vividnext.sodalive.audio_content.order.AudioContentOrderConfirmDialog
|
||||
|
@ -585,27 +586,39 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||
"캔으로"
|
||||
}
|
||||
|
||||
binding.tvStrPurchaseOrRental.text = if (response.isOnlyRental) {
|
||||
" 대여하기"
|
||||
} else {
|
||||
" 구매하기"
|
||||
when (response.purchaseOption) {
|
||||
PurchaseOption.BOTH -> {
|
||||
binding.tvStrPurchaseOrRental.text = " 구매하기"
|
||||
binding.llPurchase.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_5_3_3bb9f1
|
||||
)
|
||||
}
|
||||
|
||||
PurchaseOption.BUY_ONLY -> {
|
||||
binding.tvStrPurchaseOrRental.text = " 소장하기"
|
||||
binding.llPurchase.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_5_3_59548f
|
||||
)
|
||||
}
|
||||
|
||||
PurchaseOption.RENT_ONLY -> {
|
||||
binding.tvStrPurchaseOrRental.text = " 대여하기"
|
||||
binding.llPurchase.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_5_3_548f7d
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val limitedEdition = response.totalContentCount != null &&
|
||||
response.remainingContentCount != null
|
||||
|
||||
binding.llPurchase.setOnClickListener {
|
||||
if (
|
||||
response.totalContentCount != null &&
|
||||
response.remainingContentCount != null
|
||||
) {
|
||||
showOrderConfirmDialog(
|
||||
audioContent = response,
|
||||
isOnlyRental = false,
|
||||
OrderType.KEEP
|
||||
)
|
||||
if (limitedEdition || response.purchaseOption == PurchaseOption.BUY_ONLY) {
|
||||
showOrderConfirmDialog(audioContent = response, OrderType.KEEP)
|
||||
} else if (response.purchaseOption == PurchaseOption.RENT_ONLY) {
|
||||
showOrderConfirmDialog(audioContent = response, OrderType.RENTAL)
|
||||
} else {
|
||||
showOrderDialog(
|
||||
audioContent = response,
|
||||
isOnlyRental = response.isOnlyRental
|
||||
)
|
||||
showOrderDialog(audioContent = response)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -895,15 +908,11 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||
}
|
||||
}
|
||||
|
||||
private fun showOrderDialog(
|
||||
audioContent: GetAudioContentDetailResponse,
|
||||
isOnlyRental: Boolean = false
|
||||
) {
|
||||
private fun showOrderDialog(audioContent: GetAudioContentDetailResponse) {
|
||||
val dialog = AudioContentOrderFragment(
|
||||
price = audioContent.price,
|
||||
isOnlyRental = isOnlyRental,
|
||||
onClickKeep = { showOrderConfirmDialog(audioContent, isOnlyRental, OrderType.KEEP) },
|
||||
onClickRental = { showOrderConfirmDialog(audioContent, isOnlyRental, OrderType.RENTAL) }
|
||||
onClickKeep = { showOrderConfirmDialog(audioContent, OrderType.KEEP) },
|
||||
onClickRental = { showOrderConfirmDialog(audioContent, OrderType.RENTAL) }
|
||||
)
|
||||
|
||||
dialog.show(
|
||||
|
@ -914,7 +923,6 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||
|
||||
private fun showOrderConfirmDialog(
|
||||
audioContent: GetAudioContentDetailResponse,
|
||||
isOnlyRental: Boolean = false,
|
||||
orderType: OrderType
|
||||
) {
|
||||
AudioContentOrderConfirmDialog(
|
||||
|
@ -926,7 +934,6 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||
profileImageUrl = audioContent.creator.profileImageUrl,
|
||||
nickname = audioContent.creator.nickname,
|
||||
duration = audioContent.duration,
|
||||
isOnlyRental = isOnlyRental,
|
||||
orderType = orderType,
|
||||
price = audioContent.price,
|
||||
confirmButtonClick = {
|
||||
|
|
|
@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.audio_content.detail
|
|||
|
||||
import androidx.annotation.Keep
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kr.co.vividnext.sodalive.audio_content.PurchaseOption
|
||||
import kr.co.vividnext.sodalive.audio_content.comment.GetAudioContentCommentListItem
|
||||
import kr.co.vividnext.sodalive.audio_content.order.OrderType
|
||||
|
||||
|
@ -23,8 +24,8 @@ data class GetAudioContentDetailResponse(
|
|||
@SerializedName("isActivePreview") val isActivePreview: Boolean,
|
||||
@SerializedName("isAdult") val isAdult: Boolean,
|
||||
@SerializedName("isMosaic") val isMosaic: Boolean,
|
||||
@SerializedName("isOnlyRental") val isOnlyRental: Boolean,
|
||||
@SerializedName("existOrdered") val existOrdered: Boolean,
|
||||
@SerializedName("purchaseOption") val purchaseOption: PurchaseOption,
|
||||
@SerializedName("orderType") val orderType: OrderType?,
|
||||
@SerializedName("remainingTime") val remainingTime: String?,
|
||||
@SerializedName("creatorOtherContentList")
|
||||
|
|
|
@ -26,7 +26,6 @@ class AudioContentOrderConfirmDialog(
|
|||
profileImageUrl: String,
|
||||
nickname: String,
|
||||
duration: String,
|
||||
isOnlyRental: Boolean,
|
||||
orderType: OrderType,
|
||||
price: Int,
|
||||
confirmButtonClick: () -> Unit,
|
||||
|
@ -64,14 +63,14 @@ class AudioContentOrderConfirmDialog(
|
|||
|
||||
if (SharedPreferenceManager.userId == 17958L) {
|
||||
dialogView.ivCan.visibility = View.GONE
|
||||
dialogView.tvPrice.text = if (orderType == OrderType.RENTAL && !isOnlyRental) {
|
||||
dialogView.tvPrice.text = if (orderType == OrderType.RENTAL) {
|
||||
"${(ceil(price * 0.7).toInt() * 110).moneyFormat()}원"
|
||||
} else {
|
||||
"${(price * 110).moneyFormat()}원"
|
||||
}
|
||||
} else {
|
||||
dialogView.ivCan.visibility = View.VISIBLE
|
||||
dialogView.tvPrice.text = if (orderType == OrderType.RENTAL && !isOnlyRental) {
|
||||
dialogView.tvPrice.text = if (orderType == OrderType.RENTAL) {
|
||||
ceil(price * 0.7).toInt().moneyFormat()
|
||||
} else {
|
||||
price.moneyFormat()
|
||||
|
|
|
@ -13,7 +13,6 @@ import kotlin.math.ceil
|
|||
|
||||
class AudioContentOrderFragment(
|
||||
private val price: Int,
|
||||
private val isOnlyRental: Boolean,
|
||||
private val onClickRental: () -> Unit,
|
||||
private val onClickKeep: () -> Unit
|
||||
) : BottomSheetDialogFragment() {
|
||||
|
@ -43,27 +42,18 @@ class AudioContentOrderFragment(
|
|||
binding.ivRentalCan.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
if (isOnlyRental) {
|
||||
if (SharedPreferenceManager.userId == 17958L) {
|
||||
binding.tvRental.text = "${(price * 110).moneyFormat()}원"
|
||||
} else {
|
||||
binding.tvRental.text = price.moneyFormat()
|
||||
}
|
||||
binding.rlKeep.visibility = View.GONE
|
||||
if (SharedPreferenceManager.userId == 17958L) {
|
||||
binding.tvKeep.text = "${(price * 110).moneyFormat()}원"
|
||||
binding.tvRental.text = "${(ceil(price * 0.7).toInt() * 110).moneyFormat()}원"
|
||||
} else {
|
||||
if (SharedPreferenceManager.userId == 17958L) {
|
||||
binding.tvKeep.text = "${(price * 110).moneyFormat()}원"
|
||||
binding.tvRental.text = "${(ceil(price * 0.7).toInt() * 110).moneyFormat()}원"
|
||||
} else {
|
||||
binding.tvKeep.text = price.moneyFormat()
|
||||
binding.tvRental.text = ceil(price * 0.7).toInt().moneyFormat()
|
||||
}
|
||||
binding.tvKeep.text = price.moneyFormat()
|
||||
binding.tvRental.text = ceil(price * 0.7).toInt().moneyFormat()
|
||||
}
|
||||
|
||||
binding.rlKeep.visibility = View.VISIBLE
|
||||
binding.llKeep.setOnClickListener {
|
||||
onClickKeep()
|
||||
dismiss()
|
||||
}
|
||||
binding.rlKeep.visibility = View.VISIBLE
|
||||
binding.llKeep.setOnClickListener {
|
||||
onClickKeep()
|
||||
dismiss()
|
||||
}
|
||||
|
||||
binding.llRental.setOnClickListener {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_548f7d" />
|
||||
<corners android:radius="5.3dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_548f7d" />
|
||||
</shape>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_59548f" />
|
||||
<corners android:radius="5.3dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_59548f" />
|
||||
</shape>
|
Loading…
Reference in New Issue