Browse Source

Fixed loading screen when click on miniature.

pull/24/head
Roman Sedaikin 4 years ago
parent
commit
f440b6ddee
  1. 2
      examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/model/ContentState.kt
  2. 34
      examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/MainScreen.kt

2
examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/model/ContentState.kt

@ -228,6 +228,7 @@ object ContentState {
val fullSizePicture = loadFullImage(picture.source) val fullSizePicture = loadFullImage(picture.source)
fullSizePicture.id = picture.id fullSizePicture.id = picture.id
wrapPictureIntoMainImage(fullSizePicture) wrapPictureIntoMainImage(fullSizePicture)
isAppUIReady.value = true
} }
} else { } else {
invokeLater { invokeLater {
@ -235,6 +236,7 @@ object ContentState {
"${ResString.noInternet}\n${ResString.loadImageUnavailable}" "${ResString.noInternet}\n${ResString.loadImageUnavailable}"
) )
wrapPictureIntoMainImage(picture) wrapPictureIntoMainImage(picture)
isAppUIReady.value = true
} }
} }
} }

34
examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/MainScreen.kt

@ -145,7 +145,8 @@ fun setTitleBar(text: String, content: ContentState) {
onExit = { onExit = {
refreshButtonHover.value = false refreshButtonHover.value = false
false false
}) }
)
.background(color = if (refreshButtonHover.value) TranslucentBlack else Transparent), .background(color = if (refreshButtonHover.value) TranslucentBlack else Transparent),
onClick = { onClick = {
if (content.isContentReady()) { if (content.isContentReady()) {
@ -169,7 +170,8 @@ fun setPreviewImageUI(content: ContentState) {
modifier = Modifier.background(color = DarkGray), modifier = Modifier.background(color = DarkGray),
onClick = { onClick = {
AppState.screenState(ScreenType.FullscreenImage) AppState.screenState(ScreenType.FullscreenImage)
}) { }
) {
Card( Card(
backgroundColor = Transparent, backgroundColor = Transparent,
modifier = Modifier.preferredHeight(250.dp), modifier = Modifier.preferredHeight(250.dp),
@ -217,9 +219,9 @@ fun setMiniatureUI(
) { ) {
Row(modifier = Modifier.padding(end = 30.dp)) { Row(modifier = Modifier.padding(end = 30.dp)) {
Clickable( Clickable(
onClick = { onClick = {
content.fullscreen(picture) content.fullscreen(picture)
} }
) { ) {
Image( Image(
Image.makeFromEncoded( Image.makeFromEncoded(
@ -243,17 +245,17 @@ fun setMiniatureUI(
Clickable( Clickable(
modifier = Modifier.preferredHeight(70.dp) modifier = Modifier.preferredHeight(70.dp)
.preferredWidth(30.dp) .preferredWidth(30.dp)
.hover( .hover(
onEnter = { onEnter = {
infoButtonHover.value = true infoButtonHover.value = true
false false
}, },
onExit = { onExit = {
infoButtonHover.value = false infoButtonHover.value = false
false false
}) })
.background(color = if (infoButtonHover.value) TranslucentWhite else Transparent), .background(color = if (infoButtonHover.value) TranslucentWhite else Transparent),
onClick = { onClick = {
showPopUpMessage( showPopUpMessage(
"${ResString.picture} " + "${ResString.picture} " +

Loading…
Cancel
Save