Change section headers in home to chip
This commit is contained in:
parent
2f769d7823
commit
5f81f48b7f
4 changed files with 36 additions and 59 deletions
|
@ -4,7 +4,6 @@ import android.util.DisplayMetrics
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.IntDef
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
|
@ -17,7 +16,8 @@ import code.name.monkey.retromusic.adapter.song.SongAdapter
|
|||
import code.name.monkey.retromusic.loaders.PlaylistSongsLoader
|
||||
import code.name.monkey.retromusic.model.*
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.views.IconImageView
|
||||
import com.google.android.material.chip.Chip
|
||||
import kotlinx.android.synthetic.main.item_option_menu.view.*
|
||||
|
||||
|
||||
class HomeAdapter(private val activity: AppCompatActivity, private var homes: List<Home>, private val displayMetrics: DisplayMetrics) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
@ -91,8 +91,8 @@ class HomeAdapter(private val activity: AppCompatActivity, private var homes: Li
|
|||
recyclerView.apply {
|
||||
adapter = AlbumFullWidthAdapter(activity, home.arrayList as ArrayList<Album>, displayMetrics)
|
||||
}
|
||||
title.text = activity.getString(home.title)
|
||||
icon.setImageResource(home.icon)
|
||||
chip.text = activity.getString(home.title)
|
||||
chip.setChipIconResource(home.icon)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,8 @@ class HomeAdapter(private val activity: AppCompatActivity, private var homes: Li
|
|||
val artistAdapter = ArtistAdapter(activity, home.arrayList as ArrayList<Artist>, PreferenceUtil.getInstance().getHomeGridStyle(context!!), false, null)
|
||||
adapter = artistAdapter
|
||||
}
|
||||
title.text = activity.getString(home.title)
|
||||
icon.setImageResource(home.icon)
|
||||
chip.text = activity.getString(home.title)
|
||||
chip.setChipIconResource(home.icon)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,8 +116,8 @@ class HomeAdapter(private val activity: AppCompatActivity, private var homes: Li
|
|||
adapter = genreAdapter
|
||||
|
||||
}
|
||||
title.text = activity.getString(home.title)
|
||||
icon.setImageResource(home.icon)
|
||||
chip.text = activity.getString(home.title)
|
||||
chip.setChipIconResource(home.icon)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,14 +130,13 @@ class HomeAdapter(private val activity: AppCompatActivity, private var homes: Li
|
|||
adapter = songAdapter
|
||||
|
||||
}
|
||||
title.text = activity.getString(home.title)
|
||||
icon.setImageResource(home.icon)
|
||||
chip.text = activity.getString(home.title)
|
||||
chip.setChipIconResource(home.icon)
|
||||
}
|
||||
}
|
||||
|
||||
private open inner class AbsHomeViewItem(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val recyclerView: RecyclerView = itemView.findViewById(R.id.recyclerView)
|
||||
val title: TextView = itemView.findViewById(R.id.sectionTitle)
|
||||
val icon: IconImageView = itemView.findViewById(R.id.sectionIcon)
|
||||
val chip: Chip = itemView.findViewById(R.id.chipHead)
|
||||
}
|
||||
}
|
|
@ -1,37 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHead"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:background="@drawable/material_design_outline"
|
||||
android:backgroundTint="?dividerColor"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="6dp">
|
||||
|
||||
<code.name.monkey.retromusic.views.IconImageView
|
||||
android:id="@+id/sectionIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:srcCompat="@drawable/ic_person_white_24dp" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
|
||||
android:id="@+id/sectionTitle"
|
||||
style="@style/SubTitleTextAppearance"
|
||||
android:padding="0dp"
|
||||
android:text="@string/for_you" />
|
||||
|
||||
</LinearLayout>
|
||||
android:fontFamily="@font/circular"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
app:chipBackgroundColor="?colorPrimary"
|
||||
app:chipIconTint="?iconColor"
|
||||
app:chipStrokeColor="?dividerColor"
|
||||
app:chipStrokeWidth="1dp"
|
||||
app:iconStartPadding="8dp"
|
||||
tools:chipIcon="@drawable/ic_person_white_24dp"
|
||||
tools:text="@string/for_you" />
|
||||
|
||||
<code.name.monkey.retromusic.views.MetalRecyclerViewPager
|
||||
android:id="@+id/recyclerView"
|
||||
|
|
|
@ -2,37 +2,26 @@
|
|||
|
||||
<LinearLayout 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:id="@+id/recentArtistContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/chipHead"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:background="@drawable/material_design_outline"
|
||||
android:backgroundTint="?dividerColor"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="6dp">
|
||||
|
||||
<code.name.monkey.retromusic.views.IconImageView
|
||||
android:id="@+id/sectionIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:srcCompat="@drawable/ic_person_white_24dp" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
|
||||
android:id="@+id/sectionTitle"
|
||||
style="@style/SubTitleTextAppearance"
|
||||
android:padding="0dp"
|
||||
android:text="@string/for_you" />
|
||||
|
||||
</LinearLayout>
|
||||
android:fontFamily="@font/circular"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
app:chipBackgroundColor="?colorPrimary"
|
||||
app:chipIconTint="?iconColor"
|
||||
app:chipStrokeColor="?dividerColor"
|
||||
app:chipStrokeWidth="1dp"
|
||||
app:iconStartPadding="8dp"
|
||||
tools:chipIcon="@drawable/ic_person_white_24dp"
|
||||
tools:text="@string/for_you" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
<item name="cardBackgroundColor">@color/card_dark_color</item>
|
||||
<item name="defaultFooterColor">@color/dark_color</item>
|
||||
<item name="dividerColor">@color/dark_color</item>
|
||||
<item name="dividerColor">@color/md_grey_800</item>
|
||||
|
||||
<item name="iconColor">@color/ate_secondary_text_dark</item>
|
||||
|
||||
|
|
Loading…
Reference in a new issue