|
|
|
@ -28,22 +28,26 @@ import androidx.compose.ui.graphics.Color
|
|
|
|
|
import androidx.compose.ui.graphics.ImageAsset |
|
|
|
|
import androidx.compose.ui.graphics.asImageAsset |
|
|
|
|
import androidx.compose.ui.layout.ContentScale |
|
|
|
|
import androidx.compose.material.CircularProgressIndicator |
|
|
|
|
import androidx.compose.material.MaterialTheme |
|
|
|
|
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.width |
|
|
|
|
import androidx.compose.foundation.layout.fillMaxSize |
|
|
|
|
import androidx.compose.foundation.layout.preferredHeight |
|
|
|
|
import androidx.compose.foundation.layout.preferredSize |
|
|
|
|
import androidx.compose.foundation.layout.padding |
|
|
|
|
import androidx.compose.foundation.layout.RowScope.gravity |
|
|
|
|
import androidx.compose.foundation.layout.RowScope.align |
|
|
|
|
import androidx.compose.material.Surface |
|
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
|
import example.imageviewer.core.FilterType |
|
|
|
|
import example.imageviewer.model.AppState |
|
|
|
|
import example.imageviewer.model.ContentState |
|
|
|
|
import example.imageviewer.model.ScreenType |
|
|
|
|
import example.imageviewer.style.DarkGreen |
|
|
|
|
import example.imageviewer.style.Foreground |
|
|
|
|
import example.imageviewer.style.MiniatureColor |
|
|
|
|
import example.imageviewer.style.Transparent |
|
|
|
@ -72,11 +76,30 @@ import java.awt.Rectangle
|
|
|
|
|
fun setImageFullScreen( |
|
|
|
|
content: ContentState |
|
|
|
|
) { |
|
|
|
|
|
|
|
|
|
if (content.isContentReady()) { |
|
|
|
|
Column { |
|
|
|
|
setToolBar(content.getSelectedImageName(), content) |
|
|
|
|
setImage(content) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
setLoadingScreen() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Composable |
|
|
|
|
private fun setLoadingScreen() { |
|
|
|
|
|
|
|
|
|
Stack { |
|
|
|
|
Surface(color = MiniatureColor, modifier = Modifier.preferredHeight(44.dp)) {} |
|
|
|
|
Box(modifier = Modifier.align(Alignment.Center)) { |
|
|
|
|
Surface(color = DarkGray, elevation = 4.dp, shape = CircleShape) { |
|
|
|
|
CircularProgressIndicator( |
|
|
|
|
modifier = Modifier.preferredSize(50.dp).padding(3.dp, 3.dp, 4.dp, 4.dp), |
|
|
|
|
color = DarkGreen |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Composable |
|
|
|
@ -89,7 +112,7 @@ fun setToolBar(
|
|
|
|
|
Row(modifier = Modifier.padding(end = 30.dp)) { |
|
|
|
|
Surface( |
|
|
|
|
color = Transparent, |
|
|
|
|
modifier = Modifier.padding(start = 20.dp).gravity(Alignment.CenterVertically), |
|
|
|
|
modifier = Modifier.padding(start = 20.dp).align(Alignment.CenterVertically), |
|
|
|
|
shape = CircleShape |
|
|
|
|
) { |
|
|
|
|
Clickable( |
|
|
|
@ -110,14 +133,14 @@ fun setToolBar(
|
|
|
|
|
color = Foreground, |
|
|
|
|
maxLines = 1, |
|
|
|
|
modifier = Modifier.padding(start = 30.dp).weight(1f) |
|
|
|
|
.gravity(Alignment.CenterVertically), |
|
|
|
|
.align(Alignment.CenterVertically), |
|
|
|
|
style = MaterialTheme.typography.body1 |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
Surface( |
|
|
|
|
color = Color(255, 255, 255, 40), |
|
|
|
|
modifier = Modifier.preferredSize(154.dp, 38.dp) |
|
|
|
|
.gravity(Alignment.CenterVertically), |
|
|
|
|
.align(Alignment.CenterVertically), |
|
|
|
|
shape = CircleShape |
|
|
|
|
) { |
|
|
|
|
ScrollableRow { |
|
|
|
@ -140,7 +163,7 @@ fun FilterButton(
|
|
|
|
|
) { |
|
|
|
|
Surface( |
|
|
|
|
color = Transparent, |
|
|
|
|
modifier = Modifier.gravity(Alignment.CenterVertically), |
|
|
|
|
modifier = Modifier.align(Alignment.CenterVertically), |
|
|
|
|
shape = CircleShape |
|
|
|
|
) { |
|
|
|
|
Clickable( |
|
|
|
|