diff --git a/core/designsystem/src/main/res/drawable/img.png b/core/designsystem/src/main/res/drawable/img.png new file mode 100644 index 000000000..9ce214e02 Binary files /dev/null and b/core/designsystem/src/main/res/drawable/img.png differ diff --git a/feature/interests/impl/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/impl/filter/FilterActivity.kt b/feature/interests/impl/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/impl/filter/FilterActivity.kt index d5b745b05..25c4836ff 100644 --- a/feature/interests/impl/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/impl/filter/FilterActivity.kt +++ b/feature/interests/impl/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/impl/filter/FilterActivity.kt @@ -138,7 +138,7 @@ fun FilterScreen(modifier: Modifier = Modifier) { val thumbnail = createFilteredBitmap(sourceBitmap, filter) FilterThumbnail( image = thumbnail.asImageBitmap(), - name = filter.name, + filter = filter, selected = filter == selectedFilter, onClick = { selectedFilter = filter} ) @@ -166,7 +166,7 @@ fun FilterScreen(modifier: Modifier = Modifier) { @Composable fun FilterThumbnail( image: ImageBitmap, - name: String, + filter: ImageFilter, selected: Boolean, onClick: () -> Unit ) { @@ -186,14 +186,14 @@ fun FilterThumbnail( ) { Image( bitmap = image, - contentDescription = name, + contentDescription = filter.name, modifier = Modifier.fillMaxSize(), - contentScale = ContentScale.Crop + contentScale = ContentScale.Crop, ) } Spacer(modifier = Modifier.height(4.dp)) Text( - text = name, + text = filter.name, style = MaterialTheme.typography.labelMedium, fontWeight = if (selected) FontWeight.Bold else FontWeight.Normal ) diff --git a/feature/interests/impl/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/impl/filter/FilterUtils.kt b/feature/interests/impl/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/impl/filter/FilterUtils.kt index d90256136..2ed328cb8 100644 --- a/feature/interests/impl/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/impl/filter/FilterUtils.kt +++ b/feature/interests/impl/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/interests/impl/filter/FilterUtils.kt @@ -24,6 +24,7 @@ import android.graphics.Canvas import android.graphics.ColorMatrix import android.graphics.ColorMatrixColorFilter import android.graphics.Paint +import androidx.compose.ui.graphics.ColorFilter import androidx.core.content.FileProvider import com.google.samples.apps.nowinandroid.feature.interests.impl.R import java.io.File @@ -32,7 +33,9 @@ import java.io.FileOutputStream class ImageFilter( val name: String, val matrix: FloatArray -) +) { + val colorFilter by lazy { ColorFilter.colorMatrix(androidx.compose.ui.graphics.ColorMatrix(matrix)) } +} val FILTERS = listOf( ImageFilter( @@ -96,7 +99,7 @@ val FILTERS = listOf( fun decodeSourceBitmap(context: Context): Bitmap { val options = BitmapFactory.Options().apply { inSampleSize = 4 } - return BitmapFactory.decodeResource(context.resources, R.drawable.feature_interests_impl_large_image, options) + return BitmapFactory.decodeResource(context.resources, R.drawable.img, options) } fun createFilteredBitmap(source: Bitmap, filter: ImageFilter): Bitmap { diff --git a/feature/interests/impl/src/main/res/drawable/img.png b/feature/interests/impl/src/main/res/drawable/img.png new file mode 100644 index 000000000..9ce214e02 Binary files /dev/null and b/feature/interests/impl/src/main/res/drawable/img.png differ diff --git a/tmp/heapdumps/memory-20260708T135256-tmp-1.hprof b/tmp/heapdumps/memory-20260708T135256-tmp-1.hprof new file mode 100644 index 000000000..0e865e9b0 Binary files /dev/null and b/tmp/heapdumps/memory-20260708T135256-tmp-1.hprof differ diff --git a/tmp/heapdumps/memory-20260708T135608-tmp-2.hprof b/tmp/heapdumps/memory-20260708T135608-tmp-2.hprof new file mode 100644 index 000000000..3869f0cd2 Binary files /dev/null and b/tmp/heapdumps/memory-20260708T135608-tmp-2.hprof differ diff --git a/tmp/heapdumps/memory-20260708T135753-tmp-3.hprof b/tmp/heapdumps/memory-20260708T135753-tmp-3.hprof new file mode 100644 index 000000000..a8b799a15 Binary files /dev/null and b/tmp/heapdumps/memory-20260708T135753-tmp-3.hprof differ diff --git a/tmp/heapdumps/memory-20260708T140014-tmp-4.hprof b/tmp/heapdumps/memory-20260708T140014-tmp-4.hprof new file mode 100644 index 000000000..1130f9f3d Binary files /dev/null and b/tmp/heapdumps/memory-20260708T140014-tmp-4.hprof differ diff --git a/tmp/heapdumps/memory-20260708T140418-tmp-5.hprof b/tmp/heapdumps/memory-20260708T140418-tmp-5.hprof new file mode 100644 index 000000000..92a5a3a2c Binary files /dev/null and b/tmp/heapdumps/memory-20260708T140418-tmp-5.hprof differ