Update naming

Update naming on layout files & other code.
This commit is contained in:
OxygenCobalt 2020-09-27 14:36:57 -06:00
parent f866e77ee4
commit d9cf3772e6
31 changed files with 194 additions and 188 deletions

View file

@ -35,7 +35,7 @@ class MainFragment : Fragment() {
binding.lifecycleOwner = viewLifecycleOwner
binding.viewPager.adapter = PagerAdapter()
binding.mainViewPager.adapter = PagerAdapter()
val colorActive = accent.first.toColor(requireContext())
val colorInactive = getTransparentAccent(
@ -45,7 +45,7 @@ class MainFragment : Fragment() {
)
// Link the ViewPager & Tab View
TabLayoutMediator(binding.tabs, binding.viewPager) { tab, position ->
TabLayoutMediator(binding.mainTabs, binding.mainViewPager) { tab, position ->
tab.icon = ContextCompat.getDrawable(requireContext(), tabIcons[position])
// Set the icon tint to deselected if its not the default tab
@ -55,7 +55,7 @@ class MainFragment : Fragment() {
}.attach()
// Set up the selected/deselected colors
binding.tabs.addOnTabSelectedListener(
binding.mainTabs.addOnTabSelectedListener(
object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab) {

View file

@ -51,11 +51,13 @@ class AlbumDetailFragment : Fragment() {
binding.detailModel = detailModel
binding.album = detailModel.currentAlbum
binding.songRecycler.adapter = songAdapter
binding.songRecycler.applyDivider()
binding.songRecycler.setHasFixedSize(true)
binding.albumSongRecycler.apply {
adapter = songAdapter
applyDivider()
setHasFixedSize(true)
}
binding.toolbar.setNavigationOnClickListener {
binding.albumToolbar.setNavigationOnClickListener {
findNavController().navigateUp()
}
@ -76,12 +78,12 @@ class AlbumDetailFragment : Fragment() {
}
}
binding.artistName.setBackgroundResource(R.drawable.ripple)
binding.albumArtist.setBackgroundResource(R.drawable.ripple)
}
detailModel.albumSortMode.observe(viewLifecycleOwner) { mode ->
// Update the current sort icon
binding.sortButton.setImageResource(mode.iconRes)
binding.albumSortButton.setImageResource(mode.iconRes)
// Then update the sort mode of the album adapter.
songAdapter.submitList(
@ -98,11 +100,11 @@ class AlbumDetailFragment : Fragment() {
// Don't enable the sort button if there's only one song [or less]
if (detailModel.currentAlbum!!.numSongs < 2) {
binding.sortButton.imageTintList = ColorStateList.valueOf(
binding.albumSortButton.imageTintList = ColorStateList.valueOf(
R.color.inactive_color.toColor(requireContext())
)
binding.sortButton.isEnabled = false
binding.albumSortButton.isEnabled = false
}
Log.d(this::class.simpleName, "Fragment created.")

View file

@ -51,17 +51,19 @@ class ArtistDetailFragment : Fragment() {
binding.detailModel = detailModel
binding.artist = detailModel.currentArtist!!
binding.albumRecycler.adapter = albumAdapter
binding.albumRecycler.applyDivider()
binding.albumRecycler.setHasFixedSize(true)
binding.artistAlbumRecycler.apply {
adapter = albumAdapter
applyDivider()
setHasFixedSize(true)
}
binding.toolbar.setNavigationOnClickListener {
binding.artistToolbar.setNavigationOnClickListener {
findNavController().navigateUp()
}
detailModel.artistSortMode.observe(viewLifecycleOwner) { mode ->
// Update the current sort icon
binding.sortButton.setImageResource(mode.iconRes)
binding.artistSortButton.setImageResource(mode.iconRes)
// Then update the sort mode of the album adapter.
albumAdapter.submitList(
@ -78,11 +80,11 @@ class ArtistDetailFragment : Fragment() {
// Don't enable the sort button if there is only one album [Or less]
if (detailModel.currentArtist!!.numAlbums < 2) {
binding.sortButton.imageTintList = ColorStateList.valueOf(
binding.artistSortButton.imageTintList = ColorStateList.valueOf(
R.color.inactive_color.toColor(requireContext())
)
binding.sortButton.isEnabled = false
binding.artistSortButton.isEnabled = false
}
Log.d(this::class.simpleName, "Fragment created.")

View file

@ -51,17 +51,17 @@ class GenreDetailFragment : Fragment() {
binding.detailModel = detailModel
binding.genre = detailModel.currentGenre!!
binding.albumRecycler.adapter = albumAdapter
binding.albumRecycler.applyDivider()
binding.albumRecycler.setHasFixedSize(true)
binding.genreArtistRecycler.adapter = albumAdapter
binding.genreArtistRecycler.applyDivider()
binding.genreArtistRecycler.setHasFixedSize(true)
binding.toolbar.setNavigationOnClickListener {
binding.genreToolbar.setNavigationOnClickListener {
findNavController().navigateUp()
}
detailModel.genreSortMode.observe(viewLifecycleOwner) { mode ->
// Update the current sort icon
binding.sortButton.setImageResource(mode.iconRes)
binding.genreSortButton.setImageResource(mode.iconRes)
// Then update the sort mode of the album adapter.
albumAdapter.submitList(
@ -78,11 +78,11 @@ class GenreDetailFragment : Fragment() {
// Don't enable the sort button if there is only one artist [Or less]
if (detailModel.currentGenre!!.numArtists < 2) {
binding.sortButton.imageTintList = ColorStateList.valueOf(
binding.genreSortButton.imageTintList = ColorStateList.valueOf(
R.color.inactive_color.toColor(requireContext())
)
binding.sortButton.isEnabled = false
binding.genreSortButton.isEnabled = false
}
Log.d(this::class.simpleName, "Fragment created.")

View file

@ -3,7 +3,9 @@ package org.oxycblt.auxio.detail.adapters
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.ListAdapter
import org.oxycblt.auxio.databinding.ItemAlbumBinding
import org.oxycblt.auxio.databinding.ItemArtistAlbumBinding
import org.oxycblt.auxio.databinding.ItemArtistBinding
import org.oxycblt.auxio.music.Album
import org.oxycblt.auxio.recycler.BaseViewHolder
import org.oxycblt.auxio.recycler.ClickListener
@ -30,6 +32,7 @@ class DetailAlbumAdapter(
override fun onBind(model: Album) {
binding.album = model
binding.albumName.requestLayout()
}
}

View file

@ -3,8 +3,10 @@ package org.oxycblt.auxio.detail.adapters
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.ListAdapter
import org.oxycblt.auxio.databinding.ItemArtistBinding
import org.oxycblt.auxio.databinding.ItemGenreArtistBinding
import org.oxycblt.auxio.music.Artist
import org.oxycblt.auxio.music.bindArtistCounts
import org.oxycblt.auxio.recycler.BaseViewHolder
import org.oxycblt.auxio.recycler.ClickListener
import org.oxycblt.auxio.recycler.DiffCallback
@ -30,6 +32,7 @@ class DetailArtistAdapter(
override fun onBind(model: Artist) {
binding.artist = model
binding.artistName.requestLayout()
}
}

View file

@ -5,6 +5,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import org.oxycblt.auxio.databinding.ItemAlbumBinding
import org.oxycblt.auxio.music.Album
import org.oxycblt.auxio.music.bindAlbumSongs
import org.oxycblt.auxio.recycler.BaseViewHolder
import org.oxycblt.auxio.recycler.ClickListener

View file

@ -5,6 +5,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import org.oxycblt.auxio.databinding.ItemArtistBinding
import org.oxycblt.auxio.music.Artist
import org.oxycblt.auxio.music.bindArtistCounts
import org.oxycblt.auxio.recycler.BaseViewHolder
import org.oxycblt.auxio.recycler.ClickListener

View file

@ -31,7 +31,7 @@ class GenreAdapter(
override fun onBind(model: Genre) {
binding.genre = model
binding.artistName.requestLayout()
binding.genreName.requestLayout()
}
}
}

View file

@ -103,7 +103,7 @@ class LoadingFragment : Fragment(R.layout.fragment_loading) {
)
} else {
binding.let { binding ->
binding.errorText.text =
binding.loadingErrorText.text =
if (response == MusicLoaderResponse.NO_MUSIC)
getString(R.string.error_no_music)
else
@ -113,9 +113,9 @@ class LoadingFragment : Fragment(R.layout.fragment_loading) {
// depending on which error response was given, along with a retry button
binding.loadingBar.visibility = View.GONE
binding.errorText.visibility = View.VISIBLE
binding.statusIcon.visibility = View.VISIBLE
binding.retryButton.visibility = View.VISIBLE
binding.loadingErrorText.visibility = View.VISIBLE
binding.loadingErrorIcon.visibility = View.VISIBLE
binding.loadingRetryButton.visibility = View.VISIBLE
}
}
}
@ -126,11 +126,11 @@ class LoadingFragment : Fragment(R.layout.fragment_loading) {
// along with a GRANT button
binding.loadingBar.visibility = View.GONE
binding.statusIcon.visibility = View.VISIBLE
binding.grantButton.visibility = View.VISIBLE
binding.errorText.visibility = View.VISIBLE
binding.loadingErrorIcon.visibility = View.VISIBLE
binding.loadingGrantButton.visibility = View.VISIBLE
binding.loadingErrorText.visibility = View.VISIBLE
binding.errorText.text = getString(R.string.error_no_perms)
binding.loadingErrorText.text = getString(R.string.error_no_perms)
}
private fun onRetry(retry: Boolean) {
@ -149,12 +149,12 @@ class LoadingFragment : Fragment(R.layout.fragment_loading) {
}
}
// Wipe views and switch back to the plain LoadingBar
// Wipe views and switch back to the plain ProgressBar
private fun wipeViews() {
binding.loadingBar.visibility = View.VISIBLE
binding.errorText.visibility = View.GONE
binding.statusIcon.visibility = View.GONE
binding.retryButton.visibility = View.GONE
binding.grantButton.visibility = View.GONE
binding.loadingErrorText.visibility = View.GONE
binding.loadingErrorIcon.visibility = View.GONE
binding.loadingRetryButton.visibility = View.GONE
binding.loadingGrantButton.visibility = View.GONE
}
}

View file

@ -15,7 +15,7 @@ data class Song(
override var name: String,
val albumId: Long,
val track: Int,
val duration: Long
val duration: Long,
) : BaseModel() {
lateinit var album: Album
@ -35,13 +35,14 @@ data class Album(
val songs = mutableListOf<Song>()
val numSongs: Int get() = songs.size
val totalDuration: String get() {
var seconds: Long = 0
songs.forEach {
seconds += it.seconds
val totalDuration: String
get() {
var seconds: Long = 0
songs.forEach {
seconds += it.seconds
}
return seconds.toDuration()
}
return seconds.toDuration()
}
}
// Artist
@ -72,18 +73,20 @@ data class Genre(
val artists = mutableListOf<Artist>()
val numArtists: Int get() = artists.size
val numAlbums: Int get() {
var num = 0
artists.forEach {
num += it.numAlbums
val numAlbums: Int
get() {
var num = 0
artists.forEach {
num += it.numAlbums
}
return num
}
return num
}
val numSongs: Int get() {
var num = 0
artists.forEach {
num += it.numSongs
val numSongs: Int
get() {
var num = 0
artists.forEach {
num += it.numSongs
}
return num
}
return num
}
}

View file

@ -70,39 +70,23 @@ fun Long.toAlbumArtURI(): Uri {
// Convert seconds into its string duration
fun Long.toDuration(): String {
val durationString = DateUtils.formatElapsedTime(this)
var durationString = DateUtils.formatElapsedTime(this)
val durationSplit = durationString.chunked(1).toMutableList()
// Iterate through the string and remove the first zero found
// If anything else is found, exit the loop.
for (i in 0 until durationSplit.size) {
if (durationSplit[i] == "0") {
durationSplit.removeAt(i)
break
} else {
break
}
// If the duration begins with a excess zero [e.g 01:42], then cut it off.
if (durationString[0] == '0') {
durationString = durationString.slice(1 until durationString.length)
}
return durationSplit.joinToString("")
return durationString
}
// --- BINDING ADAPTERS ---
fun getAlbumSongCount(album: Album, context: Context): String {
return context.resources.getQuantityString(
R.plurals.format_song_count, album.numSongs, album.numSongs
)
}
@BindingAdapter("genreCounts")
fun TextView.bindGenreCounts(genre: Genre) {
val artists = context.resources.getQuantityString(
R.plurals.format_artist_count, genre.numArtists, genre.numArtists
)
val albums = context.resources.getQuantityString(
R.plurals.format_album_count, genre.numAlbums, genre.numAlbums
)
@ -117,6 +101,7 @@ fun TextView.bindArtistGenre(artist: Artist) {
text = artist.genres[0].name
}
// Get the artist counts
@BindingAdapter("artistCounts")
fun TextView.bindArtistCounts(artist: Artist) {
val albums = context.resources.getQuantityString(
@ -135,13 +120,18 @@ fun TextView.bindAlbumDetails(album: Album) {
text = context.getString(
R.string.format_double_info,
album.year.toString(),
getAlbumSongCount(album, context),
context.resources.getQuantityString(
R.plurals.format_song_count,
album.numSongs, album.numSongs
),
album.totalDuration
)
}
@BindingAdapter("albumSongs")
// Format the amount of songs in an album
@BindingAdapter("songCount")
fun TextView.bindAlbumSongs(album: Album) {
text = getAlbumSongCount(album, context)
text = context.resources.getQuantityString(
R.plurals.format_song_count, album.numSongs, album.numSongs
)
}

View file

@ -14,7 +14,7 @@ import org.oxycblt.auxio.music.Song
// Get the cover art for a song or album
@BindingAdapter("coverArt")
fun ImageView.getCoverArt(song: Song) {
fun ImageView.bindCoverArt(song: Song) {
val request = getDefaultRequest(context, this)
.data(song.album.coverUri)
.error(R.drawable.ic_song)
@ -24,7 +24,7 @@ fun ImageView.getCoverArt(song: Song) {
}
@BindingAdapter("coverArt")
fun ImageView.getCoverArt(album: Album) {
fun ImageView.bindCoverArt(album: Album) {
val request = getDefaultRequest(context, this)
.data(album.coverUri)
.error(R.drawable.ic_album)
@ -35,7 +35,7 @@ fun ImageView.getCoverArt(album: Album) {
// Get the artist image
@BindingAdapter("artistImage")
fun ImageView.getArtistImage(artist: Artist) {
fun ImageView.bindArtistImage(artist: Artist) {
val request: ImageRequest
// If there are more than one albums, then create a mosaic of them.
@ -72,7 +72,7 @@ fun ImageView.getArtistImage(artist: Artist) {
}
@BindingAdapter("genreImage")
fun ImageView.getGenreImage(genre: Genre) {
fun ImageView.bindGenreImage(genre: Genre) {
val request: ImageRequest
if (genre.numArtists >= 4) {

View file

@ -144,7 +144,7 @@ class MusicSorter(
)
for (artist in unknownArtists) {
artist.givenGenres.add(unknownGenre)
artist.genres.add(unknownGenre)
unknownGenre.artists.add(artist)
}
genres.add(unknownGenre)

View file

@ -5,7 +5,7 @@
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorPrimary">
<path
android:fillColor="@android:color/white"
android:pathData="M7,14c-1.66,0 -3,1.34 -3,3 0,1.31 -1.16,2 -2,2 0.92,1.22 2.49,2 4,2 2.21,0 4,-1.79 4,-4 0,-1.66 -1.34,-3 -3,-3zM20.71,4.63l-1.34,-1.34c-0.39,-0.39 -1.02,-0.39 -1.41,0L9,12.25 11.75,15l8.96,-8.96c0.39,-0.39 0.39,-1.02 0,-1.41z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M7,14c-1.66,0 -3,1.34 -3,3 0,1.31 -1.16,2 -2,2 0.92,1.22 2.49,2 4,2 2.21,0 4,-1.79 4,-4 0,-1.66 -1.34,-3 -3,-3zM20.71,4.63l-1.34,-1.34c-0.39,-0.39 -1.02,-0.39 -1.41,0L9,12.25 11.75,15l8.96,-8.96c0.39,-0.39 0.39,-1.02 0,-1.41z" />
</vector>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.fragment.app.FragmentContainerView android:id="@+id/nav_host"
<androidx.fragment.app.FragmentContainerView android:id="@+id/main_nav_host"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="androidx.navigation.fragment.NavHostFragment"

View file

@ -20,7 +20,7 @@
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:id="@+id/album_toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="?android:attr/windowBackground"
@ -39,7 +39,7 @@
android:animateLayoutChanges="true">
<ImageView
android:id="@+id/cover"
android:id="@+id/album_cover"
android:layout_width="@dimen/cover_size_huge"
android:layout_height="@dimen/cover_size_huge"
android:layout_marginTop="@dimen/margin_medium"
@ -67,11 +67,11 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cover"
app:layout_constraintTop_toBottomOf="@+id/album_cover"
tools:text="Album Name" />
<TextView
android:id="@+id/artist_name"
android:id="@+id/album_artist"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_medium"
@ -86,7 +86,7 @@
tools:text="Artist Name" />
<TextView
android:id="@+id/album_other_details"
android:id="@+id/album_song_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_medium"
@ -95,11 +95,11 @@
android:textColor="?android:attr/textColorSecondary"
app:albumDetails="@{album}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/artist_name"
tools:text="2020" />
app:layout_constraintTop_toBottomOf="@+id/album_artist"
tools:text="2020 / 10 Songs / 16:16" />
<TextView
android:id="@+id/header_title"
android:id="@+id/album_song_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/padding_medium"
@ -112,10 +112,10 @@
android:text="@string/label_songs"
android:textAppearance="@style/TextAppearance.MaterialComponents.Overline"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="@+id/album_other_details" />
app:layout_constraintTop_toBottomOf="@+id/album_song_count" />
<ImageButton
android:id="@+id/sort_button"
android:id="@+id/album_sort_button"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="@dimen/margin_medium"
@ -127,12 +127,12 @@
android:paddingBottom="@dimen/padding_small"
android:onClick="@{() -> detailModel.incrementAlbumSortMode()}"
tools:src="@drawable/ic_sort_numeric_down"
app:layout_constraintBottom_toTopOf="@+id/song_recycler"
app:layout_constraintBottom_toTopOf="@+id/album_recycler"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/album_other_details" />
app:layout_constraintTop_toBottomOf="@+id/album_song_count" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/song_recycler"
android:id="@+id/album_song_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -140,7 +140,7 @@
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/header_title"
app:layout_constraintTop_toBottomOf="@+id/album_song_header"
tools:itemCount="4"
tools:listitem="@layout/item_album_song" />

View file

@ -20,7 +20,7 @@
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:id="@+id/artist_toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="?android:attr/windowBackground"
@ -71,7 +71,7 @@
tools:text="Artist Name" />
<TextView
android:id="@+id/genre_counts"
android:id="@+id/artist_genre"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
@ -83,7 +83,7 @@
tools:text="Genre Name" />
<TextView
android:id="@+id/song_count"
android:id="@+id/artist_counts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
@ -91,11 +91,11 @@
android:layout_marginStart="@dimen/margin_medium"
app:artistCounts="@{artist}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/genre_counts"
app:layout_constraintTop_toBottomOf="@+id/artist_genre"
tools:text="2 Albums, 20 Songs" />
<TextView
android:id="@+id/header_title"
android:id="@+id/artist_album_header"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/margin_medium"
@ -109,10 +109,10 @@
android:textAppearance="@style/TextAppearance.MaterialComponents.Overline"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/song_count" />
app:layout_constraintTop_toBottomOf="@+id/artist_counts" />
<ImageButton
android:id="@+id/sort_button"
android:id="@+id/artist_sort_button"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="@dimen/margin_medium"
@ -124,12 +124,12 @@
android:paddingBottom="@dimen/padding_small"
android:onClick="@{() -> detailModel.incrementArtistSortMode()}"
tools:src="@drawable/ic_sort_numeric_down"
app:layout_constraintBottom_toTopOf="@+id/album_recycler"
app:layout_constraintBottom_toTopOf="@+id/artist_album_recycler"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/song_count" />
app:layout_constraintTop_toBottomOf="@+id/artist_counts" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/album_recycler"
android:id="@+id/artist_album_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -137,9 +137,9 @@
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/header_title"
app:layout_constraintTop_toBottomOf="@+id/artist_album_header"
tools:itemCount="4"
tools:listitem="@layout/item_artist_album" />
tools:listitem="@layout/item_album" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="genre"
type="org.oxycblt.auxio.music.Genre" />
@ -19,7 +20,7 @@
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:id="@+id/genre_toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="?android:attr/windowBackground"
@ -39,7 +40,7 @@
android:orientation="vertical">
<ImageView
android:id="@+id/artist_image"
android:id="@+id/genre_image"
android:layout_width="@dimen/cover_size_huge"
android:layout_height="@dimen/cover_size_huge"
android:layout_marginTop="@dimen/margin_medium"
@ -51,7 +52,7 @@
tools:src="@drawable/ic_genre" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/artist_name"
android:id="@+id/genre_name"
style="@style/DetailHeader"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -66,7 +67,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/artist_image"
app:layout_constraintTop_toBottomOf="@+id/genre_image"
tools:text="Genre Name" />
<TextView
@ -78,11 +79,11 @@
android:layout_marginStart="@dimen/margin_medium"
app:genreCounts="@{genre}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/artist_name"
tools:text="2 Artists, 4 Ablums" />
app:layout_constraintTop_toBottomOf="@+id/genre_name"
tools:text="2 Artists, 4 Albums" />
<TextView
android:id="@+id/song_count"
android:id="@+id/genre_song_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
@ -94,7 +95,7 @@
tools:text="80 Songs" />
<TextView
android:id="@+id/header_title"
android:id="@+id/genre_artist_header"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/margin_medium"
@ -108,10 +109,10 @@
android:textAppearance="@style/TextAppearance.MaterialComponents.Overline"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/song_count" />
app:layout_constraintTop_toBottomOf="@+id/genre_song_count" />
<ImageButton
android:id="@+id/sort_button"
android:id="@+id/genre_sort_button"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="@dimen/margin_medium"
@ -122,13 +123,13 @@
android:paddingEnd="@dimen/margin_medium"
android:paddingBottom="@dimen/padding_small"
android:onClick="@{() -> detailModel.incrementGenreSortMode()}"
tools:src="@drawable/ic_sort_numeric_down"
app:layout_constraintBottom_toTopOf="@+id/album_recycler"
tools:src="@drawable/ic_sort_alpha_down"
app:layout_constraintBottom_toTopOf="@+id/genre_artist_recycler"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/song_count" />
app:layout_constraintTop_toBottomOf="@+id/genre_song_count" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/album_recycler"
android:id="@+id/genre_artist_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -136,9 +137,9 @@
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/header_title"
app:layout_constraintTop_toBottomOf="@+id/genre_artist_header"
tools:itemCount="4"
tools:listitem="@layout/item_genre_artist" />
tools:listitem="@layout/item_artist" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -10,7 +10,7 @@
android:animateLayoutChanges="true">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:id="@+id/library_toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="?android:attr/windowBackground"

View file

@ -22,7 +22,7 @@
android:indeterminateTint="?attr/colorPrimary"
android:indeterminateTintMode="src_in"
android:paddingBottom="@dimen/padding_tiny"
app:layout_constraintBottom_toTopOf="@+id/status_icon"
app:layout_constraintBottom_toTopOf="@+id/loading_error_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
@ -30,7 +30,7 @@
app:layout_constraintVertical_chainStyle="packed" />
<ImageView
android:id="@+id/status_icon"
android:id="@+id/loading_error_icon"
android:layout_width="@dimen/status_icon_size"
android:layout_height="@dimen/status_icon_size"
android:indeterminateTint="?attr/colorPrimary"
@ -38,29 +38,29 @@
android:src="@drawable/ic_error"
android:visibility="gone"
android:contentDescription="@string/description_error"
app:layout_constraintBottom_toTopOf="@+id/error_text"
app:layout_constraintBottom_toTopOf="@+id/loading_error_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loading_bar"
app:srcCompat="@drawable/ic_error" />
<TextView
android:id="@+id/error_text"
android:id="@+id/loading_error_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary"
android:layout_marginTop="@dimen/margin_small"
app:layout_constraintBottom_toTopOf="@+id/retry_button"
app:layout_constraintBottom_toTopOf="@+id/loading_retry_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/status_icon"
app:layout_constraintTop_toBottomOf="@+id/loading_error_icon"
tools:text="Some kind of error." />
<Button
android:id="@+id/retry_button"
android:id="@+id/loading_retry_button"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -73,13 +73,13 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/error_text"
app:layout_constraintBottom_toTopOf="@+id/grant_button"
app:layout_constraintTop_toBottomOf="@+id/loading_error_text"
app:layout_constraintBottom_toTopOf="@+id/loading_grant_button"
app:layout_constraintVertical_bias="0.673"
tools:visibility="visible" />
<Button
android:id="@+id/grant_button"
android:id="@+id/loading_grant_button"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -91,7 +91,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/retry_button"
app:layout_constraintTop_toBottomOf="@+id/loading_retry_button"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -10,13 +10,13 @@
android:orientation="vertical">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:id="@+id/main_view_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:id="@+id/main_tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/tab_menu_size"
android:layout_gravity="bottom"

View file

@ -10,7 +10,7 @@
android:animateLayoutChanges="true">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:id="@+id/song_toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="?android:attr/windowBackground"

View file

@ -19,7 +19,7 @@
android:padding="@dimen/padding_medium">
<ImageView
android:id="@+id/cover"
android:id="@+id/album_cover"
android:layout_width="@dimen/cover_size_normal"
android:layout_height="@dimen/cover_size_normal"
android:contentDescription="@{@string/description_album_cover(album.name)}"
@ -39,15 +39,15 @@
android:textColor="?android:attr/textColorPrimary"
android:ellipsize="end"
android:maxLines="1"
app:layout_constraintBottom_toTopOf="@+id/album_other_details"
app:layout_constraintBottom_toTopOf="@+id/album_song_count"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cover"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Album Name" />
<TextView
android:id="@+id/album_other_details"
android:id="@+id/album_song_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_medium"
@ -55,9 +55,8 @@
android:textColor="?android:attr/textColorSecondary"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/cover"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toBottomOf="@+id/album_name"
app:songCount="@{album}"
tools:text="10 Songs" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -19,7 +19,7 @@
android:padding="@dimen/padding_medium">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/track_number"
android:id="@+id/song_track"
android:layout_width="@dimen/track_number_width"
android:layout_height="wrap_content"
android:text="@{String.valueOf(song.track)}"
@ -50,15 +50,15 @@
android:text="@{song.name}"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintBottom_toTopOf="@+id/duration"
app:layout_constraintBottom_toTopOf="@+id/song_duration"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/track_number"
app:layout_constraintStart_toEndOf="@+id/song_track"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Song Name" />
<TextView
android:id="@+id/duration"
android:id="@+id/song_duration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_medium"
@ -70,7 +70,7 @@
android:text="@{song.formattedDuration}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/track_number"
app:layout_constraintStart_toEndOf="@+id/song_track"
app:layout_constraintTop_toBottomOf="@+id/song_name"
tools:text="16:16" />

View file

@ -39,7 +39,7 @@
android:layout_marginStart="@dimen/margin_medium"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintBottom_toTopOf="@+id/album_song_count"
app:layout_constraintBottom_toTopOf="@+id/artist_details"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/artist_image"
app:layout_constraintTop_toTopOf="parent"
@ -47,7 +47,7 @@
tools:text="Artist Name" />
<TextView
android:id="@+id/album_song_count"
android:id="@+id/artist_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"

View file

@ -19,9 +19,9 @@
android:padding="@dimen/padding_medium">
<ImageView
android:id="@+id/cover"
android:layout_width="@dimen/cover_size_normal"
android:layout_height="@dimen/cover_size_normal"
android:id="@+id/album_cover"
android:layout_width="@dimen/cover_size_large"
android:layout_height="@dimen/cover_size_large"
android:contentDescription="@{@string/description_album_cover(album.name)}"
app:coverArt="@{album}"
app:layout_constraintBottom_toBottomOf="parent"
@ -39,25 +39,25 @@
android:textColor="?android:attr/textColorPrimary"
android:ellipsize="end"
android:maxLines="1"
app:layout_constraintBottom_toTopOf="@+id/album_other_details"
app:layout_constraintBottom_toTopOf="@+id/album_year"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cover"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Album Name" />
<TextView
android:id="@+id/album_other_details"
android:id="@+id/album_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_medium"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/cover"
app:layout_constraintTop_toBottomOf="@+id/album_name"
android:text="@{String.valueOf(album.year)}"
tools:text="2020" />
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toBottomOf="@+id/album_name"
tools:text="10 Songs" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -19,7 +19,7 @@
android:padding="@dimen/padding_medium">
<ImageView
android:id="@+id/artist_image"
android:id="@+id/genre_image"
android:layout_width="@dimen/cover_size_normal"
android:layout_height="@dimen/cover_size_normal"
app:genreImage="@{genre}"
@ -30,7 +30,7 @@
tools:src="@drawable/ic_genre" />
<TextView
android:id="@+id/artist_name"
android:id="@+id/genre_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
@ -39,15 +39,15 @@
android:layout_marginStart="@dimen/margin_medium"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintBottom_toTopOf="@+id/album_song_count"
app:layout_constraintBottom_toTopOf="@+id/genre_count"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/artist_image"
app:layout_constraintStart_toEndOf="@+id/genre_image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Genre Name" />
<TextView
android:id="@+id/album_song_count"
android:id="@+id/genre_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
@ -55,8 +55,8 @@
android:textColor="?android:attr/textColorSecondary"
app:genreCounts="@{genre}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/artist_image"
app:layout_constraintTop_toBottomOf="@+id/artist_name"
app:layout_constraintStart_toEndOf="@+id/genre_image"
app:layout_constraintTop_toBottomOf="@+id/genre_name"
tools:text="2 Artists, 4 Albums" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -20,8 +20,8 @@
<ImageView
android:id="@+id/artist_image"
android:layout_width="@dimen/cover_size_normal"
android:layout_height="@dimen/cover_size_normal"
android:layout_width="@dimen/cover_size_large"
android:layout_height="@dimen/cover_size_large"
android:contentDescription="@{@string/description_artist_image(artist.name)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -39,7 +39,7 @@
android:layout_marginStart="@dimen/margin_medium"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintBottom_toTopOf="@+id/album_song_count"
app:layout_constraintBottom_toTopOf="@+id/artist_counts"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/artist_image"
app:layout_constraintTop_toTopOf="parent"
@ -47,17 +47,17 @@
tools:text="Artist Name" />
<TextView
android:id="@+id/album_song_count"
android:id="@+id/artist_counts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:layout_marginStart="@dimen/margin_medium"
android:textColor="?android:attr/textColorSecondary"
android:text="@{@plurals/format_album_count(artist.numAlbums, artist.numAlbums)}"
app:artistCounts="@{artist}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/artist_image"
app:layout_constraintTop_toBottomOf="@+id/artist_name"
tools:text="2 Albums" />
tools:text="2 Albums, 20 Songs" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -19,7 +19,7 @@
android:padding="@dimen/padding_medium">
<ImageView
android:id="@+id/cover"
android:id="@+id/album_cover"
android:layout_width="@dimen/cover_size_compact"
android:layout_height="@dimen/cover_size_compact"
android:contentDescription="@{@string/description_album_cover(song.name)}"
@ -43,7 +43,7 @@
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintBottom_toTopOf="@+id/song_info"
app:layout_constraintEnd_toStartOf="@+id/duration"
app:layout_constraintStart_toEndOf="@+id/cover"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Song Name" />
@ -61,7 +61,7 @@
android:text="@{@string/format_info(song.album.artist.name, song.album.name)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/duration"
app:layout_constraintStart_toEndOf="@+id/cover"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toBottomOf="@+id/song_name"
tools:text="Artist / Album" />

View file

@ -83,7 +83,8 @@
<fragment
android:id="@+id/genreDetailFragment"
android:name="org.oxycblt.auxio.detail.GenreDetailFragment"
android:label="GenreDetailFragment" >
android:label="GenreDetailFragment"
tools:layout="@layout/fragment_genre_detail">
<action
android:id="@+id/action_show_artist"
app:enterAnim="@anim/fragment_fade_enter"