지금 라이브중 전체보기 UI를 라이브 탭과 동일하게 변경
라이브 카드에 19금 방 안내 shield 표시
This commit is contained in:
@@ -45,6 +45,12 @@ class LiveNowAdapter(
|
||||
View.GONE
|
||||
}
|
||||
|
||||
binding.ivShield.visibility = if (item.isAdult) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
|
||||
if (item.price > 0) {
|
||||
binding.llCan.visibility = View.VISIBLE
|
||||
binding.tvCan.text = item.price.moneyFormat()
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.media3.common.util.UnstableApi
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.AudioContentPlayService
|
||||
import kr.co.vividnext.sodalive.audio_content.player.AudioContentPlayerService
|
||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
@@ -17,7 +18,7 @@ import kr.co.vividnext.sodalive.common.GridSpacingItemDecoration
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.databinding.ActivityLiveNowAllBinding
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.live.LiveViewModel
|
||||
import kr.co.vividnext.sodalive.live.room.LiveRoomActivity
|
||||
import kr.co.vividnext.sodalive.live.room.detail.LiveRoomDetailFragment
|
||||
@@ -53,7 +54,7 @@ class LiveNowAllActivity : BaseActivity<ActivityLiveNowAllBinding>(
|
||||
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||
|
||||
val spanCount = 2
|
||||
val spacing = 48
|
||||
val spacing = 16.dpToPx().toInt()
|
||||
val recyclerView = binding.rvLive
|
||||
adapter = LiveNowAllAdapter(itemWidth = (screenWidth - (spacing * (spanCount + 1))) / 2) {
|
||||
val detailFragment = LiveRoomDetailFragment(
|
||||
|
||||
@@ -2,26 +2,18 @@ package kr.co.vividnext.sodalive.live.now.all
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.transform.CircleCropTransformation
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.bumptech.glide.request.target.CustomTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.databinding.ItemLiveNowAllBinding
|
||||
import kr.co.vividnext.sodalive.databinding.ItemLiveNowBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.extensions.loadUrl
|
||||
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||
import kr.co.vividnext.sodalive.live.GetRoomListResponse
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class LiveNowAllAdapter(
|
||||
private val itemWidth: Int,
|
||||
@@ -32,25 +24,38 @@ class LiveNowAllAdapter(
|
||||
|
||||
inner class ViewHolder(
|
||||
private val context: Context,
|
||||
private val binding: ItemLiveNowAllBinding
|
||||
private val binding: ItemLiveNowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun bind(item: GetRoomListResponse) {
|
||||
val baseCardWidth = 144.dpToPx()
|
||||
val baseCardHeight = 204.dpToPx()
|
||||
val scale = itemWidth / baseCardWidth
|
||||
|
||||
val rootLayoutParams = binding.root.layoutParams
|
||||
rootLayoutParams.width = itemWidth
|
||||
rootLayoutParams.height = (baseCardHeight * scale).roundToInt()
|
||||
binding.root.layoutParams = rootLayoutParams
|
||||
|
||||
val profileLayoutParams = binding.flProfile.layoutParams
|
||||
profileLayoutParams.width = (84.dpToPx() * scale).roundToInt()
|
||||
profileLayoutParams.height = (84.dpToPx() * scale).roundToInt()
|
||||
binding.flProfile.layoutParams = profileLayoutParams
|
||||
|
||||
val profileImageLayoutParams = binding.ivProfile.layoutParams
|
||||
profileImageLayoutParams.width = (72.dpToPx() * scale).roundToInt()
|
||||
profileImageLayoutParams.height = (72.dpToPx() * scale).roundToInt()
|
||||
binding.ivProfile.layoutParams = profileImageLayoutParams
|
||||
|
||||
Glide
|
||||
.with(context)
|
||||
.load(item.coverImageUrl)
|
||||
.load(item.creatorProfileImage)
|
||||
.apply(
|
||||
RequestOptions().transform(
|
||||
CenterCrop(),
|
||||
RoundedCorners(14)
|
||||
CircleCrop()
|
||||
)
|
||||
)
|
||||
.into(binding.ivCover)
|
||||
|
||||
val layoutParams = binding.ivCover
|
||||
.layoutParams as ConstraintLayout.LayoutParams
|
||||
layoutParams.width = itemWidth
|
||||
layoutParams.height = itemWidth * 144 / 102
|
||||
.into(binding.ivProfile)
|
||||
|
||||
binding.ivLock.visibility = if (item.isPrivateRoom) {
|
||||
View.VISIBLE
|
||||
@@ -58,53 +63,23 @@ class LiveNowAllAdapter(
|
||||
View.GONE
|
||||
}
|
||||
|
||||
if (item.price > 0) {
|
||||
binding.tvPrice.text = "${item.price}"
|
||||
binding.tvPrice.setCompoundDrawablesWithIntrinsicBounds(
|
||||
R.drawable.ic_can_white,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
binding.tvPrice.setBackgroundResource(R.drawable.bg_round_corner_13_3_dd4500)
|
||||
binding.ivShield.visibility = if (item.isAdult) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
binding.tvPrice.text = context.getString(R.string.screen_live_now_all_free)
|
||||
binding.tvPrice.setCompoundDrawables(null, null, null, null)
|
||||
binding.tvPrice.setBackgroundResource(R.drawable.bg_round_corner_13_3_111111)
|
||||
View.GONE
|
||||
}
|
||||
|
||||
if (item.tags.isNotEmpty()) {
|
||||
binding.tvTags.visibility = View.VISIBLE
|
||||
binding.tvTags.text = item.tags.joinToString(" ") { "#$it" }
|
||||
if (item.price > 0) {
|
||||
binding.llCan.visibility = View.VISIBLE
|
||||
binding.tvCan.text = item.price.moneyFormat()
|
||||
binding.tvFree.visibility = View.GONE
|
||||
} else {
|
||||
binding.tvTags.visibility = View.GONE
|
||||
binding.llCan.visibility = View.GONE
|
||||
binding.tvFree.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
binding.tvTitle.text = item.title
|
||||
binding.tvNickname.text = item.creatorNickname
|
||||
binding.ivProfile.loadUrl(item.creatorProfileImage) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.ic_place_holder)
|
||||
transformations(CircleCropTransformation())
|
||||
}
|
||||
|
||||
if (item.numberOfPeople - item.numberOfParticipate <= 2) {
|
||||
binding.llRemainingParticipant.visibility = View.VISIBLE
|
||||
if (item.numberOfPeople > item.numberOfParticipate) {
|
||||
binding.tvRemainingParticipantNumber.visibility = View.VISIBLE
|
||||
binding.tvRemainingParticipant.text =
|
||||
context.getString(R.string.screen_live_now_all_remaining)
|
||||
binding.tvRemainingParticipantNumber.text =
|
||||
"${item.numberOfPeople - item.numberOfParticipate}"
|
||||
} else {
|
||||
binding.tvRemainingParticipantNumber.visibility = View.GONE
|
||||
binding.tvRemainingParticipant.text =
|
||||
context.getString(R.string.screen_live_now_all_sold_out)
|
||||
binding.tvRemainingParticipantNumber.text = ""
|
||||
}
|
||||
} else {
|
||||
binding.llRemainingParticipant.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.root.setOnClickListener { onClick(item) }
|
||||
}
|
||||
@@ -112,7 +87,7 @@ class LiveNowAllAdapter(
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(
|
||||
parent.context,
|
||||
ItemLiveNowAllBinding.inflate(
|
||||
ItemLiveNowBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
|
||||
BIN
app/src/main/res/drawable-mdpi/ic_shield.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_shield.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 474 B |
@@ -22,6 +22,16 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_shield"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_shield"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- 프로필 이미지 컨테이너 -->
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_profile"
|
||||
|
||||
Reference in New Issue
Block a user