|
|
@ -15,22 +15,18 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package example.imageviewer.view |
|
|
|
package example.imageviewer.view |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.compose.foundation.* |
|
|
|
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 |
|
|
|
import androidx.compose.ui.graphics.asImageAsset |
|
|
|
import androidx.compose.ui.graphics.asImageAsset |
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.layout.ContentScale |
|
|
|
import androidx.compose.ui.layout.ContentScale |
|
|
|
import androidx.compose.foundation.clickable |
|
|
|
|
|
|
|
import androidx.compose.foundation.shape.CircleShape |
|
|
|
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.Column |
|
|
|
import androidx.compose.foundation.layout.Column |
|
|
|
import androidx.compose.foundation.layout.Row |
|
|
|
import androidx.compose.foundation.layout.Row |
|
|
|
import androidx.compose.foundation.layout.Spacer |
|
|
|
import androidx.compose.foundation.layout.Spacer |
|
|
|
import androidx.compose.foundation.layout.Stack |
|
|
|
import androidx.compose.foundation.layout.Stack |
|
|
|
import androidx.compose.foundation.Box |
|
|
|
|
|
|
|
import androidx.compose.foundation.layout.preferredHeight |
|
|
|
import androidx.compose.foundation.layout.preferredHeight |
|
|
|
import androidx.compose.foundation.layout.preferredWidth |
|
|
|
import androidx.compose.foundation.layout.preferredWidth |
|
|
|
import androidx.compose.foundation.layout.preferredSize |
|
|
|
import androidx.compose.foundation.layout.preferredSize |
|
|
@ -44,6 +40,10 @@ import androidx.compose.material.MaterialTheme |
|
|
|
import androidx.compose.material.TopAppBar |
|
|
|
import androidx.compose.material.TopAppBar |
|
|
|
import androidx.compose.material.Card |
|
|
|
import androidx.compose.material.Card |
|
|
|
import androidx.compose.material.Divider |
|
|
|
import androidx.compose.material.Divider |
|
|
|
|
|
|
|
import androidx.compose.runtime.mutableStateOf |
|
|
|
|
|
|
|
import androidx.compose.runtime.remember |
|
|
|
|
|
|
|
import androidx.compose.ui.graphics.Color |
|
|
|
|
|
|
|
import androidx.compose.ui.unit.TextUnit |
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
import example.imageviewer.model.AppState |
|
|
|
import example.imageviewer.model.AppState |
|
|
|
import example.imageviewer.model.Picture |
|
|
|
import example.imageviewer.model.Picture |
|
|
@ -173,7 +173,7 @@ fun setMiniatureUI( |
|
|
|
picture: Picture, |
|
|
|
picture: Picture, |
|
|
|
content: ContentState |
|
|
|
content: ContentState |
|
|
|
) { |
|
|
|
) { |
|
|
|
|
|
|
|
val active = remember { mutableStateOf(false) } |
|
|
|
Card( |
|
|
|
Card( |
|
|
|
backgroundColor = MiniatureColor, |
|
|
|
backgroundColor = 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) |
|
|
@ -184,7 +184,18 @@ fun setMiniatureUI( |
|
|
|
shape = RectangleShape, |
|
|
|
shape = RectangleShape, |
|
|
|
elevation = 2.dp |
|
|
|
elevation = 2.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) |
|
|
@ -202,8 +213,12 @@ fun setMiniatureUI( |
|
|
|
} |
|
|
|
} |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
text = picture.name, |
|
|
|
text = picture.name, |
|
|
|
color = Foreground, |
|
|
|
color = if (active.value) Color.Red else Foreground, |
|
|
|
modifier = Modifier.weight(1f).align(Alignment.CenterVertically).padding(start = 16.dp), |
|
|
|
modifier = Modifier |
|
|
|
|
|
|
|
.weight(1f) |
|
|
|
|
|
|
|
.align(Alignment.CenterVertically) |
|
|
|
|
|
|
|
.padding(start = 16.dp), |
|
|
|
|
|
|
|
fontSize = TextUnit.Sp(if (active.value) 40 else 16), |
|
|
|
style = MaterialTheme.typography.body1 |
|
|
|
style = MaterialTheme.typography.body1 |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|