feat: 구매 확인 Dialog
- 포인트 사용이 가능한 경우 포인트를 같이 표시하도록 수정
This commit is contained in:
		@@ -1105,6 +1105,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
 | 
				
			|||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                audioContent.price
 | 
					                audioContent.price
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
 | 
					            isAvailableUsePoint = binding.ivPoint.visibility == View.VISIBLE,
 | 
				
			||||||
            confirmButtonClick = {
 | 
					            confirmButtonClick = {
 | 
				
			||||||
                startService(
 | 
					                startService(
 | 
				
			||||||
                    Intent(this, AudioContentPlayService::class.java).apply {
 | 
					                    Intent(this, AudioContentPlayService::class.java).apply {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,6 +29,7 @@ class AudioContentOrderConfirmDialog(
 | 
				
			|||||||
    duration: String,
 | 
					    duration: String,
 | 
				
			||||||
    orderType: OrderType,
 | 
					    orderType: OrderType,
 | 
				
			||||||
    price: Int,
 | 
					    price: Int,
 | 
				
			||||||
 | 
					    isAvailableUsePoint: Boolean,
 | 
				
			||||||
    confirmButtonClick: () -> Unit,
 | 
					    confirmButtonClick: () -> Unit,
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,12 +63,52 @@ class AudioContentOrderConfirmDialog(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        dialogView.tvDuration.text = duration
 | 
					        dialogView.tvDuration.text = duration
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (SharedPreferenceManager.userId == 17958L) {
 | 
					        val maxUsablePoint = if (orderType == OrderType.RENTAL && isAvailableUsePoint) {
 | 
				
			||||||
            dialogView.ivCan.visibility = View.GONE
 | 
					            price * 10
 | 
				
			||||||
            dialogView.tvPrice.text = "${(price * 110).moneyFormat()}원"
 | 
					 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            dialogView.ivCan.visibility = View.VISIBLE
 | 
					            0
 | 
				
			||||||
            dialogView.tvPrice.text = price.moneyFormat()
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        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) {
 | 
					        if (SharedPreferenceManager.userId == 17958L) {
 | 
				
			||||||
@@ -78,9 +119,9 @@ class AudioContentOrderConfirmDialog(
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            dialogView.tvNotice.text = if (orderType == OrderType.RENTAL) {
 | 
					            dialogView.tvNotice.text = if (orderType == OrderType.RENTAL) {
 | 
				
			||||||
                "콘텐츠를 대여하시겠습니까?\n아래 캔이 차감됩니다."
 | 
					                "콘텐츠를 대여하시겠습니까?\n아래 금액이 차감됩니다."
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                "콘텐츠를 소장하시겠습니까?\n아래 캔이 차감됩니다."
 | 
					                "콘텐츠를 소장하시겠습니까?\n아래 금액이 차감됩니다."
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -129,6 +129,36 @@
 | 
				
			|||||||
        android:orientation="horizontal"
 | 
					        android:orientation="horizontal"
 | 
				
			||||||
        android:paddingVertical="13.3dp">
 | 
					        android:paddingVertical="13.3dp">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <ImageView
 | 
				
			||||||
 | 
					            android:id="@+id/iv_point"
 | 
				
			||||||
 | 
					            android:layout_width="16.7dp"
 | 
				
			||||||
 | 
					            android:layout_height="16.7dp"
 | 
				
			||||||
 | 
					            android:layout_marginEnd="2.7dp"
 | 
				
			||||||
 | 
					            android:contentDescription="@null"
 | 
				
			||||||
 | 
					            android:visibility="gone"
 | 
				
			||||||
 | 
					            android:src="@drawable/ic_point" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <TextView
 | 
				
			||||||
 | 
					            android:id="@+id/tv_point"
 | 
				
			||||||
 | 
					            android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					            android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					            android:fontFamily="@font/gmarket_sans_bold"
 | 
				
			||||||
 | 
					            android:textColor="@color/color_eeeeee"
 | 
				
			||||||
 | 
					            android:textSize="13.3sp"
 | 
				
			||||||
 | 
					            android:visibility="gone"
 | 
				
			||||||
 | 
					            tools:text="300" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <TextView
 | 
				
			||||||
 | 
					            android:id="@+id/tv_plus"
 | 
				
			||||||
 | 
					            android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					            android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					            android:fontFamily="@font/gmarket_sans_medium"
 | 
				
			||||||
 | 
					            android:text="+"
 | 
				
			||||||
 | 
					            android:visibility="gone"
 | 
				
			||||||
 | 
					            android:layout_marginHorizontal="10dp"
 | 
				
			||||||
 | 
					            android:textColor="@color/color_eeeeee"
 | 
				
			||||||
 | 
					            android:textSize="13.3sp" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <ImageView
 | 
					        <ImageView
 | 
				
			||||||
            android:id="@+id/iv_can"
 | 
					            android:id="@+id/iv_can"
 | 
				
			||||||
            android:layout_width="16.7dp"
 | 
					            android:layout_width="16.7dp"
 | 
				
			||||||
@@ -138,7 +168,7 @@
 | 
				
			|||||||
            android:src="@drawable/ic_can" />
 | 
					            android:src="@drawable/ic_can" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <TextView
 | 
					        <TextView
 | 
				
			||||||
            android:id="@+id/tv_price"
 | 
					            android:id="@+id/tv_can"
 | 
				
			||||||
            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"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user