Artist album changes to card
This commit is contained in:
parent
52dc1d9f22
commit
4fdb336444
3 changed files with 7 additions and 6 deletions
|
@ -65,7 +65,7 @@ class HorizontalAlbumAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemViewType(position: Int): Int {
|
override fun getItemViewType(position: Int): Int {
|
||||||
return HorizontalAdapterHelper.getItemViewtype(position, itemCount)
|
return HorizontalAdapterHelper.getItemViewType(position, itemCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import code.name.monkey.retromusic.R
|
||||||
|
|
||||||
object HorizontalAdapterHelper {
|
object HorizontalAdapterHelper {
|
||||||
|
|
||||||
const val LAYOUT_RES = R.layout.item_album_card
|
const val LAYOUT_RES = R.layout.item_image
|
||||||
|
|
||||||
private const val TYPE_FIRST = 1
|
private const val TYPE_FIRST = 1
|
||||||
private const val TYPE_MIDDLE = 2
|
private const val TYPE_MIDDLE = 2
|
||||||
|
@ -40,7 +40,7 @@ object HorizontalAdapterHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getItemViewtype(position: Int, itemCount: Int): Int {
|
fun getItemViewType(position: Int, itemCount: Int): Int {
|
||||||
return when (position) {
|
return when (position) {
|
||||||
0 -> TYPE_FIRST
|
0 -> TYPE_FIRST
|
||||||
itemCount - 1 -> TYPE_LAST
|
itemCount - 1 -> TYPE_LAST
|
||||||
|
|
|
@ -7,14 +7,15 @@
|
||||||
android:background="?rectSelector"
|
android:background="?rectSelector"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.WidthFitSquareCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/imageContainer"
|
android:id="@+id/imageContainer"
|
||||||
android:layout_width="156dp"
|
android:layout_width="156dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
app:cardPreventCornerOverlap="true"
|
app:cardPreventCornerOverlap="true"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
@ -26,7 +27,7 @@
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
tools:srcCompat="@tools:sample/backgrounds/scenic[16]" />
|
tools:srcCompat="@tools:sample/backgrounds/scenic[16]" />
|
||||||
|
|
||||||
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
|
|
Loading…
Reference in a new issue