playback: fix bad compact view spacing

Fix an issue where the constraints in the playback view were not
actually anchored to the playback bar, resulting in bad spacing.
This commit is contained in:
OxygenCobalt 2021-11-02 06:58:36 -06:00
parent 0a4b07e583
commit 93cdae2295
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
4 changed files with 9 additions and 10 deletions

View file

@ -29,6 +29,7 @@ import coil.fetch.SourceResult
import coil.size.Size
import com.google.android.exoplayer2.MediaItem
import com.google.android.exoplayer2.MetadataRetriever
import com.google.android.exoplayer2.metadata.Metadata
import com.google.android.exoplayer2.metadata.flac.PictureFrame
import com.google.android.exoplayer2.metadata.id3.ApicFrame
import okio.buffer
@ -39,6 +40,7 @@ import org.oxycblt.auxio.music.toAlbumArtURI
import org.oxycblt.auxio.music.toURI
import org.oxycblt.auxio.settings.SettingsManager
import java.io.ByteArrayInputStream
import java.lang.Exception
/**
* Fetcher that returns the album art for a given [Album]. Handles settings on whether to use
@ -159,7 +161,11 @@ class AlbumArtFetcher(private val context: Context) : Fetcher<Album> {
// Coil is async, we can just spin until the loading has ended
while (future.isDone) { /* no-op */ }
val tracks = future.get()
val tracks = try {
future.get()
} catch (e: Exception) {
null
}
if (tracks == null || tracks.isEmpty) {
// Unrecognized format. This is expected, as ExoPlayer only supports a

View file

@ -38,10 +38,6 @@ import org.oxycblt.auxio.util.systemBarsCompat
* properly. The mechanism is mostly inspired by Material Files' PersistentBarLayout, however
* this class was primarily written by me and I plan to expand this layout to become part of
* the playback navigation process.
*
* TODO: Implement animation
* TODO: Implement the swipe-up behavior. This needs to occur, as the way the main fragment
* saves state results in'
*/
class PlaybackBarLayout @JvmOverloads constructor(
context: Context,
@ -290,7 +286,6 @@ class PlaybackBarLayout @JvmOverloads constructor(
override fun checkLayoutParams(layoutParams: ViewGroup.LayoutParams): Boolean =
layoutParams is LayoutParams && super.checkLayoutParams(layoutParams)
@Suppress("UNUSED")
class LayoutParams : ViewGroup.LayoutParams {
var isBar = false
var shown = false

View file

@ -31,8 +31,6 @@ import org.oxycblt.auxio.ui.SortMode
/**
* Wrapper around the [SharedPreferences] class that writes & reads values without a context.
* @author OxygenCobalt
* TODO: Consider re-adding the colorize notif setting but only on <Android 10 since it really
* doesn't work on Android 11+
*/
class SettingsManager private constructor(context: Context) :
SharedPreferences.OnSharedPreferenceChangeListener {

View file

@ -23,7 +23,7 @@
android:layout_margin="@dimen/spacing_small"
android:contentDescription="@{@string/desc_album_cover(song.name)}"
app:albumArt="@{song}"
app:layout_constraintBottom_toTopOf="@+id/playback_progress"
app:layout_constraintBottom_toTopOf="@+id/playback_progress_bar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_song" />
@ -66,7 +66,7 @@
android:src="@drawable/sel_playing_state"
android:layout_margin="@dimen/spacing_small"
android:contentDescription="@string/desc_play_pause"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/playback_progress_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />