|
|
@ -15,7 +15,12 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package example.imageviewer.view |
|
|
|
package example.imageviewer.view |
|
|
|
|
|
|
|
|
|
|
|
import androidx.compose.foundation.* |
|
|
|
import androidx.compose.foundation.clickable |
|
|
|
|
|
|
|
import androidx.compose.foundation.background |
|
|
|
|
|
|
|
import androidx.compose.foundation.Box |
|
|
|
|
|
|
|
import androidx.compose.foundation.Text |
|
|
|
|
|
|
|
import androidx.compose.foundation.Image |
|
|
|
|
|
|
|
import androidx.compose.foundation.ScrollableColumn |
|
|
|
import androidx.compose.runtime.Composable |
|
|
|
import androidx.compose.runtime.Composable |
|
|
|
import androidx.compose.ui.Alignment |
|
|
|
import androidx.compose.ui.Alignment |
|
|
|
import androidx.compose.ui.graphics.RectangleShape |
|
|
|
import androidx.compose.ui.graphics.RectangleShape |
|
|
@ -53,6 +58,10 @@ import example.imageviewer.style.DarkGray |
|
|
|
import example.imageviewer.style.DarkGreen |
|
|
|
import example.imageviewer.style.DarkGreen |
|
|
|
import example.imageviewer.style.Foreground |
|
|
|
import example.imageviewer.style.Foreground |
|
|
|
import example.imageviewer.style.Transparent |
|
|
|
import example.imageviewer.style.Transparent |
|
|
|
|
|
|
|
import example.imageviewer.style.TranslucentBlack |
|
|
|
|
|
|
|
import example.imageviewer.style.TranslucentWhite |
|
|
|
|
|
|
|
import example.imageviewer.style.PreviewImageAreaHoverColor |
|
|
|
|
|
|
|
import example.imageviewer.style.MiniatureHoverColor |
|
|
|
import example.imageviewer.style.MiniatureColor |
|
|
|
import example.imageviewer.style.MiniatureColor |
|
|
|
import example.imageviewer.style.LightGray |
|
|
|
import example.imageviewer.style.LightGray |
|
|
|
import example.imageviewer.style.icRefresh |
|
|
|
import example.imageviewer.style.icRefresh |
|
|
@ -112,7 +121,7 @@ fun setTopContent(content: ContentState) { |
|
|
|
|
|
|
|
|
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
fun setTitleBar(text: String, content: ContentState) { |
|
|
|
fun setTitleBar(text: String, content: ContentState) { |
|
|
|
|
|
|
|
val refreshButtonHover = remember { mutableStateOf(false) } |
|
|
|
TopAppBar( |
|
|
|
TopAppBar( |
|
|
|
backgroundColor = DarkGreen, |
|
|
|
backgroundColor = DarkGreen, |
|
|
|
title = { |
|
|
|
title = { |
|
|
@ -128,6 +137,16 @@ fun setTitleBar(text: String, content: ContentState) { |
|
|
|
shape = CircleShape |
|
|
|
shape = CircleShape |
|
|
|
) { |
|
|
|
) { |
|
|
|
Clickable( |
|
|
|
Clickable( |
|
|
|
|
|
|
|
modifier = Modifier.hover( |
|
|
|
|
|
|
|
onEnter = { |
|
|
|
|
|
|
|
refreshButtonHover.value = true |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onExit = { |
|
|
|
|
|
|
|
refreshButtonHover.value = false |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.background(color = if (refreshButtonHover.value) TranslucentBlack else Transparent), |
|
|
|
onClick = { |
|
|
|
onClick = { |
|
|
|
if (content.isContentReady()) |
|
|
|
if (content.isContentReady()) |
|
|
|
content.refresh() |
|
|
|
content.refresh() |
|
|
@ -144,12 +163,23 @@ fun setTitleBar(text: String, content: ContentState) { |
|
|
|
|
|
|
|
|
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
fun setPreviewImageUI(content: ContentState) { |
|
|
|
fun setPreviewImageUI(content: ContentState) { |
|
|
|
|
|
|
|
val previewImageHover = remember { mutableStateOf(false) } |
|
|
|
Clickable(onClick = { |
|
|
|
Clickable( |
|
|
|
|
|
|
|
modifier = Modifier.hover( |
|
|
|
|
|
|
|
onEnter = { |
|
|
|
|
|
|
|
previewImageHover.value = true |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onExit = { |
|
|
|
|
|
|
|
previewImageHover.value = false |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.background(color = if (previewImageHover.value) PreviewImageAreaHoverColor else DarkGray), |
|
|
|
|
|
|
|
onClick = { |
|
|
|
AppState.screenState(ScreenType.FullscreenImage) |
|
|
|
AppState.screenState(ScreenType.FullscreenImage) |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
Card( |
|
|
|
Card( |
|
|
|
backgroundColor = DarkGray, |
|
|
|
backgroundColor = Transparent, |
|
|
|
modifier = Modifier.preferredHeight(250.dp), |
|
|
|
modifier = Modifier.preferredHeight(250.dp), |
|
|
|
shape = RectangleShape, |
|
|
|
shape = RectangleShape, |
|
|
|
elevation = 1.dp |
|
|
|
elevation = 1.dp |
|
|
@ -173,29 +203,28 @@ fun setMiniatureUI( |
|
|
|
picture: Picture, |
|
|
|
picture: Picture, |
|
|
|
content: ContentState |
|
|
|
content: ContentState |
|
|
|
) { |
|
|
|
) { |
|
|
|
val active = remember { mutableStateOf(false) } |
|
|
|
val cardHover = remember { mutableStateOf(false) } |
|
|
|
|
|
|
|
val infoButtonHover = remember { mutableStateOf(false) } |
|
|
|
Card( |
|
|
|
Card( |
|
|
|
backgroundColor = MiniatureColor, |
|
|
|
backgroundColor = if (cardHover.value) MiniatureHoverColor else MiniatureColor, |
|
|
|
modifier = Modifier.padding(start = 10.dp, end = 10.dp).preferredHeight(70.dp) |
|
|
|
modifier = Modifier.padding(start = 10.dp, end = 10.dp).preferredHeight(70.dp) |
|
|
|
.fillMaxWidth() |
|
|
|
.fillMaxWidth() |
|
|
|
|
|
|
|
.hover(onEnter = { |
|
|
|
|
|
|
|
cardHover.value = true |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onExit = { |
|
|
|
|
|
|
|
cardHover.value = false |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
}) |
|
|
|
.clickable { |
|
|
|
.clickable { |
|
|
|
content.setMainImage(picture) |
|
|
|
content.setMainImage(picture) |
|
|
|
}, |
|
|
|
}, |
|
|
|
shape = RectangleShape, |
|
|
|
shape = RectangleShape, |
|
|
|
elevation = 2.dp |
|
|
|
elevation = 20.dp |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
Row(modifier = Modifier.padding(end = 30.dp) |
|
|
|
) { |
|
|
|
) { |
|
|
|
Row(modifier = Modifier |
|
|
|
|
|
|
|
.padding(end = 30.dp) |
|
|
|
|
|
|
|
.maybePointerMoveFilter(onEnter = { |
|
|
|
|
|
|
|
active.value = true |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onExit = { |
|
|
|
|
|
|
|
active.value = false |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
.background(color = if (active.value) Color.LightGray else Color.Black)) { |
|
|
|
|
|
|
|
Clickable( |
|
|
|
Clickable( |
|
|
|
onClick = { |
|
|
|
onClick = { |
|
|
|
content.fullscreen(picture) |
|
|
|
content.fullscreen(picture) |
|
|
@ -213,18 +242,27 @@ fun setMiniatureUI( |
|
|
|
} |
|
|
|
} |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
text = picture.name, |
|
|
|
text = picture.name, |
|
|
|
color = if (active.value) Color.Red else Foreground, |
|
|
|
color = Foreground, |
|
|
|
modifier = Modifier |
|
|
|
modifier = Modifier |
|
|
|
.weight(1f) |
|
|
|
.weight(1f) |
|
|
|
.align(Alignment.CenterVertically) |
|
|
|
.align(Alignment.CenterVertically) |
|
|
|
.padding(start = 16.dp), |
|
|
|
.padding(start = 16.dp), |
|
|
|
fontSize = TextUnit.Sp(if (active.value) 40 else 16), |
|
|
|
|
|
|
|
style = MaterialTheme.typography.body1 |
|
|
|
style = MaterialTheme.typography.body1 |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
Clickable( |
|
|
|
Clickable( |
|
|
|
modifier = Modifier.preferredHeight(70.dp) |
|
|
|
modifier = Modifier.preferredHeight(70.dp) |
|
|
|
.preferredWidth(30.dp), |
|
|
|
.preferredWidth(30.dp) |
|
|
|
|
|
|
|
.hover( |
|
|
|
|
|
|
|
onEnter = { |
|
|
|
|
|
|
|
infoButtonHover.value = true |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onExit = { |
|
|
|
|
|
|
|
infoButtonHover.value = false |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.background(color = if (infoButtonHover.value) TranslucentWhite else Transparent), |
|
|
|
onClick = { |
|
|
|
onClick = { |
|
|
|
showPopUpMessage( |
|
|
|
showPopUpMessage( |
|
|
|
"${ResString.picture} " + |
|
|
|
"${ResString.picture} " + |
|
|
|