콘텐츠 등록 - 대여만 가능한 콘텐츠 등록 기능 추가
This commit is contained in:
parent
83575aa1eb
commit
19b351ef2a
|
@ -169,6 +169,8 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||||
|
|
||||||
binding.llPricePaid.setOnClickListener { viewModel.setPriceFree(false) }
|
binding.llPricePaid.setOnClickListener { viewModel.setPriceFree(false) }
|
||||||
binding.llPriceFree.setOnClickListener { viewModel.setPriceFree(true) }
|
binding.llPriceFree.setOnClickListener { viewModel.setPriceFree(true) }
|
||||||
|
binding.llRentalAndKeep.setOnClickListener { viewModel.setIsOnlyRental(false) }
|
||||||
|
binding.llOnlyRental.setOnClickListener { viewModel.setIsOnlyRental(true) }
|
||||||
binding.llCommentNo.setOnClickListener { viewModel.setAvailableComment(false) }
|
binding.llCommentNo.setOnClickListener { viewModel.setAvailableComment(false) }
|
||||||
binding.llCommentYes.setOnClickListener { viewModel.setAvailableComment(true) }
|
binding.llCommentYes.setOnClickListener { viewModel.setAvailableComment(true) }
|
||||||
|
|
||||||
|
@ -298,51 +300,17 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||||
|
|
||||||
viewModel.isPriceFreeLiveData.observe(this) {
|
viewModel.isPriceFreeLiveData.observe(this) {
|
||||||
if (it) {
|
if (it) {
|
||||||
viewModel.price = 0
|
checkPriceFree()
|
||||||
binding.etSetPrice.setText("0")
|
|
||||||
binding.llSetPrice.visibility = View.GONE
|
|
||||||
|
|
||||||
binding.ivPriceFree.visibility = View.VISIBLE
|
|
||||||
binding.tvPriceFree.setTextColor(
|
|
||||||
ContextCompat.getColor(
|
|
||||||
applicationContext,
|
|
||||||
R.color.color_eeeeee
|
|
||||||
)
|
|
||||||
)
|
|
||||||
binding.llPriceFree.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
|
||||||
|
|
||||||
binding.ivPricePaid.visibility = View.GONE
|
|
||||||
binding.tvPricePaid.setTextColor(
|
|
||||||
ContextCompat.getColor(
|
|
||||||
applicationContext,
|
|
||||||
R.color.color_9970ff
|
|
||||||
)
|
|
||||||
)
|
|
||||||
binding.llPricePaid.setBackgroundResource(
|
|
||||||
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
binding.llSetPrice.visibility = View.VISIBLE
|
checkPricePaid()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
binding.ivPricePaid.visibility = View.VISIBLE
|
viewModel.isOnlyRentalLiveData.observe(this) {
|
||||||
binding.tvPricePaid.setTextColor(
|
if (it) {
|
||||||
ContextCompat.getColor(
|
checkOnlyRental()
|
||||||
applicationContext,
|
} else {
|
||||||
R.color.color_eeeeee
|
checkRentalAndKeep()
|
||||||
)
|
|
||||||
)
|
|
||||||
binding.llPricePaid.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
|
||||||
|
|
||||||
binding.ivPriceFree.visibility = View.GONE
|
|
||||||
binding.tvPriceFree.setTextColor(
|
|
||||||
ContextCompat.getColor(
|
|
||||||
applicationContext,
|
|
||||||
R.color.color_9970ff
|
|
||||||
)
|
|
||||||
)
|
|
||||||
binding.llPriceFree.setBackgroundResource(
|
|
||||||
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,6 +408,106 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun checkPriceFree() {
|
||||||
|
viewModel.price = 0
|
||||||
|
binding.etSetPrice.setText("0")
|
||||||
|
binding.llSetPrice.visibility = View.GONE
|
||||||
|
binding.llConfigKeep.visibility = View.GONE
|
||||||
|
binding.tvTitleConfigKeep.visibility = View.GONE
|
||||||
|
|
||||||
|
binding.ivPriceFree.visibility = View.VISIBLE
|
||||||
|
binding.tvPriceFree.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
applicationContext,
|
||||||
|
R.color.color_eeeeee
|
||||||
|
)
|
||||||
|
)
|
||||||
|
binding.llPriceFree.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
||||||
|
|
||||||
|
binding.ivPricePaid.visibility = View.GONE
|
||||||
|
binding.tvPricePaid.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
applicationContext,
|
||||||
|
R.color.color_9970ff
|
||||||
|
)
|
||||||
|
)
|
||||||
|
binding.llPricePaid.setBackgroundResource(
|
||||||
|
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkPricePaid() {
|
||||||
|
binding.llSetPrice.visibility = View.VISIBLE
|
||||||
|
binding.llConfigKeep.visibility = View.VISIBLE
|
||||||
|
binding.tvTitleConfigKeep.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
binding.ivPricePaid.visibility = View.VISIBLE
|
||||||
|
binding.tvPricePaid.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
applicationContext,
|
||||||
|
R.color.color_eeeeee
|
||||||
|
)
|
||||||
|
)
|
||||||
|
binding.llPricePaid.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
||||||
|
|
||||||
|
binding.ivPriceFree.visibility = View.GONE
|
||||||
|
binding.tvPriceFree.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
applicationContext,
|
||||||
|
R.color.color_9970ff
|
||||||
|
)
|
||||||
|
)
|
||||||
|
binding.llPriceFree.setBackgroundResource(
|
||||||
|
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkRentalAndKeep() {
|
||||||
|
binding.tvPriceTitle.text = "소장 가격"
|
||||||
|
binding.ivRentalAndKeep.visibility = View.VISIBLE
|
||||||
|
binding.tvRentalAndKeep.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
applicationContext,
|
||||||
|
R.color.color_eeeeee
|
||||||
|
)
|
||||||
|
)
|
||||||
|
binding.llRentalAndKeep.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
||||||
|
|
||||||
|
binding.ivOnlyRental.visibility = View.GONE
|
||||||
|
binding.tvOnlyRental.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
applicationContext,
|
||||||
|
R.color.color_9970ff
|
||||||
|
)
|
||||||
|
)
|
||||||
|
binding.llOnlyRental.setBackgroundResource(
|
||||||
|
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkOnlyRental() {
|
||||||
|
binding.tvPriceTitle.text = "대여 가격"
|
||||||
|
binding.ivOnlyRental.visibility = View.VISIBLE
|
||||||
|
binding.tvOnlyRental.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
applicationContext,
|
||||||
|
R.color.color_eeeeee
|
||||||
|
)
|
||||||
|
)
|
||||||
|
binding.llOnlyRental.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
||||||
|
|
||||||
|
binding.ivRentalAndKeep.visibility = View.GONE
|
||||||
|
binding.tvRentalAndKeep.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
applicationContext,
|
||||||
|
R.color.color_9970ff
|
||||||
|
)
|
||||||
|
)
|
||||||
|
binding.llRentalAndKeep.setBackgroundResource(
|
||||||
|
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun getFileName(uri: Uri): String? {
|
private fun getFileName(uri: Uri): String? {
|
||||||
val scheme = uri.scheme
|
val scheme = uri.scheme
|
||||||
var fileName: String? = null
|
var fileName: String? = null
|
||||||
|
|
|
@ -37,6 +37,10 @@ class AudioContentUploadViewModel(
|
||||||
val isAdultLiveData: LiveData<Boolean>
|
val isAdultLiveData: LiveData<Boolean>
|
||||||
get() = _isAdultLiveData
|
get() = _isAdultLiveData
|
||||||
|
|
||||||
|
private val _isOnlyRentalLiveData = MutableLiveData(false)
|
||||||
|
val isOnlyRentalLiveData: LiveData<Boolean>
|
||||||
|
get() = _isOnlyRentalLiveData
|
||||||
|
|
||||||
private val _isAvailableCommentLiveData = MutableLiveData(true)
|
private val _isAvailableCommentLiveData = MutableLiveData(true)
|
||||||
val isAvailableCommentLiveData: LiveData<Boolean>
|
val isAvailableCommentLiveData: LiveData<Boolean>
|
||||||
get() = _isAvailableCommentLiveData
|
get() = _isAvailableCommentLiveData
|
||||||
|
@ -67,6 +71,14 @@ class AudioContentUploadViewModel(
|
||||||
|
|
||||||
fun setPriceFree(isPriceFree: Boolean) {
|
fun setPriceFree(isPriceFree: Boolean) {
|
||||||
_isPriceFreeLiveData.postValue(isPriceFree)
|
_isPriceFreeLiveData.postValue(isPriceFree)
|
||||||
|
|
||||||
|
if (isPriceFree) {
|
||||||
|
_isOnlyRentalLiveData.postValue(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setIsOnlyRental(isOnlyRental: Boolean) {
|
||||||
|
_isOnlyRentalLiveData.postValue(isOnlyRental)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun uploadAudioContent(onSuccess: () -> Unit) {
|
fun uploadAudioContent(onSuccess: () -> Unit) {
|
||||||
|
@ -80,6 +92,7 @@ class AudioContentUploadViewModel(
|
||||||
price = price,
|
price = price,
|
||||||
themeId = theme!!.id,
|
themeId = theme!!.id,
|
||||||
isAdult = _isAdultLiveData.value!!,
|
isAdult = _isAdultLiveData.value!!,
|
||||||
|
isOnlyRental = _isOnlyRentalLiveData.value!!,
|
||||||
isCommentAvailable = _isAvailableCommentLiveData.value!!,
|
isCommentAvailable = _isAvailableCommentLiveData.value!!,
|
||||||
previewStartTime = previewStartTime,
|
previewStartTime = previewStartTime,
|
||||||
previewEndTime = previewEndTime
|
previewEndTime = previewEndTime
|
||||||
|
|
|
@ -9,6 +9,7 @@ data class CreateAudioContentRequest(
|
||||||
@SerializedName("price") val price: Int,
|
@SerializedName("price") val price: Int,
|
||||||
@SerializedName("themeId") val themeId: Long,
|
@SerializedName("themeId") val themeId: Long,
|
||||||
@SerializedName("isAdult") val isAdult: Boolean,
|
@SerializedName("isAdult") val isAdult: Boolean,
|
||||||
|
@SerializedName("isOnlyRental") val isOnlyRental: Boolean,
|
||||||
@SerializedName("isCommentAvailable") val isCommentAvailable: Boolean,
|
@SerializedName("isCommentAvailable") val isCommentAvailable: Boolean,
|
||||||
@SerializedName("previewStartTime") val previewStartTime: String? = null,
|
@SerializedName("previewStartTime") val previewStartTime: String? = null,
|
||||||
@SerializedName("previewEndTime") val previewEndTime: String? = null
|
@SerializedName("previewEndTime") val previewEndTime: String? = null
|
||||||
|
|
|
@ -366,6 +366,84 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title_config_keep"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="13.3dp"
|
||||||
|
android:layout_marginTop="26.7dp"
|
||||||
|
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_keep"
|
||||||
|
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_rental_and_keep"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/bg_round_corner_6_7_1f1734"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingVertical="14.3dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_rental_and_keep"
|
||||||
|
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_rental_and_keep"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/gmarket_sans_bold"
|
||||||
|
android:text="소장/대여"
|
||||||
|
android:textColor="@color/color_9970ff"
|
||||||
|
android:textSize="14.7sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_only_rental"
|
||||||
|
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_1f1734"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingVertical="14.3dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_only_rental"
|
||||||
|
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_only_rental"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/gmarket_sans_bold"
|
||||||
|
android:text="대여만"
|
||||||
|
android:textColor="@color/color_9970ff"
|
||||||
|
android:textSize="14.7sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_set_price"
|
android:id="@+id/ll_set_price"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -376,10 +454,11 @@
|
||||||
android:visibility="visible">
|
android:visibility="visible">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_price_title"
|
||||||
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_medium"
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
android:text="소장가격"
|
android:text="소장 가격"
|
||||||
android:textColor="@color/color_eeeeee"
|
android:textColor="@color/color_eeeeee"
|
||||||
android:textSize="13.3sp" />
|
android:textSize="13.3sp" />
|
||||||
|
|
||||||
|
@ -432,7 +511,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_medium"
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
android:text="※ 이용기간 : 대여(7일) | 소장(서비스종료시까지)"
|
android:text="※ 이용기간 : 대여(15일) | 소장(서비스종료시까지)"
|
||||||
android:textColor="@color/color_777777"
|
android:textColor="@color/color_777777"
|
||||||
android:textSize="13.3sp" />
|
android:textSize="13.3sp" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue