콘텐츠 상세
- 이전화/다음화 버튼 추가
This commit is contained in:
@@ -26,6 +26,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.google.gson.Gson
|
||||
@@ -417,6 +418,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
setupInfoArea(it)
|
||||
setupPurchaseButton(it)
|
||||
setupCommentArea(it)
|
||||
setupPreviousNextContentArea(it.previousContent, it.nextContent)
|
||||
setupCreatorOtherContentListArea(it.creatorOtherContentList)
|
||||
setupSameThemeOtherContentList(it.sameThemeOtherContentList)
|
||||
}
|
||||
@@ -464,6 +466,78 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupPreviousNextContentArea(
|
||||
previousContent: OtherContentResponse?,
|
||||
nextContent: OtherContentResponse?
|
||||
) {
|
||||
binding.llPreviousNextContent.visibility = if (
|
||||
previousContent != null ||
|
||||
nextContent != null
|
||||
) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
|
||||
if (previousContent != null) {
|
||||
binding.llPreviousContent.visibility = View.VISIBLE
|
||||
binding.viewPreviousNone.visibility = View.GONE
|
||||
|
||||
binding.ivPreviousCover.load(previousContent.coverUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.bg_placeholder)
|
||||
transformations(RoundedCornersTransformation(5.3f.dpToPx()))
|
||||
}
|
||||
|
||||
binding.tvPreviousTitle.text = previousContent.title
|
||||
|
||||
binding.llPreviousContent.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
applicationContext,
|
||||
AudioContentDetailActivity::class.java
|
||||
).apply {
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, previousContent.contentId)
|
||||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||
}
|
||||
)
|
||||
}
|
||||
} else {
|
||||
binding.viewPreviousNone.visibility = View.VISIBLE
|
||||
binding.llPreviousContent.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (nextContent != null) {
|
||||
binding.llNextContent.visibility = View.VISIBLE
|
||||
binding.viewNextNone.visibility = View.GONE
|
||||
|
||||
binding.ivNextCover.load(nextContent.coverUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.bg_placeholder)
|
||||
transformations(RoundedCornersTransformation(5.3f.dpToPx()))
|
||||
}
|
||||
|
||||
binding.tvNextTitle.text = nextContent.title
|
||||
|
||||
binding.llNextContent.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
applicationContext,
|
||||
AudioContentDetailActivity::class.java
|
||||
).apply {
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, nextContent.contentId)
|
||||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||
}
|
||||
)
|
||||
}
|
||||
} else {
|
||||
binding.viewNextNone.visibility = View.VISIBLE
|
||||
binding.llNextContent.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupCommentArea(response: GetAudioContentDetailResponse) {
|
||||
if (
|
||||
response.isCommentAvailable &&
|
||||
|
||||
@@ -39,7 +39,9 @@ data class GetAudioContentDetailResponse(
|
||||
@SerializedName("commentCount") val commentCount: Int,
|
||||
@SerializedName("isPin") val isPin: Boolean,
|
||||
@SerializedName("isAvailablePin") val isAvailablePin: Boolean,
|
||||
@SerializedName("creator") val creator: AudioContentCreator
|
||||
@SerializedName("creator") val creator: AudioContentCreator,
|
||||
@SerializedName("previousContent") val previousContent: OtherContentResponse?,
|
||||
@SerializedName("nextContent") val nextContent: OtherContentResponse?
|
||||
)
|
||||
|
||||
@Keep
|
||||
|
||||
Reference in New Issue
Block a user