fix(home): 최근 데뷔 카드 clipping을 보완한다
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package kr.co.vividnext.sodalive.v2.main.home.ui
|
||||
|
||||
import android.graphics.Outline
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewOutlineProvider
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@@ -22,7 +24,7 @@ class HomeRecentDebutCreatorAdapter(
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CreatorViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_home_recent_debut_creator, parent, false)
|
||||
view.layoutParams = recentDebutItemLayoutParams(parent)
|
||||
view.layoutParams = view.layoutParams.recentDebutItemLayoutParams(parent)
|
||||
return CreatorViewHolder(view, onClickItem)
|
||||
}
|
||||
|
||||
@@ -39,6 +41,16 @@ class HomeRecentDebutCreatorAdapter(
|
||||
private val profileImage = itemView.findViewById<ImageView>(R.id.iv_home_recent_debut_creator_profile)
|
||||
private val nicknameText = itemView.findViewById<TextView>(R.id.tv_home_recent_debut_creator_nickname)
|
||||
|
||||
init {
|
||||
itemView.clipToOutline = true
|
||||
itemView.outlineProvider = object : ViewOutlineProvider() {
|
||||
override fun getOutline(view: View, outline: Outline) {
|
||||
val radius = view.resources.getDimension(R.dimen.radius_14)
|
||||
outline.setRoundRect(0, 0, view.width, view.height, radius)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun bind(item: HomeRecommendationCreatorUiModel) {
|
||||
profileImage.loadUrl(item.profileImage)
|
||||
nicknameText.text = item.nickname
|
||||
@@ -46,10 +58,9 @@ class HomeRecentDebutCreatorAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
private fun recentDebutItemLayoutParams(parent: ViewGroup): RecyclerView.LayoutParams {
|
||||
return RecyclerView.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
).apply { marginEnd = parent.resources.getDimensionPixelSize(R.dimen.spacing_4) }
|
||||
private fun ViewGroup.LayoutParams.recentDebutItemLayoutParams(parent: ViewGroup): RecyclerView.LayoutParams {
|
||||
return RecyclerView.LayoutParams(this).apply {
|
||||
marginEnd = parent.resources.getDimensionPixelSize(R.dimen.spacing_4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="205dp"
|
||||
android:layout_height="259dp"
|
||||
android:background="@drawable/bg_home_recent_debut_card"
|
||||
android:outlineProvider="background">
|
||||
android:layout_width="185dp"
|
||||
android:layout_height="234dp"
|
||||
android:background="@drawable/bg_home_recent_debut_card">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_home_recent_debut_creator_profile"
|
||||
android:layout_width="205dp"
|
||||
android:layout_height="259dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="centerCrop"
|
||||
tools:src="@drawable/ic_launcher_background" />
|
||||
|
||||
Reference in New Issue
Block a user