parent
e51af38b75
commit
a88f8c3316
|
@ -90,7 +90,7 @@ class AudioContentNewAllActivity : BaseActivity<ActivityAudioContentNewAllBindin
|
|||
|
||||
private fun setupNewContent() {
|
||||
newContentAdapter = AudioContentNewAllAdapter(
|
||||
itemWidth = (screenWidth - 40f.dpToPx().toInt()) / 2,
|
||||
itemWidth = (screenWidth - 54f.dpToPx().toInt()) / 3,
|
||||
onClickItem = {
|
||||
startActivity(
|
||||
Intent(this, AudioContentDetailActivity::class.java).apply {
|
||||
|
@ -107,7 +107,7 @@ class AudioContentNewAllActivity : BaseActivity<ActivityAudioContentNewAllBindin
|
|||
}
|
||||
)
|
||||
|
||||
binding.rvContent.layoutManager = GridLayoutManager(this, 2)
|
||||
binding.rvContent.layoutManager = GridLayoutManager(this, 3)
|
||||
|
||||
binding.rvContent.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||
override fun getItemOffsets(
|
||||
|
@ -118,31 +118,10 @@ class AudioContentNewAllActivity : BaseActivity<ActivityAudioContentNewAllBindin
|
|||
) {
|
||||
super.getItemOffsets(outRect, view, parent, state)
|
||||
|
||||
val position = parent.getChildAdapterPosition(view)
|
||||
if (position % 2 == 0) {
|
||||
outRect.left = 13.3f.dpToPx().toInt()
|
||||
outRect.right = 6.7f.dpToPx().toInt()
|
||||
} else {
|
||||
outRect.left = 6.7f.dpToPx().toInt()
|
||||
outRect.right = 13.3f.dpToPx().toInt()
|
||||
}
|
||||
|
||||
when (position) {
|
||||
0, 1 -> {
|
||||
outRect.top = 13.3f.dpToPx().toInt()
|
||||
outRect.bottom = 6.7f.dpToPx().toInt()
|
||||
}
|
||||
|
||||
newContentAdapter.itemCount - 1, newContentAdapter.itemCount - 2 -> {
|
||||
outRect.top = 6.7f.dpToPx().toInt()
|
||||
outRect.bottom = 13.3f.dpToPx().toInt()
|
||||
}
|
||||
|
||||
else -> {
|
||||
outRect.top = 6.7f.dpToPx().toInt()
|
||||
outRect.bottom = 6.7f.dpToPx().toInt()
|
||||
}
|
||||
}
|
||||
outRect.top = 6.7f.dpToPx().toInt()
|
||||
outRect.bottom = 6.7f.dpToPx().toInt()
|
||||
outRect.left = 6.7f.dpToPx().toInt()
|
||||
outRect.right = 6.7f.dpToPx().toInt()
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.audio_content.all
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -26,6 +27,7 @@ class AudioContentNewAllAdapter(
|
|||
private val onClickCreator: (Long) -> Unit
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: GetAudioContentMainItem) {
|
||||
Logger.e("item: $item")
|
||||
binding.ivAudioContentCoverImage.load(item.coverImageUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.ic_place_holder)
|
||||
|
@ -48,6 +50,16 @@ class AudioContentNewAllAdapter(
|
|||
binding.tvAudioContentTitle.text = item.title
|
||||
binding.tvAudioContentCreatorNickname.text = item.creatorNickname
|
||||
|
||||
if (item.price > 0) {
|
||||
binding.ivCan.visibility = View.VISIBLE
|
||||
binding.tvCan.text = "${item.price}"
|
||||
} else {
|
||||
binding.ivCan.visibility = View.GONE
|
||||
binding.tvCan.text = "무료"
|
||||
}
|
||||
|
||||
binding.tvTime.text = item.duration
|
||||
|
||||
binding.ivAudioContentCreator.setOnClickListener { onClickCreator(item.creatorId) }
|
||||
binding.root.setOnClickListener { onClickItem(item.contentId) }
|
||||
}
|
||||
|
|
|
@ -15,7 +15,9 @@ data class GetAudioContentMainItem(
|
|||
@SerializedName("title") val title: String,
|
||||
@SerializedName("creatorId") val creatorId: Long,
|
||||
@SerializedName("creatorProfileImageUrl") val creatorProfileImageUrl: String,
|
||||
@SerializedName("creatorNickname") val creatorNickname: String
|
||||
@SerializedName("creatorNickname") val creatorNickname: String,
|
||||
@SerializedName("price") val price: Int,
|
||||
@SerializedName("duration") val duration: String
|
||||
)
|
||||
|
||||
data class GetAudioContentRanking(
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 552 B |
Binary file not shown.
After Width: | Height: | Size: 543 B |
|
@ -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_b3333333" />
|
||||
<corners android:radius="10dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_b3333333" />
|
||||
</shape>
|
|
@ -13,6 +13,68 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2.7dp"
|
||||
android:layout_marginBottom="2.7dp"
|
||||
android:background="@drawable/bg_round_corner_10_b3333333"
|
||||
android:orientation="horizontal"
|
||||
android:padding="3dp"
|
||||
android:gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_audio_content_cover_image"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_audio_content_cover_image">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_can"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_card_can_gray" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_can"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="8.3sp"
|
||||
tools:ignore="SmallSp"
|
||||
tools:text="300" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="2.7dp"
|
||||
android:layout_marginBottom="2.7dp"
|
||||
android:background="@drawable/bg_round_corner_10_b3333333"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:padding="3dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_audio_content_cover_image"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_audio_content_cover_image">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_card_time_small_gray" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="8.3sp"
|
||||
tools:ignore="SmallSp"
|
||||
tools:text="00:00:30" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_audio_content_title"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<color name="color_ccc25264">#CCC25264</color>
|
||||
|
||||
<color name="color_b3909090">#B3909090</color>
|
||||
<color name="color_b3333333">#B3333333</color>
|
||||
<color name="color_88909090">#88909090</color>
|
||||
<color name="color_339970ff">#339970FF</color>
|
||||
<color name="color_7fe2e2e2">#7FE2E2E2</color>
|
||||
|
|
Loading…
Reference in New Issue