diff --git a/CHANGELOG.md b/CHANGELOG.md index c445f0722..7c9542770 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,13 @@ - Shuffle and Repeat mode buttons now have more contrast when they are turned on #### What's Fixed -- Fixed crash on certain devices running Android 10 and lower when a differing theme from the system theme was used. +- Fixed crash on certain devices running Android 10 and lower when a differing theme +from the system theme was used. #### What's Changed - All cover art is now cropped to a 1:1 aspect ratio +- Song items no longer show an album in favor of a duration +- Album items no longer show a song count #### Dev/Meta - Enabled elevation drop shadows below Android P for consistency diff --git a/app/src/main/java/org/oxycblt/auxio/AuxioApp.kt b/app/src/main/java/org/oxycblt/auxio/AuxioApp.kt index 9de446848..b38f175e8 100644 --- a/app/src/main/java/org/oxycblt/auxio/AuxioApp.kt +++ b/app/src/main/java/org/oxycblt/auxio/AuxioApp.kt @@ -24,7 +24,7 @@ import coil.ImageLoaderFactory import coil.request.CachePolicy import org.oxycblt.auxio.coil.AlbumArtFetcher import org.oxycblt.auxio.coil.ArtistImageFetcher -import org.oxycblt.auxio.coil.ErrorCrossfadeFactory +import org.oxycblt.auxio.coil.CrossfadeFactory import org.oxycblt.auxio.coil.GenreImageFetcher import org.oxycblt.auxio.coil.MusicKeyer import org.oxycblt.auxio.settings.SettingsManager @@ -48,7 +48,7 @@ class AuxioApp : Application(), ImageLoaderFactory { add(GenreImageFetcher.Factory()) add(MusicKeyer()) } - .transitionFactory(ErrorCrossfadeFactory()) + .transitionFactory(CrossfadeFactory()) .diskCachePolicy(CachePolicy.DISABLED) // Not downloading anything, so no disk-caching .build() } diff --git a/app/src/main/java/org/oxycblt/auxio/coil/AuxioFetcher.kt b/app/src/main/java/org/oxycblt/auxio/coil/BaseFetcher.kt similarity index 99% rename from app/src/main/java/org/oxycblt/auxio/coil/AuxioFetcher.kt rename to app/src/main/java/org/oxycblt/auxio/coil/BaseFetcher.kt index 312194d34..262f31a06 100644 --- a/app/src/main/java/org/oxycblt/auxio/coil/AuxioFetcher.kt +++ b/app/src/main/java/org/oxycblt/auxio/coil/BaseFetcher.kt @@ -37,7 +37,7 @@ import android.util.Size as AndroidSize * @author OxygenCobalt * TODO: Artist images */ -abstract class AuxioFetcher : Fetcher { +abstract class BaseFetcher : Fetcher { private val settingsManager = SettingsManager.getInstance() /** @@ -193,7 +193,6 @@ abstract class AuxioFetcher : Fetcher { // In the case a front cover is not found, use the first image in the tag instead. // This can be corrected later on if a front cover frame is found. logW("No front cover image, using image of type $type instead") - stream = ByteArrayInputStream(pic) } } diff --git a/app/src/main/java/org/oxycblt/auxio/coil/ErrorCrossfadeFactory.kt b/app/src/main/java/org/oxycblt/auxio/coil/CrossfadeFactory.kt similarity index 94% rename from app/src/main/java/org/oxycblt/auxio/coil/ErrorCrossfadeFactory.kt rename to app/src/main/java/org/oxycblt/auxio/coil/CrossfadeFactory.kt index 8cc0184d5..8b2f03716 100644 --- a/app/src/main/java/org/oxycblt/auxio/coil/ErrorCrossfadeFactory.kt +++ b/app/src/main/java/org/oxycblt/auxio/coil/CrossfadeFactory.kt @@ -13,7 +13,7 @@ import coil.transition.TransitionTarget * You know. Like they used to. * @author Coil Team */ -class ErrorCrossfadeFactory : Transition.Factory { +class CrossfadeFactory : Transition.Factory { override fun create(target: TransitionTarget, result: ImageResult): Transition { // Don't animate if the request was fulfilled by the memory cache. if (result is SuccessResult && result.dataSource == DataSource.MEMORY_CACHE) { diff --git a/app/src/main/java/org/oxycblt/auxio/coil/Fetchers.kt b/app/src/main/java/org/oxycblt/auxio/coil/Fetchers.kt index f3119c7b7..7e56c4ddf 100644 --- a/app/src/main/java/org/oxycblt/auxio/coil/Fetchers.kt +++ b/app/src/main/java/org/oxycblt/auxio/coil/Fetchers.kt @@ -43,7 +43,7 @@ import kotlin.math.min class AlbumArtFetcher private constructor( private val context: Context, private val album: Album -) : AuxioFetcher() { +) : BaseFetcher() { override suspend fun fetch(): FetchResult? { return fetchArt(context, album)?.let { stream -> SourceResult( @@ -75,7 +75,7 @@ class ArtistImageFetcher private constructor( private val context: Context, private val size: Size, private val artist: Artist, -) : AuxioFetcher() { +) : BaseFetcher() { override suspend fun fetch(): FetchResult? { val albums = Sort.ByName(true) .sortAlbums(artist.albums) @@ -101,7 +101,7 @@ class GenreImageFetcher private constructor( private val context: Context, private val size: Size, private val genre: Genre, -) : AuxioFetcher() { +) : BaseFetcher() { override suspend fun fetch(): FetchResult? { // We don't need to sort here, as the way we val albums = genre.songs.groupBy { it.album }.keys diff --git a/app/src/main/java/org/oxycblt/auxio/coil/MusicKeyer.kt b/app/src/main/java/org/oxycblt/auxio/coil/MusicKeyer.kt index a4aece706..bcc7e1902 100644 --- a/app/src/main/java/org/oxycblt/auxio/coil/MusicKeyer.kt +++ b/app/src/main/java/org/oxycblt/auxio/coil/MusicKeyer.kt @@ -11,6 +11,7 @@ import org.oxycblt.auxio.music.Song class MusicKeyer : Keyer { override fun key(data: Music, options: Options): String { return if (data is Song) { + // Group up song covers with album covers for better caching key(data.album, options) } else { "${data::class.simpleName}: ${data.id}" diff --git a/app/src/main/java/org/oxycblt/auxio/coil/RoundableImageView.kt b/app/src/main/java/org/oxycblt/auxio/coil/RoundableImageView.kt index c06194c0a..d122d73ab 100644 --- a/app/src/main/java/org/oxycblt/auxio/coil/RoundableImageView.kt +++ b/app/src/main/java/org/oxycblt/auxio/coil/RoundableImageView.kt @@ -34,10 +34,11 @@ class RoundableImageView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() - // As for why we use clipToOutline instead of coils RoundedCornersTransformation, the radii - // of an image's corners is dependent on the actual dimensions of the image, which would - // force us to resize all images to a fixed size. clipToOutline is pretty much always - // cheaper as long as we have a perfectly-square image. + // Use clipToOutline and a background drawable to crop images. While Coil's transformation + // could theoretically be used to round corners, the corner radius is dependent on the + // 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 } diff --git a/app/src/main/java/org/oxycblt/auxio/coil/SquareFrameTransform.kt b/app/src/main/java/org/oxycblt/auxio/coil/SquareFrameTransform.kt index 1287cd409..1ef87f18c 100644 --- a/app/src/main/java/org/oxycblt/auxio/coil/SquareFrameTransform.kt +++ b/app/src/main/java/org/oxycblt/auxio/coil/SquareFrameTransform.kt @@ -16,6 +16,8 @@ class SquareFrameTransform : Transformation { get() = "SquareFrameTransform" override suspend fun transform(input: Bitmap, size: Size): Bitmap { + // Find the smaller dimension and then take a center portion of the image that + // has that size. val dstSize = min(input.width, input.height) val x = (input.width - dstSize) / 2 val y = (input.height - dstSize) / 2 diff --git a/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt b/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt index 0dc9c2d29..dab47ed9b 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt @@ -131,11 +131,7 @@ fun TextView.bindSongInfo(song: Song?) { return } - text = context.getString( - R.string.fmt_two, - song.resolvedArtistName, - song.resolvedAlbumName - ) + text = song.resolvedArtistName } @BindingAdapter("albumInfo") @@ -145,10 +141,7 @@ fun TextView.bindAlbumInfo(album: Album?) { return } - text = context.getString( - R.string.fmt_two, album.resolvedArtistName, - context.getPluralSafe(R.plurals.fmt_song_count, album.songs.size) - ) + text = album.resolvedArtistName } @BindingAdapter("artistInfo") diff --git a/app/src/main/res/layout/item_song.xml b/app/src/main/res/layout/item_song.xml index 045f10da5..22429934e 100644 --- a/app/src/main/res/layout/item_song.xml +++ b/app/src/main/res/layout/item_song.xml @@ -30,8 +30,9 @@ 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_toEndOf="parent" + app:layout_constraintEnd_toStartOf="@+id/song_duration" app:layout_constraintStart_toEndOf="@+id/album_cover" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_chainStyle="packed" @@ -43,11 +44,26 @@ 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_toEndOf="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" /> + + \ No newline at end of file diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 18505b690..85ce25122 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -4,7 +4,6 @@ Auxio - %1$s • %2$s %1$s • %2$s • %3$s %1$s, %2$s %d