콘텐츠 상세 - 대여만 가능한 콘텐츠의 경우 소장 버튼이 보이지 않고 가격의 100%가 보이도록 수정
This commit is contained in:
parent
26c9a236ec
commit
83575aa1eb
|
@ -40,8 +40,8 @@ android {
|
|||
applicationId "kr.co.vividnext.sodalive"
|
||||
minSdk 23
|
||||
targetSdk 33
|
||||
versionCode 7
|
||||
versionName "1.0.6"
|
||||
versionCode 8
|
||||
versionName "1.0.7"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
|
@ -504,8 +504,14 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||
binding.llPurchase.visibility = View.VISIBLE
|
||||
binding.tvPrice.text = response.price.toString()
|
||||
|
||||
binding.tvStrPurchaseOrRental.text = if (response.isOnlyRental) {
|
||||
" 대여하기"
|
||||
} else {
|
||||
" 구매하기"
|
||||
}
|
||||
|
||||
binding.llPurchase.setOnClickListener {
|
||||
showOrderDialog(audioContent = response)
|
||||
showOrderDialog(audioContent = response, isOnlyRental = response.isOnlyRental)
|
||||
}
|
||||
} else {
|
||||
binding.llPurchase.visibility = View.GONE
|
||||
|
@ -684,11 +690,15 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||
}
|
||||
}
|
||||
|
||||
private fun showOrderDialog(audioContent: GetAudioContentDetailResponse) {
|
||||
private fun showOrderDialog(
|
||||
audioContent: GetAudioContentDetailResponse,
|
||||
isOnlyRental: Boolean = false
|
||||
) {
|
||||
val dialog = AudioContentOrderFragment(
|
||||
price = audioContent.price,
|
||||
onClickKeep = { showOrderConfirmDialog(audioContent, OrderType.KEEP) },
|
||||
onClickRental = { showOrderConfirmDialog(audioContent, OrderType.RENTAL) }
|
||||
isOnlyRental = isOnlyRental,
|
||||
onClickKeep = { showOrderConfirmDialog(audioContent, isOnlyRental, OrderType.KEEP) },
|
||||
onClickRental = { showOrderConfirmDialog(audioContent, isOnlyRental, OrderType.RENTAL) }
|
||||
)
|
||||
|
||||
dialog.show(
|
||||
|
@ -699,6 +709,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||
|
||||
private fun showOrderConfirmDialog(
|
||||
audioContent: GetAudioContentDetailResponse,
|
||||
isOnlyRental: Boolean = false,
|
||||
orderType: OrderType
|
||||
) {
|
||||
AudioContentOrderConfirmDialog(
|
||||
|
@ -710,6 +721,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||
profileImageUrl = audioContent.creator.profileImageUrl,
|
||||
nickname = audioContent.creator.nickname,
|
||||
duration = audioContent.duration,
|
||||
isOnlyRental = isOnlyRental,
|
||||
orderType = orderType,
|
||||
price = audioContent.price,
|
||||
confirmButtonClick = {
|
||||
|
|
|
@ -190,7 +190,13 @@ class AudioContentDetailViewModel(
|
|||
{
|
||||
if (it.success && it.data != null) {
|
||||
getAudioContentDetail(audioContentId = contentId)
|
||||
_toastLiveData.postValue("구매가 완료되었습니다.")
|
||||
_toastLiveData.postValue(
|
||||
if (orderType == OrderType.RENTAL) {
|
||||
"대여가 완료되었습니다."
|
||||
} else {
|
||||
"구매가 완료되었습니다."
|
||||
}
|
||||
)
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
|
|
|
@ -16,6 +16,7 @@ data class GetAudioContentDetailResponse(
|
|||
@SerializedName("duration") val duration: String,
|
||||
@SerializedName("isAdult") val isAdult: Boolean,
|
||||
@SerializedName("isMosaic") val isMosaic: Boolean,
|
||||
@SerializedName("isOnlyRental") val isOnlyRental: Boolean,
|
||||
@SerializedName("existOrdered") val existOrdered: Boolean,
|
||||
@SerializedName("orderType") val orderType: OrderType?,
|
||||
@SerializedName("remainingTime") val remainingTime: String?,
|
||||
|
|
|
@ -23,6 +23,7 @@ class AudioContentOrderConfirmDialog(
|
|||
profileImageUrl: String,
|
||||
nickname: String,
|
||||
duration: String,
|
||||
isOnlyRental: Boolean,
|
||||
orderType: OrderType,
|
||||
price: Int,
|
||||
confirmButtonClick: () -> Unit,
|
||||
|
@ -57,7 +58,7 @@ class AudioContentOrderConfirmDialog(
|
|||
}
|
||||
|
||||
dialogView.tvDuration.text = duration
|
||||
dialogView.tvPrice.text = if (orderType == OrderType.RENTAL) {
|
||||
dialogView.tvPrice.text = if (orderType == OrderType.RENTAL && !isOnlyRental) {
|
||||
"${ceil(price * 0.6).toInt()}"
|
||||
} else {
|
||||
"$price"
|
||||
|
|
|
@ -10,6 +10,7 @@ import kotlin.math.ceil
|
|||
|
||||
class AudioContentOrderFragment(
|
||||
private val price: Int,
|
||||
private val isOnlyRental: Boolean,
|
||||
private val onClickRental: () -> Unit,
|
||||
private val onClickKeep: () -> Unit
|
||||
) : BottomSheetDialogFragment() {
|
||||
|
@ -28,12 +29,18 @@ class AudioContentOrderFragment(
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.tvKeep.text = "$price"
|
||||
binding.tvRental.text = "${ceil(price * 0.6).toInt()}"
|
||||
if (isOnlyRental) {
|
||||
binding.tvRental.text = "$price"
|
||||
binding.rlKeep.visibility = View.GONE
|
||||
} else {
|
||||
binding.tvKeep.text = "$price"
|
||||
binding.tvRental.text = "${ceil(price * 0.6).toInt()}"
|
||||
|
||||
binding.llKeep.setOnClickListener {
|
||||
onClickKeep()
|
||||
dismiss()
|
||||
binding.rlKeep.visibility = View.VISIBLE
|
||||
binding.llKeep.setOnClickListener {
|
||||
onClickKeep()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
binding.llRental.setOnClickListener {
|
||||
|
|
|
@ -430,6 +430,7 @@
|
|||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_str_purchase_or_rental"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_bold"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_light"
|
||||
android:text="(이용기간 7일)"
|
||||
android:text="(이용기간 15일)"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
@ -64,9 +64,11 @@
|
|||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_keep"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="26.7dp">
|
||||
android:layout_marginTop="26.7dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
|
Loading…
Reference in New Issue