크리에이터 채널, 콘텐츠 상세

- 오픈예정 추가
This commit is contained in:
klaus 2024-01-10 01:57:04 +09:00
parent eeac702cd7
commit d67bb8be50
9 changed files with 184 additions and 73 deletions

View File

@ -1,6 +1,7 @@
package kr.co.vividnext.sodalive.audio_content
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import coil.load
@ -33,6 +34,12 @@ class AudioContentAdapter(
binding.tvLikeCount.text = item.likeCount.moneyFormat()
binding.tvCommentCount.text = item.commentCount.moneyFormat()
binding.tvScheduledToOpen.visibility = if (item.isScheduledToOpen) {
View.VISIBLE
} else {
View.GONE
}
if (item.price < 1) {
binding.tvPrice.text = "무료"
binding.tvPrice.setCompoundDrawables(null, null, null, null)

View File

@ -14,6 +14,7 @@ import android.widget.RelativeLayout
import android.widget.SeekBar
import android.widget.Toast
import androidx.appcompat.widget.PopupMenu
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import coil.load
@ -497,14 +498,30 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
}
private fun setupPurchaseButton(response: GetAudioContentDetailResponse) {
if (
if (response.releaseDate != null) {
binding.llPurchase.visibility = View.VISIBLE
binding.llPurchasePrice.visibility = View.GONE
binding.tvReleaseDate.visibility = View.VISIBLE
binding.llPurchase.background = ContextCompat.getDrawable(
applicationContext,
R.drawable.bg_round_corner_5_3_525252
)
binding.tvReleaseDate.text = response.releaseDate
} else if (
response.price > 0 &&
!response.existOrdered &&
response.orderType == null &&
response.creator.creatorId != SharedPreferenceManager.userId
) {
binding.tvReleaseDate.visibility = View.GONE
binding.llPurchase.visibility = View.VISIBLE
binding.llPurchasePrice.visibility = View.VISIBLE
binding.tvPrice.text = response.price.toString()
binding.llPurchase.background = ContextCompat.getDrawable(
applicationContext,
R.drawable.bg_round_corner_5_3_3bb9f1
)
binding.tvStrPurchaseOrRental.text = if (response.isOnlyRental) {
" 대여하기"
@ -530,22 +547,33 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
.apply(RequestOptions().override((screenWidth - 13.3f.dpToPx()).toInt()))
.into(binding.ivCover)
binding.ivPlayOrPause.setOnClickListener {
startService(
Intent(this, AudioContentPlayService::class.java).apply {
putExtra(Constants.EXTRA_AUDIO_CONTENT_COVER_IMAGE_URL, response.coverImageUrl)
putExtra(Constants.EXTRA_AUDIO_CONTENT_URL, response.contentUrl)
putExtra(Constants.EXTRA_NICKNAME, response.creator.nickname)
putExtra(Constants.EXTRA_AUDIO_CONTENT_TITLE, response.title)
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, response.contentId)
putExtra(Constants.EXTRA_AUDIO_CONTENT_CREATOR_ID, response.creator.creatorId)
putExtra(Constants.EXTRA_AUDIO_CONTENT_FREE, response.price <= 0)
putExtra(
Constants.EXTRA_AUDIO_CONTENT_PREVIEW,
!response.existOrdered && response.price > 0
)
}
)
if (response.releaseDate == null) {
binding.ivPlayOrPause.visibility = View.VISIBLE
binding.ivPlayOrPause.setOnClickListener {
startService(
Intent(this, AudioContentPlayService::class.java).apply {
putExtra(
Constants.EXTRA_AUDIO_CONTENT_COVER_IMAGE_URL,
response.coverImageUrl
)
putExtra(Constants.EXTRA_AUDIO_CONTENT_URL, response.contentUrl)
putExtra(Constants.EXTRA_NICKNAME, response.creator.nickname)
putExtra(Constants.EXTRA_AUDIO_CONTENT_TITLE, response.title)
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, response.contentId)
putExtra(
Constants.EXTRA_AUDIO_CONTENT_CREATOR_ID,
response.creator.creatorId
)
putExtra(Constants.EXTRA_AUDIO_CONTENT_FREE, response.price <= 0)
putExtra(
Constants.EXTRA_AUDIO_CONTENT_PREVIEW,
!response.existOrdered && response.price > 0
)
}
)
}
} else {
binding.ivPlayOrPause.visibility = View.GONE
}
binding.tvTotalDuration.text = " / ${response.duration}"
@ -553,6 +581,11 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
@SuppressLint("SetTextI18n")
private fun setupInfoArea(response: GetAudioContentDetailResponse) {
binding.tvScheduledToOpen.visibility = if (response.releaseDate != null) {
View.VISIBLE
} else {
View.GONE
}
binding.tvTheme.text = response.themeStr
binding.tv19.visibility = if (response.isAdult) {
View.VISIBLE

View File

@ -14,6 +14,7 @@ data class GetAudioContentDetailResponse(
@SerializedName("tag") val tag: String,
@SerializedName("price") val price: Int,
@SerializedName("duration") val duration: String,
@SerializedName("releaseDate") val releaseDate: String?,
@SerializedName("isAdult") val isAdult: Boolean,
@SerializedName("isMosaic") val isMosaic: Boolean,
@SerializedName("isOnlyRental") val isOnlyRental: Boolean,

View File

@ -76,7 +76,8 @@ data class GetAudioContentListItem(
@SerializedName("duration") val duration: String?,
@SerializedName("likeCount") val likeCount: Int,
@SerializedName("commentCount") val commentCount: Int,
@SerializedName("isAdult") val isAdult: Boolean
@SerializedName("isAdult") val isAdult: Boolean,
@SerializedName("isScheduledToOpen") val isScheduledToOpen: Boolean
)
data class GetCreatorActivitySummary(

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_003851" />
<corners android:radius="2.6dp" />
<stroke
android:width="1dp"
android:color="@color/color_003851" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_3bb9f1" />
<corners android:radius="5.3dp" />
<stroke
android:width="1dp"
android:color="@color/color_3bb9f1" />
</shape>

View File

@ -115,6 +115,7 @@
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:contentDescription="@null"
android:visibility="gone"
tools:src="@drawable/btn_audio_content_play" />
<SeekBar
@ -174,28 +175,44 @@
android:layout_marginHorizontal="13.3dp"
android:layout_marginTop="13.3dp">
<TextView
android:id="@+id/tv_theme"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_round_corner_2_6_28312b"
android:paddingHorizontal="5.3dp"
android:paddingVertical="3.3dp"
android:textColor="@color/color_3bac6a"
tools:text="커버곡" />
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5.3dp"
android:layout_toEndOf="@+id/tv_theme"
android:background="@drawable/bg_round_corner_2_6_601d14"
android:paddingHorizontal="5.3dp"
android:paddingVertical="3.3dp"
android:text="19"
android:textColor="@color/color_e33621"
android:visibility="gone" />
<TextView
android:id="@+id/tv_scheduled_to_open"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5.3dp"
android:background="@drawable/bg_round_corner_2_6_003851"
android:paddingHorizontal="5.3dp"
android:paddingVertical="3.3dp"
android:text="오픈예정"
android:textColor="@color/color_3bb9f1"
android:visibility="gone" />
<TextView
android:id="@+id/tv_theme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_round_corner_2_6_28312b"
android:paddingHorizontal="5.3dp"
android:paddingVertical="3.3dp"
android:textColor="@color/color_3bac6a"
tools:text="커버곡" />
<TextView
android:id="@+id/tv_19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5.3dp"
android:background="@drawable/bg_round_corner_2_6_601d14"
android:paddingHorizontal="5.3dp"
android:paddingVertical="3.3dp"
android:text="19"
android:textColor="@color/color_e33621"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/tv_purchased"
@ -350,7 +367,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="13.3dp"
android:textColor="@color/color_9970ff"
android:textColor="@color/color_3bb9f1"
android:textSize="12sp"
android:visibility="gone"
tools:text="#커버곡 #라이브 #연애 #썸" />
@ -371,7 +388,7 @@
android:id="@+id/rl_preview_alert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_round_corner_5_3_e51e0e45_9970ff"
android:background="@drawable/bg_round_corner_5_3_13181b_3bb9f1"
android:padding="13.3dp"
android:visibility="gone">
@ -393,51 +410,72 @@
</RelativeLayout>
</FrameLayout>
<LinearLayout
<RelativeLayout
android:id="@+id/ll_purchase"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="13.3dp"
android:layout_marginTop="18.3dp"
android:background="@drawable/bg_round_corner_5_3_9970ff"
android:background="@drawable/bg_round_corner_5_3_3bb9f1"
android:gravity="center"
android:orientation="horizontal"
android:paddingVertical="16dp"
android:visibility="gone">
<ImageView
android:layout_width="16.7dp"
android:layout_height="16.7dp"
android:contentDescription="@null"
android:src="@drawable/ic_can" />
<TextView
android:id="@+id/tv_price"
<LinearLayout
android:id="@+id/ll_purchase_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5.3dp"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:layout_width="16.7dp"
android:layout_height="16.7dp"
android:contentDescription="@null"
android:src="@drawable/ic_can" />
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5.3dp"
android:fontFamily="@font/gmarket_sans_bold"
android:textColor="@color/white"
android:textSize="14.7sp"
tools:text="300" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/gmarket_sans_light"
android:text="캔으로"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_str_purchase_or_rental"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/gmarket_sans_bold"
android:text=" 구매하기"
android:textColor="@color/white"
android:textSize="14.7sp" />
</LinearLayout>
<TextView
android:id="@+id/tv_release_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:textColor="@color/white"
android:textSize="14.7sp"
tools:text="300" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/gmarket_sans_light"
android:text="캔으로"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_str_purchase_or_rental"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/gmarket_sans_bold"
android:text=" 구매하기"
android:textColor="@color/white"
android:textSize="14.7sp" />
</LinearLayout>
android:textSize="13.3sp"
android:visibility="gone"
tools:text="2024년 10월 20일 15시 30분 오픈" />
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_comment"
@ -498,7 +536,7 @@
android:id="@+id/et_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_round_corner_10_232323_9970ff"
android:background="@drawable/bg_round_corner_10_13181b_3bb9f1"
android:hint="댓글을 입력해 보세요"
android:importantForAutofill="no"
android:inputType="text"

View File

@ -28,6 +28,20 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_scheduled_to_open"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_round_corner_2_6_003851"
android:fontFamily="@font/gmarket_sans_medium"
android:padding="2.6dp"
android:text="오픈예정"
android:textColor="@color/color_3bb9f1"
android:textSize="8sp"
android:visibility="gone"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/tv_theme"
android:layout_width="wrap_content"

View File

@ -104,4 +104,5 @@
<color name="color_ffe500">#FFE500</color>
<color name="color_b38fff">#B38FFF</color>
<color name="color_004b6c">#004B6C</color>
<color name="color_003851">#003851</color>
</resources>