parent
9dd3c568d8
commit
ae617d5154
|
@ -46,6 +46,7 @@ import kr.co.vividnext.sodalive.explorer.profile.donation.UserProfileDonationAda
|
|||
import kr.co.vividnext.sodalive.explorer.profile.donation.UserProfileDonationAllViewActivity
|
||||
import kr.co.vividnext.sodalive.explorer.profile.fantalk.UserProfileFantalkAllViewActivity
|
||||
import kr.co.vividnext.sodalive.explorer.profile.follow.UserFollowerListActivity
|
||||
import kr.co.vividnext.sodalive.explorer.profile.series.UserProfileSeriesListAdapter
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.extensions.loadUrl
|
||||
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||
|
@ -74,7 +75,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
|||
private lateinit var loadingDialog: LoadingDialog
|
||||
private lateinit var liveAdapter: UserProfileLiveAdapter
|
||||
private lateinit var audioContentAdapter: AudioContentAdapter
|
||||
private lateinit var seriesAdapter: SeriesListAdapter
|
||||
private lateinit var seriesAdapter: UserProfileSeriesListAdapter
|
||||
private lateinit var donationAdapter: UserProfileDonationAdapter
|
||||
private lateinit var cheersAdapter: UserProfileCheersAdapter
|
||||
|
||||
|
@ -437,7 +438,7 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
|||
false
|
||||
)
|
||||
|
||||
seriesAdapter = SeriesListAdapter(
|
||||
seriesAdapter = UserProfileSeriesListAdapter(
|
||||
onClickItem = {
|
||||
startActivity(
|
||||
Intent(applicationContext, SeriesDetailActivity::class.java).apply {
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
package kr.co.vividnext.sodalive.explorer.profile.series
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.series.GetSeriesListResponse
|
||||
import kr.co.vividnext.sodalive.databinding.ItemSeriesListBigBinding
|
||||
import kr.co.vividnext.sodalive.databinding.ItemSeriesListBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
|
||||
class UserProfileSeriesListAdapter(
|
||||
private val onClickItem: (Long) -> Unit,
|
||||
private val onClickCreator: (Long) -> Unit,
|
||||
private val isVisibleCreator: Boolean
|
||||
) : RecyclerView.Adapter<UserProfileSeriesListAdapter.ViewHolder>() {
|
||||
|
||||
val items = mutableListOf<GetSeriesListResponse.SeriesListItem>()
|
||||
|
||||
inner class ViewHolder(
|
||||
private val binding: ItemSeriesListBigBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun bind(item: GetSeriesListResponse.SeriesListItem) {
|
||||
binding.ivCover.load(item.coverImage) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.bg_placeholder)
|
||||
transformations(RoundedCornersTransformation(5f.dpToPx()))
|
||||
}
|
||||
|
||||
binding.tvTitle.text = item.title
|
||||
binding.tvSeriesContentCount.text = "총 ${item.numberOfContent}화"
|
||||
binding.tvPublishedDaysOfWeek.text = item.publishedDaysOfWeek
|
||||
|
||||
binding.tvNew.visibility = if (item.isNew) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
|
||||
binding.tvPopular.visibility = if (item.isPopular) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
|
||||
if (item.isComplete) {
|
||||
binding.tvNew.visibility = View.GONE
|
||||
binding.tvComplete.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.tvComplete.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (isVisibleCreator) {
|
||||
binding.llCreator.visibility = View.VISIBLE
|
||||
binding.tvCreator.text = item.creator.nickname
|
||||
binding.ivCreator.load(item.creator.profileImage) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.ic_place_holder)
|
||||
transformations(CircleCropTransformation())
|
||||
}
|
||||
binding.llCreator.setOnClickListener { onClickCreator(item.creator.creatorId) }
|
||||
} else {
|
||||
binding.llCreator.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.root.setOnClickListener { onClickItem(item.seriesId) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(
|
||||
ItemSeriesListBigBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.count()
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun addItems(items: List<GetSeriesListResponse.SeriesListItem>) {
|
||||
this.items.addAll(items)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
this.items.clear()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_cover"
|
||||
android:layout_width="116.7dp"
|
||||
android:layout_height="165dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/ic_launcher_background" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/gradient_live_room_item" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3.3dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="@+id/fl_cover"
|
||||
app:layout_constraintStart_toStartOf="@+id/fl_cover"
|
||||
app:layout_constraintTop_toTopOf="@+id/fl_cover">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_new"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3.3dp"
|
||||
android:background="@drawable/bg_round_corner_13_3_3bb9f1"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:paddingHorizontal="5.3dp"
|
||||
android:paddingVertical="3.7dp"
|
||||
android:text="신작"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10.3sp"
|
||||
android:visibility="gone"
|
||||
tools:ignore="SmallSp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_complete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3.3dp"
|
||||
android:background="@drawable/bg_round_corner_13_3_002abd"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:paddingHorizontal="5.3dp"
|
||||
android:paddingVertical="3.7dp"
|
||||
android:text="완결"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10.3sp"
|
||||
android:visibility="gone"
|
||||
tools:ignore="SmallSp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_popular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3.3dp"
|
||||
android:background="@drawable/bg_round_corner_13_3_ec6033"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:paddingHorizontal="5.3dp"
|
||||
android:paddingVertical="3.7dp"
|
||||
android:text="인기"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10.3sp"
|
||||
android:visibility="gone"
|
||||
tools:ignore="SmallSp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_series_content_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3.3dp"
|
||||
android:background="@drawable/bg_round_corner_13_3_b3333333"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:paddingHorizontal="5.3dp"
|
||||
android:paddingVertical="2.7dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10.3sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/fl_cover"
|
||||
app:layout_constraintEnd_toEndOf="@+id/fl_cover"
|
||||
tools:ignore="SmallSp"
|
||||
tools:text="총 24화" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:maxLines="2"
|
||||
android:textColor="@color/color_eeeeee"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/fl_cover"
|
||||
tools:text="제목, 관심사,프로필+방장, 참여인원(어딘가..)" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_creator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_creator"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:contentDescription="@null"
|
||||
tools:src="@drawable/ic_launcher_background" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_creator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/color_777777"
|
||||
android:textSize="10sp"
|
||||
tools:ignore="SmallSp"
|
||||
tools:text="pgwkill" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_published_days_of_week"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:textColor="@color/color_777777"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_creator"
|
||||
tools:text="매주 수, 토요일" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue