Skip to content

Commit

Permalink
ui: Changed unknown music artwork icon to the Material3 implementation
Browse files Browse the repository at this point in the history
ui/fix: Deleted unnecessary ImageRequest's at the image loading time making the performance worse
chore: Updated to AGP to 8.5.0-alpha02

Signed-off-by: Gabriel Fontán <[email protected]>
  • Loading branch information
BobbyESP committed Apr 2, 2024
1 parent 762b0a7 commit 4a47a07
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.graphics.drawable.BitmapDrawable
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MusicNote
import androidx.compose.material.icons.rounded.MusicNote
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -52,10 +52,6 @@ fun AsyncImageImpl(
// Create an ImageLoader if it doesn't exist yet and remember it with the current context.
val imageLoader = LocalCoilImageLoader.current

val imageRequest =
ImageRequest.Builder(context).data(model)
.crossfade(true).build()

if (isPreview) {
Image(
painter = painterResource(R.drawable.metadator_logo_foreground),
Expand All @@ -68,7 +64,7 @@ fun AsyncImageImpl(
)
} else {
AsyncImage(
model = imageRequest,
model = model,
imageLoader = imageLoader ?: ImageLoader.Builder(context).build(),
onState = onState,
filterQuality = filterQuality,
Expand Down Expand Up @@ -106,14 +102,10 @@ fun AsyncImageImpl(

val imageLoader = LocalCoilImageLoader.current

val imageRequest =
ImageRequest.Builder(context).data(model)
.crossfade(true).build()

val placeholderPainter = placeholder ?: painterResource(R.drawable.metadator_logo_foreground)

AsyncImage(
model = imageRequest,
model = model,
imageLoader = imageLoader ?: ImageLoader.Builder(context).build(),
filterQuality = filterQuality,
onError = onError,
Expand Down Expand Up @@ -161,7 +153,7 @@ fun ArtworkAsyncImage(
PlaceholderCreator(
modifier = modifier
.clip(MaterialTheme.shapes.small),
icon = Icons.Default.MusicNote,
icon = Icons.Rounded.MusicNote,
colorful = false,
contentDescription = "Song cover"
)
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[versions]
#General, lifecycle and core
agp = "8.4.0-alpha13"
agp = "8.5.0-alpha02"
firebaseCrashlyticsGradle = "2.9.9"
gradle = "8.4.0-alpha13"
gradle = "8.5.0-alpha02"
kotlin = "1.9.21"
appcompat = "1.7.0-alpha03"
core-ktx = "1.12.0"
Expand Down

0 comments on commit 4a47a07

Please sign in to comment.