From 79ddbaf7bdd5d60329a601504c48a4472d140067 Mon Sep 17 00:00:00 2001 From: Roman Sedaikin Date: Tue, 20 Oct 2020 16:01:37 +0300 Subject: [PATCH] Updated android application to new version of compose api. --- .../example/imageviewer/view/FullImageScreen.kt | 16 ++++++++-------- .../example/imageviewer/view/MainScreen.kt | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/FullImageScreen.kt b/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/FullImageScreen.kt index d3d42714d9..9ecf10f680 100755 --- a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/FullImageScreen.kt +++ b/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/FullImageScreen.kt @@ -18,8 +18,10 @@ package example.imageviewer.view import android.content.res.Configuration import android.graphics.Bitmap import android.graphics.Rect +import androidx.compose.foundation.background import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment +import androidx.compose.ui.draw.clip import androidx.compose.ui.Modifier import androidx.compose.foundation.clickable import androidx.compose.foundation.ScrollableRow @@ -31,7 +33,7 @@ import androidx.compose.ui.graphics.ImageAsset import androidx.compose.ui.graphics.asImageAsset import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.MaterialTheme -import androidx.compose.foundation.Box +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -85,9 +87,9 @@ fun setImageFullScreen( @Composable private fun setLoadingScreen() { - Stack { + Box { Surface(color = MiniatureColor, modifier = Modifier.preferredHeight(44.dp)) {} - Box() { + Box { Surface(color = DarkGray, elevation = 4.dp, shape = CircleShape) { CircularProgressIndicator( modifier = Modifier.preferredSize(50.dp).padding(3.dp, 3.dp, 4.dp, 4.dp), @@ -155,12 +157,10 @@ fun setToolBar( fun FilterButton( content: ContentState, type: FilterType, - modifier: Modifier = Modifier.align(Alignment.CenterVertically).preferredSize(38.dp) + modifier: Modifier = Modifier.preferredSize(38.dp) ) { - Surface( - color = Transparent, - modifier = Modifier.align(Alignment.CenterVertically), - shape = CircleShape + Box( + modifier = Modifier.background(color = Transparent).clip(CircleShape) ) { Clickable( onClick = { content.toggleFilter(type) } diff --git a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/MainScreen.kt b/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/MainScreen.kt index ecfe17d877..95092cd3c9 100755 --- a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/MainScreen.kt +++ b/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/MainScreen.kt @@ -21,11 +21,11 @@ import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.ScrollableColumn import androidx.compose.foundation.Text import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Stack -import androidx.compose.foundation.Box import androidx.compose.foundation.layout.preferredHeight import androidx.compose.foundation.layout.preferredWidth import androidx.compose.foundation.layout.preferredSize @@ -78,7 +78,7 @@ fun setMainScreen(content: ContentState) { @Composable fun setLoadingScreen(content: ContentState) { - Stack { + Box { Column { setTopContent(content) }