Fix font not loading in Android 5
This commit is contained in:
parent
29e9008980
commit
8303c376ca
5 changed files with 24 additions and 34 deletions
|
@ -4,6 +4,7 @@ import android.util.DisplayMetrics
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import androidx.annotation.IntDef
|
import androidx.annotation.IntDef
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.appcompat.widget.AppCompatTextView
|
||||||
import androidx.recyclerview.widget.*
|
import androidx.recyclerview.widget.*
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.album.AlbumFullWidthAdapter
|
import code.name.monkey.retromusic.adapter.album.AlbumFullWidthAdapter
|
||||||
|
@ -34,9 +35,7 @@ class HomeAdapter(
|
||||||
else -> {
|
else -> {
|
||||||
AlbumViewHolder(
|
AlbumViewHolder(
|
||||||
LayoutInflater.from(activity).inflate(
|
LayoutInflater.from(activity).inflate(
|
||||||
R.layout.metal_section_recycler_view,
|
R.layout.metal_section_recycler_view, parent, false
|
||||||
parent,
|
|
||||||
false
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -46,7 +45,7 @@ class HomeAdapter(
|
||||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||||
println("ViewType ${getItemViewType(position)}")
|
println("ViewType ${getItemViewType(position)}")
|
||||||
when (getItemViewType(position)) {
|
when (getItemViewType(position)) {
|
||||||
RECENT_ALBUMS -> {
|
RECENT_ALBUMS -> {
|
||||||
val viewHolder = holder as AlbumViewHolder
|
val viewHolder = holder as AlbumViewHolder
|
||||||
viewHolder.bindView(
|
viewHolder.bindView(
|
||||||
list[position].arrayList.toAlbums(),
|
list[position].arrayList.toAlbums(),
|
||||||
|
@ -54,7 +53,7 @@ class HomeAdapter(
|
||||||
R.string.recent_added_albums
|
R.string.recent_added_albums
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
TOP_ALBUMS -> {
|
TOP_ALBUMS -> {
|
||||||
val viewHolder = holder as AlbumViewHolder
|
val viewHolder = holder as AlbumViewHolder
|
||||||
viewHolder.bindView(
|
viewHolder.bindView(
|
||||||
list[position].arrayList.toAlbums(),
|
list[position].arrayList.toAlbums(),
|
||||||
|
@ -70,7 +69,7 @@ class HomeAdapter(
|
||||||
R.string.recent_added_artists
|
R.string.recent_added_artists
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
TOP_ARTISTS -> {
|
TOP_ARTISTS -> {
|
||||||
val viewHolder = holder as ArtistViewHolder
|
val viewHolder = holder as ArtistViewHolder
|
||||||
|
|
||||||
viewHolder.bindView(
|
viewHolder.bindView(
|
||||||
|
@ -79,7 +78,7 @@ class HomeAdapter(
|
||||||
R.string.most_played_artists
|
R.string.most_played_artists
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
PLAYLISTS -> {
|
PLAYLISTS -> {
|
||||||
val viewHolder = holder as PlaylistViewHolder
|
val viewHolder = holder as PlaylistViewHolder
|
||||||
viewHolder.bindView(
|
viewHolder.bindView(
|
||||||
list[position].arrayList.toPlaylist(),
|
list[position].arrayList.toPlaylist(),
|
||||||
|
@ -135,10 +134,7 @@ class HomeAdapter(
|
||||||
recyclerView.apply {
|
recyclerView.apply {
|
||||||
show()
|
show()
|
||||||
layoutManager = GridLayoutManager(
|
layoutManager = GridLayoutManager(
|
||||||
activity,
|
activity, 1, GridLayoutManager.HORIZONTAL, false
|
||||||
1,
|
|
||||||
GridLayoutManager.HORIZONTAL,
|
|
||||||
false
|
|
||||||
)
|
)
|
||||||
val artistAdapter = ArtistAdapter(
|
val artistAdapter = ArtistAdapter(
|
||||||
activity,
|
activity,
|
||||||
|
@ -164,17 +160,10 @@ class HomeAdapter(
|
||||||
recyclerView.apply {
|
recyclerView.apply {
|
||||||
show()
|
show()
|
||||||
val songAdapter = SongAdapter(
|
val songAdapter = SongAdapter(
|
||||||
activity,
|
activity, songs, R.layout.item_album_card, false, null
|
||||||
songs,
|
|
||||||
R.layout.item_album_card,
|
|
||||||
false,
|
|
||||||
null
|
|
||||||
)
|
)
|
||||||
layoutManager = GridLayoutManager(
|
layoutManager = GridLayoutManager(
|
||||||
activity,
|
activity, 1, GridLayoutManager.HORIZONTAL, false
|
||||||
1,
|
|
||||||
GridLayoutManager.HORIZONTAL,
|
|
||||||
false
|
|
||||||
)
|
)
|
||||||
adapter = songAdapter
|
adapter = songAdapter
|
||||||
|
|
||||||
|
@ -190,7 +179,7 @@ class HomeAdapter(
|
||||||
open inner class AbsHomeViewItem(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
open inner class AbsHomeViewItem(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
val recyclerView: RecyclerView = itemView.findViewById(R.id.recyclerView)
|
val recyclerView: RecyclerView = itemView.findViewById(R.id.recyclerView)
|
||||||
val titleContainer: View = itemView.findViewById(R.id.titleContainer)
|
val titleContainer: View = itemView.findViewById(R.id.titleContainer)
|
||||||
val title: MaterialTextView = itemView.findViewById(R.id.title)
|
val title: AppCompatTextView = itemView.findViewById(R.id.title)
|
||||||
val text: MaterialTextView = itemView.findViewById(R.id.text)
|
val text: MaterialTextView = itemView.findViewById(R.id.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<shape
|
<shape
|
||||||
android:dither="true"
|
android:dither="true"
|
||||||
android:shape="ring"
|
android:shape="ring"
|
||||||
android:thickness="4dp"
|
android:thickness="3dp"
|
||||||
android:type="sweep"
|
android:type="sweep"
|
||||||
android:useLevel="false">
|
android:useLevel="false">
|
||||||
<solid android:color="?colorOnSecondary" />
|
<solid android:color="?colorOnSecondary" />
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
<item android:id="@android:id/progress">
|
<item android:id="@android:id/progress">
|
||||||
<shape
|
<shape
|
||||||
android:shape="ring"
|
android:shape="ring"
|
||||||
android:thickness="4dp"
|
android:thickness="3dp"
|
||||||
android:type="sweep"
|
android:type="sweep"
|
||||||
android:useLevel="true">
|
android:useLevel="true">
|
||||||
<solid android:color="?colorAccent" />
|
<solid android:color="?colorAccent" />
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<font
|
<font
|
||||||
android:font="@font/circular_std_book"
|
app:font="@font/circular_std_book"
|
||||||
android:fontStyle="normal"
|
app:fontStyle="normal"
|
||||||
android:fontWeight="400" />
|
app:fontWeight="400" />
|
||||||
<font
|
<font
|
||||||
android:font="@font/circular_std_medium"
|
app:font="@font/circular_std_medium"
|
||||||
android:fontStyle="normal"
|
app:fontStyle="normal"
|
||||||
android:fontWeight="600" />
|
app:fontWeight="600" />
|
||||||
|
|
||||||
<font
|
<font
|
||||||
android:font="@font/circular_std_black"
|
app:font="@font/circular_std_black"
|
||||||
android:fontWeight="900" />
|
app:fontWeight="900" />
|
||||||
|
|
||||||
</font-family>
|
</font-family>
|
|
@ -39,10 +39,10 @@
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/text"
|
android:id="@+id/text"
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="@style/TextViewCaption"
|
android:textAppearance="@style/TextViewCaption"
|
||||||
|
android:visibility="gone"
|
||||||
tools:text="@tools:sample/full_names" />
|
tools:text="@tools:sample/full_names" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
app:behavior_hideable="false"
|
app:behavior_hideable="false"
|
||||||
app:behavior_peekHeight="0dp"
|
app:behavior_peekHeight="0dp"
|
||||||
app:cardBackgroundColor="?colorSecondary"
|
app:cardBackgroundColor="?colorSecondary"
|
||||||
|
app:cardCornerRadius="0dp"
|
||||||
app:cardUseCompatPadding="false"
|
app:cardUseCompatPadding="false"
|
||||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
||||||
app:strokeWidth="0dp">
|
app:strokeWidth="0dp">
|
||||||
|
@ -54,12 +55,12 @@
|
||||||
android:elevation="0dp"
|
android:elevation="0dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:itemBackground="@drawable/bottom_navigation_item_background"
|
app:itemBackground="@drawable/bottom_navigation_item_background"
|
||||||
|
app:itemHorizontalTranslationEnabled="false"
|
||||||
app:itemIconTint="@drawable/bottom_navigation_item_colors"
|
app:itemIconTint="@drawable/bottom_navigation_item_colors"
|
||||||
app:itemTextAppearanceActive="@style/BottomSheetItemTextAppearanceActive"
|
app:itemTextAppearanceActive="@style/BottomSheetItemTextAppearanceActive"
|
||||||
app:itemTextAppearanceInactive="@style/BottomSheetItemTextAppearanceInactive"
|
app:itemTextAppearanceInactive="@style/BottomSheetItemTextAppearanceInactive"
|
||||||
app:itemTextColor="@drawable/bottom_navigation_item_colors"
|
app:itemTextColor="@drawable/bottom_navigation_item_colors"
|
||||||
app:labelVisibilityMode="labeled"
|
app:labelVisibilityMode="labeled"
|
||||||
app:itemHorizontalTranslationEnabled="false"
|
|
||||||
app:menu="@menu/bottom_navigation_main"
|
app:menu="@menu/bottom_navigation_main"
|
||||||
tools:layout_height="56dp" />
|
tools:layout_height="56dp" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue