diff --git a/experimental/examples/imageviewer/shared/build.gradle.kts b/experimental/examples/imageviewer/shared/build.gradle.kts index d3960e4aa8..4cff047c11 100755 --- a/experimental/examples/imageviewer/shared/build.gradle.kts +++ b/experimental/examples/imageviewer/shared/build.gradle.kts @@ -34,7 +34,7 @@ kotlin { implementation(compose.runtime) implementation(compose.foundation) implementation(compose.material) - implementation("org.jetbrains.compose.components:components-resources:1.3.0-beta04-dev879") + implementation("org.jetbrains.compose.components:components-resources:1.4.0-alpha01-dev942") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) implementation(compose.material3) diff --git a/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/FullscreenImage.kt b/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/FullscreenImage.kt index 0f8efcb53d..b1ccc25d66 100644 --- a/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/FullscreenImage.kt +++ b/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/FullscreenImage.kt @@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.painter.BitmapPainter +import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.input.key.* import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.unit.IntRect @@ -26,9 +27,7 @@ import example.imageviewer.core.FilterType import example.imageviewer.model.* import example.imageviewer.style.* import org.jetbrains.compose.resources.ExperimentalResourceApi -import org.jetbrains.compose.resources.orEmpty -import org.jetbrains.compose.resources.rememberImageBitmap -import org.jetbrains.compose.resources.resource +import org.jetbrains.compose.resources.painterResource @Composable internal fun FullscreenImage( @@ -157,7 +156,7 @@ private fun FullscreenImageBar( navigationIcon = { Tooltip(localization.back) { Image( - resource("back.png").rememberImageBitmap().orEmpty(), + painterResource("back.png"), contentDescription = null, modifier = Modifier.size(38.dp) .clip(CircleShape) @@ -205,24 +204,24 @@ private fun FilterButton( @OptIn(ExperimentalResourceApi::class) @Composable -private fun getFilterImage(active: Boolean, type: FilterType): ImageBitmap { +private fun getFilterImage(active: Boolean, type: FilterType): Painter { return when (type) { FilterType.GrayScale -> if (active) { - resource("grayscale_on.png").rememberImageBitmap().orEmpty() + painterResource("grayscale_on.png") } else { - resource("grayscale_off.png").rememberImageBitmap().orEmpty() + painterResource("grayscale_off.png") } FilterType.Pixel -> if (active) { - resource("pixel_on.png").rememberImageBitmap().orEmpty() + painterResource("pixel_on.png") } else { - resource("pixel_off.png").rememberImageBitmap().orEmpty() + painterResource("pixel_off.png") } FilterType.Blur -> if (active) { - resource("blur_on.png").rememberImageBitmap().orEmpty() + painterResource("blur_on.png") } else { - resource("blur_off.png").rememberImageBitmap().orEmpty() + painterResource("blur_off.png") } } } diff --git a/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/MainScreen.kt b/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/MainScreen.kt index 86deae0d47..71c8c87641 100755 --- a/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/MainScreen.kt +++ b/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/MainScreen.kt @@ -49,9 +49,7 @@ import example.imageviewer.model.bigUrl import example.imageviewer.style.ImageviewerColors import example.imageviewer.style.ImageviewerColors.kotlinHorizontalGradientBrush import org.jetbrains.compose.resources.ExperimentalResourceApi -import org.jetbrains.compose.resources.orEmpty -import org.jetbrains.compose.resources.rememberImageBitmap -import org.jetbrains.compose.resources.resource +import org.jetbrains.compose.resources.painterResource @Composable internal fun GalleryHeader() { @@ -217,7 +215,7 @@ private fun TitleBar(onRefresh: () -> Unit, onToggle: () -> Unit, dependencies: shape = CircleShape ) { Image( - bitmap = resource("list_view.png").rememberImageBitmap().orEmpty(), + painter = painterResource("list_view.png"), contentDescription = null, modifier = Modifier.size(35.dp).clickable { onToggle() @@ -230,7 +228,7 @@ private fun TitleBar(onRefresh: () -> Unit, onToggle: () -> Unit, dependencies: shape = CircleShape ) { Image( - bitmap = resource("refresh.png").rememberImageBitmap().orEmpty(), + painter = painterResource("refresh.png"), contentDescription = null, modifier = Modifier.size(35.dp).clickable { onRefresh() diff --git a/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/Miniature.kt b/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/Miniature.kt index a756581e48..83f36eaa49 100644 --- a/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/Miniature.kt +++ b/experimental/examples/imageviewer/shared/src/commonMain/kotlin/example/imageviewer/view/Miniature.kt @@ -28,9 +28,7 @@ import androidx.compose.ui.unit.dp import example.imageviewer.model.Picture import example.imageviewer.model.name import org.jetbrains.compose.resources.ExperimentalResourceApi -import org.jetbrains.compose.resources.orEmpty -import org.jetbrains.compose.resources.rememberImageBitmap -import org.jetbrains.compose.resources.resource +import org.jetbrains.compose.resources.painterResource @OptIn(ExperimentalResourceApi::class, ExperimentalMaterial3Api::class) @Composable @@ -77,7 +75,7 @@ internal fun Miniature( ) Image( - resource("dots.png").rememberImageBitmap().orEmpty(), + painterResource("dots.png"), contentDescription = null, modifier = Modifier.height(70.dp) .width(30.dp)