music: update album type display

Only display album types within the artist and album detail menus.

Displaying it elsewhere cluttered the UI somewhat.
This commit is contained in:
OxygenCobalt 2022-07-19 09:44:16 -06:00
parent 30920b399a
commit 24062aa623
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
8 changed files with 14 additions and 28 deletions

View file

@ -20,7 +20,7 @@ android {
}
compileSdkVersion 32
buildToolsVersion "32.0.0"
buildToolsVersion '33.0.0'
// ExoPlayer, AndroidX, and Material Components all need Java 8 to compile.

View file

@ -326,8 +326,8 @@ data class Genre(override val rawName: String?, override val songs: List<Song>)
* or reject valid-ish dates.
*
* Date instances are immutable and their internal implementation is hidden. To instantiate one, use
* [from] or [from]. The string representation of a Date is RFC 3339, with granular position
* depending on the presence of particular tokens.
* [from]. The string representation of a Date is RFC 3339, with granular position depending on the
* presence of particular tokens.
*
* Please, **Do not use this for anything important related to time.** I cannot stress this enough.
* This class will blow up if you try to do that.
@ -389,7 +389,6 @@ class Date private constructor(private val tokens: List<Int>) : Comparable<Date>
override fun toString() = StringBuilder().appendDate().toString()
private fun StringBuilder.appendDate(): StringBuilder {
// RFC 3339 does not allow partial precision.
append(year.toFixedString(4))
append("-${(month ?: return this).toFixedString(2)}")
append("-${(day ?: return this).toFixedString(2)}")

View file

@ -534,10 +534,7 @@ open class Api29MediaStoreBackend : BaseApi29MediaStoreBackend() {
private var trackIndex = -1
override val projection: Array<String>
get() =
super.projection +
arrayOf(
MediaStore.Audio.AudioColumns.TRACK, MediaStore.Audio.AudioColumns.DATE_TAKEN)
get() = super.projection + arrayOf(MediaStore.Audio.AudioColumns.TRACK)
override fun buildAudio(context: Context, cursor: Cursor): Audio {
val audio = super.buildAudio(context, cursor)
@ -588,7 +585,6 @@ class Api30MediaStoreBackend : BaseApi29MediaStoreBackend() {
// the tag itself, which is to say that it is formatted as NN/TT tracks, where
// N is the number and T is the total. Parse the number while leaving out the
// total, as we have no use for it.
cursor.getStringOrNull(trackIndex)?.parsePositionNum()?.let { audio.track = it }
cursor.getStringOrNull(discIndex)?.parsePositionNum()?.let { audio.disc = it }

View file

@ -145,19 +145,18 @@ class SearchViewModel(application: Application) :
}
private fun List<Album>.filterAlbumsBy(value: String) =
baseFilterBy(value) { it.rawSortName?.contains(value) == true }
baseFilterBy(value) { it.rawSortName?.contains(value, ignoreCase = true) == true }
private fun List<Artist>.filterArtistsBy(value: String) =
baseFilterBy(value) { it.rawSortName?.contains(value) == true }
baseFilterBy(value) { it.rawSortName?.contains(value, ignoreCase = true) == true }
private fun List<Genre>.filterGenresBy(value: String) = baseFilterBy(value) { false }
private inline fun <T : Music> List<T>.baseFilterBy(value: String, additional: (T) -> Boolean) =
filter {
// The basic comparison is first by the *normalized* name, as that allows a
// non-unicode
// search to match with some unicode characters. If that fails, filter impls have
// fallback values, primarily around sort tags or file names.
// non-unicode search to match with some unicode characters. If that fails,
// filter impls have fallback values, primarily around sort tags or file names.
it.resolveNameNormalized(application).contains(value, ignoreCase = true) ||
additional(it)
}

View file

@ -113,7 +113,7 @@ class AboutFragment : ViewBindingFragment<FragmentAboutBinding>() {
// No app installed to open the link
requireContext().showToast(R.string.err_no_app)
}
} else {
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
// On older versions of android, opening links from an ACTION_VIEW intent might
// not work in all cases, especially when no default app was set. If that is the
// case, we will try to manually handle these cases before we try to launch the

View file

@ -82,15 +82,7 @@ private constructor(
override fun bind(item: Album, listener: MenuItemListener) {
binding.parentImage.bind(item)
binding.parentName.textSafe = item.resolveName(binding.context)
val artistName = item.artist.resolveName(binding.context)
binding.parentInfo.textSafe =
if (item.type != null) {
binding.context.getString(
R.string.fmt_two, binding.context.getString(item.type.string), artistName)
} else {
artistName
}
binding.parentInfo.textSafe = item.artist.resolveName(binding.context)
binding.root.apply {
setOnClickListener { listener.onItemClick(item) }
setOnLongClickListener { view ->

View file

@ -138,13 +138,13 @@ private fun RemoteViews.applyPlayPauseControls(
context: Context,
state: WidgetComponent.WidgetState
): RemoteViews {
// Controls are timeline elements, override the layout direction to RTL
setInt(R.id.widget_controls, "setLayoutDirection", View.LAYOUT_DIRECTION_LTR)
setOnClickPendingIntent(
R.id.widget_play_pause,
context.newBroadcastPendingIntent(PlaybackService.ACTION_PLAY_PAUSE))
// Controls are timeline elements, override the layout direction to RTL
setInt(R.id.widget_controls, "setLayoutDirection", View.LAYOUT_DIRECTION_LTR)
setImageViewResource(
R.id.widget_play_pause,
if (state.isPlaying) {

View file

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
<resources />