feat: 콘텐츠 업로드
- 포인트 사용 가능 여부 추가
This commit is contained in:
@@ -205,6 +205,8 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||
binding.llPriceFree.setOnClickListener { viewModel.setPriceFree(true) }
|
||||
binding.llPreviewYes.setOnClickListener { viewModel.setGeneratePreview(true) }
|
||||
binding.llPreviewNo.setOnClickListener { viewModel.setGeneratePreview(false) }
|
||||
binding.llAvailablePoint.setOnClickListener { viewModel.setAvailablePoint(true) }
|
||||
binding.llNotAvailablePoint.setOnClickListener { viewModel.setAvailablePoint(false) }
|
||||
binding.llLimited.setOnClickListener { viewModel.setLimited(true) }
|
||||
binding.llNotLimited.setOnClickListener { viewModel.setLimited(false) }
|
||||
binding.llBoth.setOnClickListener { viewModel.setPurchaseOption(PurchaseOption.BOTH) }
|
||||
@@ -448,6 +450,14 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.isAvailablePointLiveData.observe(this) {
|
||||
if (it) {
|
||||
checkAvailablePoint()
|
||||
} else {
|
||||
checkNotAvailablePoint()
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.purchaseOptionLiveData.observe(this) {
|
||||
when (it) {
|
||||
PurchaseOption.BOTH -> checkBoth()
|
||||
@@ -631,6 +641,8 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||
binding.llSetPrice.visibility = View.GONE
|
||||
binding.llConfigPurchase.visibility = View.GONE
|
||||
binding.tvTitleConfigKeep.visibility = View.GONE
|
||||
binding.tvConfigPointTitle.visibility = View.GONE
|
||||
binding.llConfigPoint.visibility = View.GONE
|
||||
|
||||
binding.ivPriceFree.visibility = View.VISIBLE
|
||||
binding.tvPriceFree.setTextColor(
|
||||
@@ -660,6 +672,8 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||
binding.llSetPrice.visibility = View.VISIBLE
|
||||
binding.llConfigPurchase.visibility = View.VISIBLE
|
||||
binding.tvTitleConfigKeep.visibility = View.VISIBLE
|
||||
binding.tvConfigPointTitle.visibility = View.VISIBLE
|
||||
binding.llConfigPoint.visibility = View.VISIBLE
|
||||
|
||||
binding.ivPricePaid.visibility = View.VISIBLE
|
||||
binding.tvPricePaid.setTextColor(
|
||||
@@ -776,6 +790,50 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||
binding.llConfigPreviewTime.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun checkAvailablePoint() {
|
||||
binding.ivAvailablePoint.visibility = View.VISIBLE
|
||||
binding.tvAvailablePoint.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_eeeeee
|
||||
)
|
||||
)
|
||||
binding.llAvailablePoint.setBackgroundResource(R.drawable.bg_round_corner_6_7_3bb9f1)
|
||||
|
||||
binding.ivNotAvailablePoint.visibility = View.GONE
|
||||
binding.tvNotAvailablePoint.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_3bb9f1
|
||||
)
|
||||
)
|
||||
binding.llNotAvailablePoint.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_6_7_13181b
|
||||
)
|
||||
}
|
||||
|
||||
private fun checkNotAvailablePoint() {
|
||||
binding.ivNotAvailablePoint.visibility = View.VISIBLE
|
||||
binding.tvNotAvailablePoint.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_eeeeee
|
||||
)
|
||||
)
|
||||
binding.llNotAvailablePoint.setBackgroundResource(R.drawable.bg_round_corner_6_7_3bb9f1)
|
||||
|
||||
binding.ivAvailablePoint.visibility = View.GONE
|
||||
binding.tvAvailablePoint.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_3bb9f1
|
||||
)
|
||||
)
|
||||
binding.llAvailablePoint.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_6_7_13181b
|
||||
)
|
||||
}
|
||||
|
||||
private fun uncheckPurchaseOption() {
|
||||
binding.ivBoth.visibility = View.GONE
|
||||
binding.ivBuyOnly.visibility = View.GONE
|
||||
|
||||
@@ -63,6 +63,10 @@ class AudioContentUploadViewModel(
|
||||
val isGeneratePreviewLiveData: LiveData<Boolean>
|
||||
get() = _isGeneratePreviewLiveData
|
||||
|
||||
private val _isAvailablePointLiveData = MutableLiveData(false)
|
||||
val isAvailablePointLiveData: LiveData<Boolean>
|
||||
get() = _isAvailablePointLiveData
|
||||
|
||||
private val _isActiveReservationLiveData = MutableLiveData(false)
|
||||
val isActiveReservationLiveData: LiveData<Boolean>
|
||||
get() = _isActiveReservationLiveData
|
||||
@@ -107,6 +111,7 @@ class AudioContentUploadViewModel(
|
||||
_isLimitedLiveData.postValue(false)
|
||||
limited = 0
|
||||
_isGeneratePreviewLiveData.postValue(true)
|
||||
_isAvailablePointLiveData.postValue(false)
|
||||
} else {
|
||||
if (_purchaseOptionLiveData.value!! != PurchaseOption.RENT_ONLY) {
|
||||
_isShowConfigLimitedLiveData.postValue(true)
|
||||
@@ -118,6 +123,10 @@ class AudioContentUploadViewModel(
|
||||
_isGeneratePreviewLiveData.value = isGeneratePreview
|
||||
}
|
||||
|
||||
fun setAvailablePoint(isAvailablePoint: Boolean) {
|
||||
_isAvailablePointLiveData.value = isAvailablePoint
|
||||
}
|
||||
|
||||
fun setLimited(isLimited: Boolean) {
|
||||
_isLimitedLiveData.value = isLimited
|
||||
|
||||
@@ -176,6 +185,7 @@ class AudioContentUploadViewModel(
|
||||
themeId = theme!!.id,
|
||||
isAdult = _isAdultLiveData.value!!,
|
||||
isGeneratePreview = isGeneratePreview,
|
||||
isPointAvailable = _isAvailablePointLiveData.value!!,
|
||||
isCommentAvailable = _isAvailableCommentLiveData.value!!,
|
||||
previewStartTime = if (isGeneratePreview) {
|
||||
previewStartTime
|
||||
|
||||
@@ -17,6 +17,7 @@ data class CreateAudioContentRequest(
|
||||
@SerializedName("themeId") val themeId: Long,
|
||||
@SerializedName("isAdult") val isAdult: Boolean,
|
||||
@SerializedName("isGeneratePreview") val isGeneratePreview: Boolean,
|
||||
@SerializedName("isPointAvailable") val isPointAvailable: Boolean,
|
||||
@SerializedName("isCommentAvailable") val isCommentAvailable: Boolean,
|
||||
@SerializedName("previewStartTime") val previewStartTime: String? = null,
|
||||
@SerializedName("previewEndTime") val previewEndTime: String? = null,
|
||||
|
||||
@@ -661,6 +661,84 @@
|
||||
android:visibility="gone"
|
||||
tools:ignore="LabelFor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_config_point_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="13.3dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:fontFamily="@font/gmarket_sans_bold"
|
||||
android:lineSpacingExtra="5sp"
|
||||
android:text="포인트 사용"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="16.7sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_config_point"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="13.3dp"
|
||||
android:layout_marginTop="13.3dp"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_available_point"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_round_corner_6_7_13181b"
|
||||
android:gravity="center"
|
||||
android:paddingVertical="14.3dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_available_point"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="6.7dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_select_check"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_available_point"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_bold"
|
||||
android:text="가능"
|
||||
android:textColor="@color/color_3bb9f1"
|
||||
android:textSize="14.7sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_not_available_point"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="13.3dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_round_corner_6_7_13181b"
|
||||
android:gravity="center"
|
||||
android:paddingVertical="14.3dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_not_available_point"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="6.7dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_select_check"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_not_available_point"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_bold"
|
||||
android:text="불가능"
|
||||
android:textColor="@color/color_3bb9f1"
|
||||
android:textSize="14.7sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_config_preview"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user