musikr: decouple releasetype from auxio
This commit is contained in:
@@ -116,7 +116,7 @@ class AlbumDetailFragment : DetailFragment<Album, Song>() {
|
||||
binding.detailToolbarTitle.text = name
|
||||
binding.detailCover.bind(album)
|
||||
// The type text depends on the release type (Album, EP, Single, etc.)
|
||||
binding.detailType.text = getString(album.releaseType.stringRes)
|
||||
binding.detailType.text = album.releaseType.resolve(context)
|
||||
binding.detailName.text = name
|
||||
// Artist name maps to the subhead text
|
||||
binding.detailSubhead.apply {
|
||||
|
||||
@@ -113,7 +113,7 @@ class AlbumMenuDialogFragment : MenuDialogFragment<Menu.ForAlbum>() {
|
||||
override fun updateMenu(binding: DialogMenuBinding, menu: Menu.ForAlbum) {
|
||||
val context = requireContext()
|
||||
binding.menuCover.bind(menu.album)
|
||||
binding.menuType.text = getString(menu.album.releaseType.stringRes)
|
||||
binding.menuType.text = menu.album.releaseType.resolve(context)
|
||||
binding.menuName.text = menu.album.name.resolve(context)
|
||||
binding.menuInfo.text = menu.album.artists.resolveNames(context)
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ import org.oxycblt.musikr.tag.Date
|
||||
import org.oxycblt.musikr.tag.Disc
|
||||
import org.oxycblt.musikr.tag.Name
|
||||
import org.oxycblt.musikr.tag.Placeholder
|
||||
import org.oxycblt.musikr.tag.ReleaseType
|
||||
import org.oxycblt.musikr.tag.ReleaseType.Refinement
|
||||
import timber.log.Timber
|
||||
|
||||
fun Name.resolve(context: Context) =
|
||||
@@ -118,3 +120,35 @@ fun Date.Range.resolve(context: Context) =
|
||||
} else {
|
||||
min.resolve(context)
|
||||
}
|
||||
|
||||
fun ReleaseType.resolve(context: Context) =
|
||||
when (this) {
|
||||
is ReleaseType.Album ->
|
||||
when (refinement) {
|
||||
null -> context.getString(R.string.lbl_album)
|
||||
Refinement.LIVE -> context.getString(R.string.lbl_album_live)
|
||||
Refinement.REMIX -> context.getString(R.string.lbl_album_remix)
|
||||
}
|
||||
is ReleaseType.EP ->
|
||||
when (refinement) {
|
||||
null -> context.getString(R.string.lbl_ep)
|
||||
Refinement.LIVE -> context.getString(R.string.lbl_ep_live)
|
||||
Refinement.REMIX -> context.getString(R.string.lbl_ep_remix)
|
||||
}
|
||||
is ReleaseType.Single ->
|
||||
when (refinement) {
|
||||
null -> context.getString(R.string.lbl_single)
|
||||
Refinement.LIVE -> context.getString(R.string.lbl_single_live)
|
||||
Refinement.REMIX -> context.getString(R.string.lbl_single_remix)
|
||||
}
|
||||
is ReleaseType.Compilation ->
|
||||
when (refinement) {
|
||||
null -> context.getString(R.string.lbl_compilation)
|
||||
Refinement.LIVE -> context.getString(R.string.lbl_compilation_live)
|
||||
Refinement.REMIX -> context.getString(R.string.lbl_compilation_remix)
|
||||
}
|
||||
is ReleaseType.Soundtrack -> context.getString(R.string.lbl_soundtrack)
|
||||
is ReleaseType.Mix -> context.getString(R.string.lbl_mix)
|
||||
is ReleaseType.Mixtape -> context.getString(R.string.lbl_mixtape)
|
||||
is ReleaseType.Demo -> context.getString(R.string.lbl_demo)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user