|
|
|
@ -29,22 +29,27 @@ import androidx.compose.foundation.shape.CircleShape
|
|
|
|
|
import androidx.compose.ui.graphics.Color |
|
|
|
|
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.Column |
|
|
|
|
import androidx.compose.foundation.layout.Row |
|
|
|
|
import androidx.compose.foundation.layout.Spacer |
|
|
|
|
import androidx.compose.foundation.layout.Stack |
|
|
|
|
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.DarkGray |
|
|
|
|
import example.imageviewer.style.DarkGreen |
|
|
|
|
import example.imageviewer.style.Foreground |
|
|
|
|
import example.imageviewer.style.MiniatureColor |
|
|
|
|
import example.imageviewer.style.Transparent |
|
|
|
@ -56,7 +61,6 @@ import example.imageviewer.style.icFilterPixelOff
|
|
|
|
|
import example.imageviewer.style.icFilterBlurOn |
|
|
|
|
import example.imageviewer.style.icFilterBlurOff |
|
|
|
|
import example.imageviewer.style.icFilterUnknown |
|
|
|
|
import example.imageviewer.style.DarkGray |
|
|
|
|
import example.imageviewer.utils.displayHeight |
|
|
|
|
import example.imageviewer.utils.displayWidth |
|
|
|
|
import example.imageviewer.utils.getDisplayBounds |
|
|
|
@ -69,11 +73,30 @@ import kotlin.math.roundToInt
|
|
|
|
|
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 |
|
|
|
@ -86,7 +109,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( |
|
|
|
@ -107,14 +130,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 { |
|
|
|
@ -133,11 +156,11 @@ fun setToolBar(
|
|
|
|
|
fun FilterButton( |
|
|
|
|
content: ContentState, |
|
|
|
|
type: FilterType, |
|
|
|
|
modifier: Modifier = Modifier.gravity(Alignment.CenterVertically).preferredSize(38.dp) |
|
|
|
|
modifier: Modifier = Modifier.align(Alignment.CenterVertically).preferredSize(38.dp) |
|
|
|
|
) { |
|
|
|
|
Surface( |
|
|
|
|
color = Transparent, |
|
|
|
|
modifier = Modifier.gravity(Alignment.CenterVertically), |
|
|
|
|
modifier = Modifier.align(Alignment.CenterVertically), |
|
|
|
|
shape = CircleShape |
|
|
|
|
) { |
|
|
|
|
Clickable( |
|
|
|
|