Skip to content

Commit

Permalink
[feat/mypage]: feat 앨범커버 번호에 따른 앨범커버 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
librarywon committed Jul 7, 2023
1 parent c84cd31 commit c8924f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.teampophory.pophory.R
import com.teampophory.pophory.common.view.ItemDiffCallback
import com.teampophory.pophory.databinding.ItemStorePagerBinding
import com.teampophory.pophory.feature.home.store.model.AlbumItem
Expand All @@ -29,6 +30,16 @@ class StoreAdapter(
private val onPageChangedListener: OnPageChangedListener
) : RecyclerView.ViewHolder(binding.root) {
fun bind(albumItem: AlbumItem) {

val albumCover = when (albumItem.albumCover) {
1 -> R.drawable.ic_album_cover_friends
2 -> R.drawable.ic_album_cover_love
3 -> R.drawable.ic_album_cover_myalbum
4 -> R.drawable.ic_album_cover_collectbook
else -> R.drawable.ic_album_cover_myalbum
}
binding.ivStorePager.setBackgroundResource(albumCover)

itemView.setOnClickListener {
onItemClicked(albumItem)
onPageChangedListener.onPageChanged(albumItem)
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/item_store_pager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginHorizontal="45dp"
android:src="@drawable/ic_album_cover_friends"
android:contentDescription="pager item image"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down

0 comments on commit c8924f0

Please sign in to comment.