deps: upgrade

Round and round:

Coil -> 2.0.0-alpha05
Material -> 1.5.0-rc01
Kotlin -> 1.6.10
This commit is contained in:
OxygenCobalt 2021-12-17 14:45:40 -07:00
parent 284108678b
commit 5a9ac4bec9
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
5 changed files with 18 additions and 20 deletions

View file

@ -98,15 +98,15 @@ dependencies {
implementation "com.google.android.exoplayer:exoplayer-core:2.16.1" implementation "com.google.android.exoplayer:exoplayer-core:2.16.1"
// Image loading // Image loading
implementation 'io.coil-kt:coil:2.0.0-alpha03' implementation 'io.coil-kt:coil:2.0.0-alpha05'
// Material // Material
implementation "com.google.android.material:material:1.5.0-beta01" implementation 'com.google.android.material:material:1.5.0-rc01'
// --- DEBUG --- // --- DEBUG ---
// Lint // Lint
ktlint 'com.pinterest:ktlint:0.43.0' ktlint 'com.pinterest:ktlint:0.43.2'
} }
task ktlint(type: JavaExec, group: "verification") { task ktlint(type: JavaExec, group: "verification") {

View file

@ -12,8 +12,9 @@ import coil.fetch.DrawableResult
import coil.fetch.FetchResult import coil.fetch.FetchResult
import coil.fetch.Fetcher import coil.fetch.Fetcher
import coil.fetch.SourceResult import coil.fetch.SourceResult
import coil.size.PixelSize import coil.size.Dimension
import coil.size.Size import coil.size.Size
import coil.size.pxOrElse
import com.google.android.exoplayer2.MediaItem import com.google.android.exoplayer2.MediaItem
import com.google.android.exoplayer2.MediaMetadata import com.google.android.exoplayer2.MediaMetadata
import com.google.android.exoplayer2.MetadataRetriever import com.google.android.exoplayer2.MetadataRetriever
@ -30,6 +31,7 @@ import org.oxycblt.auxio.settings.SettingsManager
import org.oxycblt.auxio.util.logD import org.oxycblt.auxio.util.logD
import java.io.ByteArrayInputStream import java.io.ByteArrayInputStream
import java.io.InputStream import java.io.InputStream
import android.util.Size as AndroidSize
/** /**
* The base implementation for all image fetchers in Auxio. * The base implementation for all image fetchers in Auxio.
@ -215,12 +217,8 @@ abstract class AuxioFetcher : Fetcher {
// Use whatever size coil gives us to create the mosaic, rounding it to even so that we // Use whatever size coil gives us to create the mosaic, rounding it to even so that we
// get a symmetrical mosaic [and to prevent bugs]. If there is no size, default to a // get a symmetrical mosaic [and to prevent bugs]. If there is no size, default to a
// 512x512 mosaic. // 512x512 mosaic.
val mosaicSize = when (size) { val mosaicSize = AndroidSize(size.width.mosaicSize(), size.height.mosaicSize())
is PixelSize -> PixelSize(size.width.roundEven(), size.height.roundEven()) val increment = AndroidSize(mosaicSize.width / 2, mosaicSize.height / 2)
else -> PixelSize(512, 512)
}
val increment = PixelSize(mosaicSize.width / 2, mosaicSize.height / 2)
val mosaicBitmap = Bitmap.createBitmap( val mosaicBitmap = Bitmap.createBitmap(
mosaicSize.width, mosaicSize.height, Bitmap.Config.ARGB_8888 mosaicSize.width, mosaicSize.height, Bitmap.Config.ARGB_8888
@ -265,5 +263,8 @@ abstract class AuxioFetcher : Fetcher {
) )
} }
private fun Int.roundEven(): Int = if (mod(2) != 0) inc() else this private fun Dimension.mosaicSize(): Int {
val size = pxOrElse { 512 }
return if (size.mod(2) != 0) size.inc() else size
}
} }

View file

@ -28,7 +28,7 @@ import coil.dispose
import coil.imageLoader import coil.imageLoader
import coil.load import coil.load
import coil.request.ImageRequest import coil.request.ImageRequest
import coil.size.OriginalSize import coil.size.Size
import org.oxycblt.auxio.R import org.oxycblt.auxio.R
import org.oxycblt.auxio.music.Album import org.oxycblt.auxio.music.Album
import org.oxycblt.auxio.music.Artist import org.oxycblt.auxio.music.Artist
@ -66,7 +66,7 @@ fun ImageView.bindGenreImage(genre: Genre?) = load(genre, R.drawable.ic_genre)
fun <T : Music> ImageView.load(music: T?, @DrawableRes error: Int) { fun <T : Music> ImageView.load(music: T?, @DrawableRes error: Int) {
dispose() dispose()
// We don't round album covers by default as it descecrates album artwork, but we do provide // We don't round album covers by default as it desecrates album artwork, but we do provide
// an option if one wants it. // an option if one wants it.
// As for why we use clipToOutline instead of coil's RoundedCornersTransformation, the transform // As for why we use clipToOutline instead of coil's RoundedCornersTransformation, the transform
// uses the dimensions of the image to create the corners, which results in inconsistent corners // uses the dimensions of the image to create the corners, which results in inconsistent corners
@ -101,7 +101,7 @@ fun loadBitmap(
context.imageLoader.enqueue( context.imageLoader.enqueue(
ImageRequest.Builder(context) ImageRequest.Builder(context)
.data(song.album) .data(song.album)
.size(OriginalSize) .size(Size.ORIGINAL)
.target( .target(
onError = { onDone(null) }, onError = { onDone(null) },
onSuccess = { onDone(it.toBitmap()) } onSuccess = { onDone(it.toBitmap()) }

View file

@ -152,9 +152,6 @@
<style name="Widget.Auxio.Button.Primary" parent="Widget.Material3.Button"> <style name="Widget.Auxio.Button.Primary" parent="Widget.Material3.Button">
<item name="android:textAppearance">@style/TextAppearance.Auxio.LabelLarger</item> <item name="android:textAppearance">@style/TextAppearance.Auxio.LabelLarger</item>
<item name="android:stateListAnimator">@null</item>
<item name="android:elevation">0dp</item>
<item name="elevation">0dp</item>
</style> </style>
<style name="Widget.Auxio.Button.Secondary" parent="Widget.Material3.Button.OutlinedButton"> <style name="Widget.Auxio.Button.Secondary" parent="Widget.Material3.Button.OutlinedButton">
@ -167,10 +164,10 @@
<!-- <!--
Abuse this floating action button to act more like an old-school auxio button. Abuse this floating action button to act more like an old-school auxio button.
This is only done because --> This is only done because the elevation show acts weird with the panel layout.
-->
<item name="android:elevation">0dp</item> <item name="android:elevation">0dp</item>
<item name="elevation">0dp</item> <item name="elevation">0dp</item>
<item name="shapeAppearanceOverlay">@style/ShapeAppearance.Auxio.FloatingActionButton.PlayPause</item> <item name="shapeAppearanceOverlay">@style/ShapeAppearance.Auxio.FloatingActionButton.PlayPause</item>
</style> </style>

View file

@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.6.0' ext.kotlin_version = '1.6.10'
ext.navigation_version = "2.3.5" ext.navigation_version = "2.3.5"
repositories { repositories {