detail: update album song layout

Update the album song layout to be more alike to other songs.

Recently I migrated the TextView in the album songs to use 48dp sizing,
like the other song views. However, this resulted in a lot of empty
space that felt off. Fix this by adding a light background to the track
number, which fills the room it takes up a bit more. It also hopefully
primes the track number to take an indicator once multi-select is
added.
This commit is contained in:
OxygenCobalt 2022-03-29 19:58:51 -06:00
parent 0107d9ff32
commit e387e72b2c
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
13 changed files with 81 additions and 29 deletions

View file

@ -10,6 +10,7 @@
#### What's Changed
- Audio focus is no longer configurable
- Made the layout of album songs more similar to other songs
#### Dev/Meta
- Updated translations [Konstantin Tutsch -> German, cccClyde -> Chinese ]

View file

@ -39,15 +39,17 @@ I primarily built Auxio for myself, but you can use it too, I guess.
## Features
- [ExoPlayer](https://exoplayer.dev/) based playback
- Customizable UI & Behavior
- Snappy UI derived from the latest Material Design guidelines
- Opinionated UX that prioritizes ease of use over edge cases
- Customizable behavior
- Advanced media indexer that prioritizes correct metadata
- Reliable playback state persistence
- Full ReplayGain support (On MP3, MP4, FLAC, OGG, and OPUS)
- Material You (Android 12+ only)
- Edge-to-edge
- Embedded covers support
- Search Functionality
- Audio/Headset focus
- Headset autoplay
- Stylish widgets that automatically adapt to their size
- Completely private and offline
- No rounded album covers (Unless you want them. Then you can.)

View file

@ -30,6 +30,7 @@ android {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}

View file

@ -19,6 +19,7 @@ package org.oxycblt.auxio.detail.recycler
import android.content.Context
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import org.oxycblt.auxio.IntegerTable
import org.oxycblt.auxio.R
@ -171,14 +172,14 @@ private class AlbumSongViewHolder private constructor(private val binding: ItemA
isInvisible = false
}
binding.songTrackPlaceholder.isInvisible = true
binding.songTrackPlaceholder.isVisible = false
} else {
binding.songTrack.apply {
textSafe = ""
isInvisible = true
}
binding.songTrackPlaceholder.isInvisible = false
binding.songTrackPlaceholder.isVisible = true
}
binding.songName.textSafe = item.resolvedName
@ -197,6 +198,7 @@ private class AlbumSongViewHolder private constructor(private val binding: ItemA
binding.songName.isActivated = isHighlighted
binding.songTrack.isActivated = isHighlighted
binding.songTrackPlaceholder.isActivated = isHighlighted
binding.songTrackBg.isActivated = isHighlighted
}
companion object {

View file

@ -83,7 +83,7 @@ class PlaybackService :
private lateinit var player: ExoPlayer
private lateinit var mediaSession: MediaSessionCompat
private lateinit var connector: PlaybackSessionConnector
private val audioProcessor = ReplayGainAudioProcessor()
private val replayGainProcessor = ReplayGainAudioProcessor()
// Notification components
private lateinit var notification: PlaybackNotification
@ -247,7 +247,7 @@ class PlaybackService :
if (info.isSelected) {
for (i in 0 until info.trackGroup.length) {
if (info.isTrackSelected(i)) {
audioProcessor.applyReplayGain(info.trackGroup.getFormat(i).metadata)
replayGainProcessor.applyReplayGain(info.trackGroup.getFormat(i).metadata)
break
}
}
@ -359,8 +359,8 @@ class PlaybackService :
handler,
audioListener,
AudioCapabilities.DEFAULT_AUDIO_CAPABILITIES,
audioProcessor),
LibflacAudioRenderer(handler, audioListener, audioProcessor))
replayGainProcessor),
LibflacAudioRenderer(handler, audioListener, replayGainProcessor))
}
// Enable constant bitrate seeking so that certain MP3s/AACs are seekable

View file

