Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix select frame screen [#30] #93

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
package com.foke.together.presenter.screen

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.PageSize
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowForward
import androidx.compose.material3.Button
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
Expand All @@ -20,6 +23,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -50,8 +54,8 @@ fun SelectFrameScreen(
val (backKey, title, pager, frameSelectButton) = createRefs()
val topGuideLine = createGuidelineFromTop(0.1f)
val bottomGuideLine = createGuidelineFromBottom(0.1f)
val startGuideLine = createGuidelineFromStart(0.2f)
val endGuideLine = createGuidelineFromEnd(0.2f)
val startGuideLine = createGuidelineFromStart(0.1f)
val endGuideLine = createGuidelineFromEnd(0.1f)

IconButton(
onClick = { popBackStack() },
Expand Down Expand Up @@ -99,18 +103,46 @@ fun SelectFrameScreen(
state = pagerState,
pageSize = PageSize.Fill,
contentPadding = PaddingValues(
start = 25.dp,
end = 25.dp
start = 40.dp,
end = 40.dp
)
) { page ->
when(page){
CutFrameType.MAKER_FAIRE.ordinal -> Image(painter = painterResource(id = R.drawable.maker_faire_frame), contentDescription = "maker_faire_frame")
CutFrameType.FOURCUT_LIGHT.ordinal -> Image(painter = painterResource(id = R.drawable.fourcut_frame_medium_light), contentDescription = "fourcut_frame_medium_light")
CutFrameType.FOURCUT_DARK.ordinal -> Image(painter = painterResource(id = R.drawable.fourcut_frame_medium_dark), contentDescription = "fourcut_frame_medium_dark")
CutFrameType.MAKER_FAIRE.ordinal -> {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.clickable {
viewModel.setCutFrameType(pagerState.currentPage)
navigateToMethod()
}
) { Image(painter = painterResource(id = R.drawable.maker_faire_frame), contentDescription = "maker_faire_frame") }
}
CutFrameType.FOURCUT_LIGHT.ordinal -> {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.clickable {
viewModel.setCutFrameType(pagerState.currentPage)
navigateToMethod()
}

) { Image(painter = painterResource(id = R.drawable.fourcut_frame_medium_light), contentDescription = "fourcut_frame_medium_light") }
}
CutFrameType.FOURCUT_DARK.ordinal -> {
Box(
modifier = Modifier
.clickable {
viewModel.setCutFrameType(pagerState.currentPage)
navigateToMethod()
},
contentAlignment = Alignment.Center
) { Image(painter = painterResource(id = R.drawable.fourcut_frame_medium_dark), contentDescription = "fourcut_frame_medium_dark") }
}
}
}

IconButton(
Button(
onClick = {
viewModel.setCutFrameType(pagerState.currentPage)
navigateToMethod()
Expand All @@ -122,13 +154,13 @@ fun SelectFrameScreen(
bottom.linkTo(bottomGuideLine)
height = Dimension.wrapContent
width = Dimension.wrapContent
},
}.width(200.dp),
) {
Icon(
modifier = Modifier.size(85.dp),
imageVector = Icons.AutoMirrored.Filled.ArrowForward,
contentDescription = "Camera Navigation Button Icon",
tint = MaterialTheme.colorScheme.primary
Text(
text = stringResource(id = R.string.select_frame_button_next),
style = MaterialTheme.typography.displayLarge,
fontWeight = FontWeight.Bold,
fontSize = 36.sp
)
}
}
Expand Down