Skip to content

Commit

Permalink
Performance improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
D4rK7355608 committed Jul 2, 2024
1 parent 3ae7a23 commit 49f89f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {
applicationId = "com.d4rk.cleaner"
minSdk = 26
targetSdk = 34
versionCode = 78
versionCode = 79
versionName = "2.0.0"
archivesName = "${applicationId}-v${versionName}"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
29 changes: 9 additions & 20 deletions app/src/main/kotlin/com/d4rk/cleaner/ui/home/HomeComposable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ fun AnalyzeComposable(launchScanningKey: MutableState<Boolean>, imageLoader: Ima
columns = GridCells.Fixed(3),
verticalArrangement = Arrangement.spacedBy(8.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
modifier = Modifier.padding(8.dp)
modifier = Modifier.padding(8.dp),
) {
items(files) { file ->
items(files, key = { file -> file.absolutePath }) { file ->
FileCard(file = file, viewModel = viewModel, imageLoader = imageLoader)
}
}
Expand Down Expand Up @@ -315,24 +315,13 @@ fun FileCard(file: File, viewModel: HomeViewModel, imageLoader: ImageLoader) {
when (fileExtension) {
in context.resources.getStringArray(R.array.image_extensions).toList() -> {
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data(
when (fileExtension) {
in context.resources.getStringArray(R.array.image_extensions)
.toList(),
in context.resources.getStringArray(R.array.video_extensions)
.toList() -> {
file
}

else -> {
R.drawable.ic_image
}
}
)
.size(64)
.crossfade(true)
.build(),
model = remember(file) {
ImageRequest.Builder(context)
.data(file)
.size(64)
.crossfade(true)
.build()
},
imageLoader = imageLoader,
contentDescription = file.name,
contentScale = ContentScale.Crop,
Expand Down

0 comments on commit 49f89f1

Please sign in to comment.