Update styling/colors
Update the styling and add some colors that will be used as the base theme set in the future.
This commit is contained in:
@@ -11,7 +11,7 @@ import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentLibraryBinding
|
||||
import org.oxycblt.auxio.recycler.AlbumDataAdapter
|
||||
import org.oxycblt.auxio.library.recycler.AlbumDataAdapter
|
||||
|
||||
class LibraryFragment : Fragment() {
|
||||
|
||||
|
||||
+2
-22
@@ -1,12 +1,12 @@
|
||||
package org.oxycblt.auxio.recycler
|
||||
package org.oxycblt.auxio.library.recycler
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.oxycblt.auxio.databinding.AlbumItemBinding
|
||||
import org.oxycblt.auxio.music.models.Album
|
||||
import org.oxycblt.auxio.recycler.AlbumViewHolder
|
||||
|
||||
class AlbumDataAdapter : ListAdapter<Album, AlbumViewHolder>(DiffCallback) {
|
||||
|
||||
@@ -38,23 +38,3 @@ class AlbumDataAdapter : ListAdapter<Album, AlbumViewHolder>(DiffCallback) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AlbumViewHolder(
|
||||
private var binding: AlbumItemBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
// Bind the view w/new data
|
||||
fun bind(album: Album) {
|
||||
binding.album = album
|
||||
|
||||
if (album.cover == null) {
|
||||
// If there is no cover, clear the ImageView so that the previous
|
||||
// View's cover doesnt stick around.
|
||||
binding.cover.setImageResource(android.R.color.transparent)
|
||||
} else {
|
||||
binding.cover.setImageBitmap(album.cover)
|
||||
}
|
||||
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.oxycblt.auxio.recycler
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.oxycblt.auxio.databinding.AlbumItemBinding
|
||||
import org.oxycblt.auxio.music.models.Album
|
||||
|
||||
// Generic ViewHolder for an album
|
||||
class AlbumViewHolder(
|
||||
private var binding: AlbumItemBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
// Bind the view w/new data
|
||||
fun bind(album: Album) {
|
||||
binding.album = album
|
||||
|
||||
if (album.cover == null) {
|
||||
// If there is no cover, clear the ImageView so that the previous
|
||||
// View's cover doesnt stick around.
|
||||
binding.cover.setImageResource(android.R.color.transparent)
|
||||
} else {
|
||||
binding.cover.setImageBitmap(album.cover)
|
||||
}
|
||||
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user