ui: revert list item changes

Revert the removal of the song/artist values from list items for now.

The current plan of removing extraneous values from songs and albums
only works if I add multi-select and a dedicated menu button, but that
is still in the air, and in general I want feedback before I go ahead.
Aside from reverting the previous changes, this actually standardizes
all item descriptions under a single bullet point formatting system,
instead of the mix of commas and bullet points that existed beforehand.
This commit is contained in:
OxygenCobalt 2022-02-28 19:24:18 -07:00
parent a408cc629d
commit dbe0bd1bb3
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
11 changed files with 37 additions and 36 deletions

View file

@ -2,6 +2,9 @@
## dev [v2.2.2 or 2.3.0]
#### What's New
- New spanish translations and metadata [courtesy of n-berenice]
#### What's Improved
- Rounded images are more nuanced
- Shuffle and Repeat mode buttons now have more contrast when they are turned on

View file

@ -42,6 +42,7 @@ import org.oxycblt.auxio.util.systemBarInsetsCompat
* The single [AppCompatActivity] for Auxio.
* TODO: Add a new view for crashes with a stack trace
* TODO: Custom language support
* TODO: Rework menus [perhaps add multi-select]
*/
class MainActivity : AppCompatActivity() {
private val playbackModel: PlaybackViewModel by viewModels()
@ -81,7 +82,6 @@ class MainActivity : AppCompatActivity() {
if (action == Intent.ACTION_VIEW && !isConsumed) {
// Mark the intent as used so this does not fire again
intent.putExtra(KEY_INTENT_USED, true)
intent.data?.let { fileUri ->
playbackModel.playWithUri(fileUri, this)
}

View file

@ -39,7 +39,9 @@ class RoundableImageView @JvmOverloads constructor(
// dimensions of the image, which will result in inconsistent corners across different
// album covers unless we resize all covers to be the same size. clipToOutline is both
// cheaper and more elegant.
val settingsManager = SettingsManager.getInstance()
clipToOutline = settingsManager.roundCovers
if (!isInEditMode) {
val settingsManager = SettingsManager.getInstance()
clipToOutline = settingsManager.roundCovers
}
}
}

View file

@ -38,7 +38,6 @@ class DetailAppBarLayout @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
(layoutParams as CoordinatorLayout.LayoutParams).behavior = Behavior(context)
}

View file

@ -58,7 +58,7 @@ sealed class MusicParent : Music() {
}
/**
* The data object for a song. Inherits [Item].
* The data object for a song.
*/
data class Song(
override val name: String,
@ -147,7 +147,7 @@ data class Song(
}
/**
* The data object for an album. Inherits [MusicParent].
* The data object for an album.
*/
data class Album(
override val name: String,
@ -220,7 +220,7 @@ data class Artist(
}
/**
* The data object for a genre. Inherits [MusicParent]
* The data object for a genre.
*/
data class Genre(
override val name: String,

View file

@ -8,7 +8,6 @@ import androidx.core.database.getStringOrNull
import org.oxycblt.auxio.R
import org.oxycblt.auxio.excluded.ExcludedDatabase
import org.oxycblt.auxio.util.logD
import org.oxycblt.auxio.util.logE
/**
* This class acts as the base for most the black magic required to get a remotely sensible music
@ -94,8 +93,12 @@ class MusicLoader {
song.internalIsMissingArtist ||
song.internalIsMissingGenre
) {
logE("Found malformed song: ${song.name}")
throw IllegalStateException()
throw IllegalStateException(
"Found malformed song: ${song.name} [" +
"album: ${!song.internalIsMissingAlbum} " +
"artist: ${!song.internalIsMissingArtist} " +
"genre: ${!song.internalIsMissingGenre}]"
)
}
}
@ -126,6 +129,7 @@ class MusicLoader {
args += "$path%" // Append % so that the selector properly detects children
}
// TODO: Figure out the semantics of the track field to prevent odd 4-digit numbers
context.applicationContext.contentResolver.query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
arrayOf(

View file

@ -131,7 +131,11 @@ fun TextView.bindSongInfo(song: Song?) {
return
}
text = song.resolvedArtistName
text = context.getString(
R.string.fmt_two,
song.resolvedArtistName,
song.resolvedAlbumName
)
}
@BindingAdapter("albumInfo")
@ -141,7 +145,11 @@ fun TextView.bindAlbumInfo(album: Album?) {
return
}
text = album.resolvedArtistName
text = context.getString(
R.string.fmt_two,
album.resolvedArtistName,
context.getPluralSafe(R.plurals.fmt_song_count, album.songs.size)
)
}
@BindingAdapter("artistInfo")
@ -152,7 +160,7 @@ fun TextView.bindArtistInfo(artist: Artist?) {
}
text = context.getString(
R.string.fmt_counts,
R.string.fmt_two,
context.getPluralSafe(R.plurals.fmt_album_count, artist.albums.size),
context.getPluralSafe(R.plurals.fmt_song_count, artist.songs.size)
)

View file

@ -48,6 +48,7 @@ import kotlin.math.min
* or extendable. You have been warned.
*
* @author OxygenCobalt (With help from Umano and Hai Zhang)
* TODO: Find a better way to handle PlaybackFragment in general (navigation, creation)
*/
class PlaybackLayout @JvmOverloads constructor(
context: Context,
@ -109,6 +110,8 @@ class PlaybackLayout @JvmOverloads constructor(
}
init {
setWillNotDraw(false)
// Set up our playback views. Doing this allows us to abstract away the implementation
// of these views from the user of this layout [MainFragment].
playbackContainerView = FrameLayout(context).apply {

View file

@ -93,6 +93,8 @@ class AudioReactor(
/**
* Updates the rough volume adjustment for [Metadata] with ReplayGain tags.
* This is based off Vanilla Music's implementation.
* TODO: Add ReplayGain pre-amp
* TODO: Add positive ReplayGain values
*/
fun applyReplayGain(metadata: Metadata?) {
if (metadata == null) {
@ -130,6 +132,7 @@ class AudioReactor(
playbackManager.song?.album == playbackManager.parent
}
}
val gain = parseReplayGain(metadata)
val adjust = if (gain != null) {
@ -147,8 +150,6 @@ class AudioReactor(
// Final adjustment along the volume curve.
// Ensure this is clamped to 0 or 1 so that it can be used as a volume.
// While positive ReplayGain values *could* be theoretically added, it's such
// a niche use-case that to be worth the effort required. Maybe if someone requests it.
volume = MathUtils.clamp((10f.pow((adjust / 20f))), 0f, 1f)
}
@ -180,7 +181,7 @@ class AudioReactor(
}
if (key in REPLAY_GAIN_TAGS) {
tags.add(GainTag(key!!, parseReplayGainFloat(value)))
tags.add(GainTag(requireNotNull(key), parseReplayGainFloat(value)))
}
}

View file

@ -30,9 +30,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@{song.name}"
android:layout_marginEnd="@dimen/spacing_small"
app:layout_constraintBottom_toTopOf="@+id/song_info"
app:layout_constraintEnd_toStartOf="@+id/song_duration"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
@ -44,26 +42,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
app:songInfo="@{song}"
android:layout_marginEnd="@dimen/spacing_small"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/song_duration"
app:layout_constraintStart_toEndOf="@+id/album_cover"
app:layout_constraintTop_toBottomOf="@+id/song_name"
tools:text="Artist / Album" />
<TextView
android:id="@+id/song_duration"
style="@style/Widget.Auxio.TextView.Item.Tertiary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="none"
android:gravity="end"
android:text="@{song.formattedDuration}"
android:textAlignment="viewEnd"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="16:16" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -4,7 +4,7 @@
<string name="info_app_name" translatable="false">Auxio</string>
<!-- Format Namespace | Value formatting/plurals -->
<string name="fmt_two" translatable="false">%1$s • %2$s</string>
<string name="fmt_three" translatable="false">%1$s • %2$s • %3$s</string>
<string name="fmt_counts" translatable="false">%1$s, %2$s</string>
<string name="fmt_track" translatable="false">%d</string>
</resources>