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