콘텐츠 상세
- 댓글이 없을 때 유료 콘텐츠를 구매한 사람이 비밀댓글을 등록할 수 있는 기능 추가
This commit is contained in:
@@ -8,12 +8,14 @@ class AudioContentCommentRepository(private val api: AudioContentApi) {
|
||||
contentId: Long,
|
||||
comment: String,
|
||||
parentId: Long? = null,
|
||||
isSecret: Boolean = false,
|
||||
token: String
|
||||
) = api.registerComment(
|
||||
request = RegisterAudioContentCommentRequest(
|
||||
comment = comment,
|
||||
contentId = contentId,
|
||||
parentId = parentId
|
||||
parentId = parentId,
|
||||
isSecret = isSecret
|
||||
),
|
||||
authHeader = token
|
||||
)
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.comment
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
@Keep
|
||||
data class RegisterAudioContentCommentRequest(
|
||||
@SerializedName("comment") val comment: String,
|
||||
@SerializedName("contentId") val contentId: Long,
|
||||
@SerializedName("parentId") val parentId: Long?
|
||||
@SerializedName("parentId") val parentId: Long?,
|
||||
@SerializedName("isSecret") val isSecret: Boolean
|
||||
)
|
||||
|
@@ -469,6 +469,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
binding.tvCommentText.text = response.commentList[0].comment
|
||||
binding.tvCommentText.visibility = View.VISIBLE
|
||||
binding.rlInputComment.visibility = View.GONE
|
||||
binding.tvSecret.visibility = View.GONE
|
||||
|
||||
binding.llComment.setOnClickListener { showCommentBottomSheetDialog() }
|
||||
} else {
|
||||
@@ -482,8 +483,20 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
|
||||
binding.ivCommentSend.setOnClickListener {
|
||||
val comment = binding.etComment.text.toString()
|
||||
val isSecret = binding.tvSecret.isSelected
|
||||
viewModel.registerComment(audioContentId, comment, isSecret)
|
||||
|
||||
binding.etComment.setText("")
|
||||
viewModel.registerComment(audioContentId, comment)
|
||||
binding.tvSecret.isSelected = false
|
||||
}
|
||||
|
||||
if (response.existOrdered) {
|
||||
binding.tvSecret.visibility = View.VISIBLE
|
||||
binding.tvSecret.setOnClickListener {
|
||||
binding.tvSecret.isSelected = !binding.tvSecret.isSelected
|
||||
}
|
||||
} else {
|
||||
binding.tvSecret.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.llComment.setOnClickListener {}
|
||||
|
@@ -254,7 +254,7 @@ class AudioContentDetailViewModel(
|
||||
)
|
||||
}
|
||||
|
||||
fun registerComment(audioContentId: Long, comment: String) {
|
||||
fun registerComment(audioContentId: Long, comment: String, isSecret: Boolean) {
|
||||
if (!isLoading.value!!) {
|
||||
isLoading.value = true
|
||||
}
|
||||
@@ -263,6 +263,7 @@ class AudioContentDetailViewModel(
|
||||
commentRepository.registerComment(
|
||||
contentId = audioContentId,
|
||||
comment = comment,
|
||||
isSecret = isSecret,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
@@ -604,29 +604,50 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="10.3dp">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:text="댓글"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_comment_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5.3dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:textColor="@color/color_909090"
|
||||
android:textSize="12sp"
|
||||
tools:text="1,204" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_secret"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:button="@null"
|
||||
android:drawablePadding="8dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:text="댓글"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
android:gravity="center"
|
||||
android:text="비밀댓글"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="12.5sp"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_select" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_comment_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5.3dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:textColor="@color/color_909090"
|
||||
android:textSize="12sp"
|
||||
tools:text="1,204" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
Reference in New Issue
Block a user