@ -211,17 +211,17 @@ class ReplayGainAudioProcessor : BaseAudioProcessor() {
}
} else {
for (i in position until limit step 2) {
val sample = inputBuffer.getLeShort(i)
var sample = inputBuffer.getLeShort(i)
// Clamp the values to the minimum and maximum values possible for the
// encoding. This prevents issues where samples amplified beyond 1 << 16
// will end up becoming truncated during the conversion to a short,
// resulting in popping.
val targetSample =
sample =
(sample * volume)
.toInt()
.clamp(Short.MIN_VALUE.toInt(), Short.MAX_VALUE.toInt())
.toShort()
buffer.putLeShort(targetSample)
buffer.putLeShort(sample)
}
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/colorOnPrimaryContainer"
android:state_activated="true" />
<item android:color="?attr/colorOnSurfaceVariant" />
</selector>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.64" android:color="?attr/colorPrimaryContainer"
android:state_activated="true" />
<item android:alpha="0.32" android:color="?attr/colorSurfaceVariant" />
</selector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/sel_track_bg" />
</shape>

View file

@ -5,6 +5,20 @@
xmlns:tools="http://schemas.android.com/tools"
style="@style/Widget.Auxio.ItemLayout">
<!--
We don't want to show an album cover, but we still want the spacing of this song
to be alike to other songs. So, add a pastel-ish background to each track number
view. The way we do this is odd, but it's designed this way-->
<org.oxycblt.auxio.coil.RoundableImageView
android:id="@+id/song_track_bg"
style="@style/Widget.Auxio.Image.Small"
android:src="@drawable/ui_track_bg"
app:layout_constraintBottom_toBottomOf="@+id/song_track"
app:layout_constraintEnd_toEndOf="@+id/song_track"
app:layout_constraintStart_toStartOf="@+id/song_track"
app:layout_constraintTop_toTopOf="@+id/song_track"/>
<ImageView
android:id="@+id/song_track_placeholder"
style="@style/Widget.Auxio.Image.Small"
@ -12,26 +26,27 @@
android:layout_height="wrap_content"
android:contentDescription="@string/def_track"
android:src="@drawable/ic_song"
android:visibility="invisible"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/song_track"
app:layout_constraintEnd_toEndOf="@+id/song_track"
app:layout_constraintStart_toStartOf="@+id/song_track"
app:layout_constraintTop_toTopOf="@+id/song_track"
app:tint="@color/sel_accented"
app:tint="@color/sel_on_track_bg"
tools:text="1" />
<TextView
android:id="@+id/song_track"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/size_btn_small"
android:layout_height="@dimen/size_btn_small"
android:gravity="center"
android:maxLines="1"
android:minWidth="@dimen/size_btn_small"
android:minHeight="@dimen/size_btn_small"
app:autoSizeTextType="uniform"
app:autoSizeMinTextSize="@dimen/text_size_track_number_min"
app:autoSizeMaxTextSize="@dimen/text_size_track_number_max"
app:autoSizeStepGranularity="@dimen/text_size_track_number_step"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.Auxio.BodyLarge"
android:textColor="@color/sel_accented_secondary"
android:textSize="@dimen/text_size_track_number"
android:textColor="@color/sel_on_track_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/song_name"
app:layout_constraintHorizontal_bias="0.5"

View file

@ -26,7 +26,9 @@
<dimen name="text_size_ext_label_larger">16sp</dimen>
<dimen name="text_size_ext_title_mid_large">18sp</dimen>
<dimen name="text_size_track_number">22sp</dimen>
<dimen name="text_size_track_number_min">12sp</dimen>
<dimen name="text_size_track_number_max">20sp</dimen>
<dimen name="text_size_track_number_step">2sp</dimen>
<!-- Misc -->
<dimen name="elevation_small">2dp</dimen>

View file

@ -6,9 +6,13 @@ Auxio is available on the [F-Droid](https://f-droid.org/en/packages/org.oxycblt.
Auxio is not and will never be on the play store due to it being a proprietary and draconian platform.
#### Why ExoPlayer?
ExoPlayer is far more flexible than the native MediaPlayer API, which allows consistent behavior across devices & OEMs and the
ability to be extended to music sources outside of local files. You can read more about the benefits (and drawbacks) of ExoPlayer
[Here](https://exoplayer.dev/pros-and-cons.html).
Unlike the stock `MediaPlayer` API that most music apps use, ExoPlayer is independent from the android system's
audio framework. This allows for the following:
- Consistent behavior across devices and OS versions
- Features that are normally not possible with a normal audio stream (such as positive ReplayGain values)
- Playback to be (theoretically) be extended beyond local files in the future
You can read more about the benefits (and drawbacks) of ExoPlayer [Here](https://exoplayer.dev/pros-and-cons.html).
#### What formats does Auxio support?
As per the [Supported ExoPlayer Formats](https://exoplayer.dev/supported-formats.html), Auxio supports
@ -19,6 +23,7 @@ of Android through the use of the ExoPlayer FLAC extension.
This is probably caused by one of two reasons:
1. If other players like Phonograph, Retro Music, or Music Player GO load it correctly, then Auxio has a bug and it should be [reported](https://github.com/OxygenCobalt/Auxio/issues).
2. If the aforementioned players don't work, but players like Vanilla Music and VLC do, then it's a problem with the Media APIs that Auxio relies on. There is nothing I can do about it.
- I hope to mitigate these issues in the future by extracting metadata myself or adding Subsonic/SoundPod support, however this is extremely far off.
#### I have a large library and Auxio takes really long to load it!
This is expected since reading from the audio database takes awhile, especially with libraries containing 10k songs or more.
@ -27,13 +32,19 @@ This is expected since reading from the audio database takes awhile, especially
This is a current limitation with the music loader. To remedy this, go to Settings -> Reload music whenever new songs are added.
I hope to make the app rescan music on the fly eventually.
#### There should be one artist, but instead I get a bunch of "Artist & Collaborator" artists!
This likely means your tags are wrong. By default, Auxio will use the "album artist" tag for
grouping if present, falling back to the "artist" tag otherwise. If your music does not have
such a field, it will result in fragmented artists. The reason why Auxio does not simply parse
for separators and then extract artists that way is that it risks mangling artists that don't
actually have collaborators, such as "Black Country, New Road" becoming "Black Country".
#### ReplayGain isn't working on my music!
This is for a couple reason:
- Auxio doesn't extract ReplayGain tags for your format.
- Auxio doesn't extract ReplayGain tags for your format. This is a problem on ExoPlayer's end and should be
investigated there.
- Auxio doesn't recognize your ReplayGain tags. This is usually because of a non-standard tag like ID3v2's `RVAD` or
an unrecognized name.
- Your tags use a ReplayGain value higher than 0. Due to technical limitations, Auxio does not support this right now,
but I can work on it if the demand for this is sufficient.
#### What is dynamic ReplayGain?
Dynamic ReplayGain is a quirk setting based off the FooBar2000 plugin that dynamically switches from track gain to album

View file

@ -4,5 +4,6 @@ Auxio uses a number of third-party libraries, which are listed below with their
| Library Name | Author(s) | Purpose | License |
|--------------|-----------|---------|---------|
| [ExoPlayer](https://github.com/google/ExoPlayer) | [Google](https://github.com/google) | Music Playback | Apache-2.0 |
| [Coil](https://github.com/coil-kt/coil) | [coil-kt](https://github.com/coil-kt) | Image Loading | Apache-2.0 |
| [ktlint](https://github.com/pinterest/ktlint) | [Pinterest](https://github.com/pinterest) | Code Formatting | MIT |
| [Coil](https://github.com/coil-kt/coil) | [Square](https://github.com/coil-kt) | Image Loading | Apache-2.0 |
| [Spotless](https://github.com/diffplug/spotless) | [CiffPlug](https://github.com/diffplug) | Formatting | Apache-2.0 |
| [ktfmt](https://github.com/facebookincubator/ktfmt) | [Meta](https://github.com/facebookincubator) | Formatting | Apache-2.0 |