Skip to content

Commit 7d7e475

Browse files
committed
fix select method scree [#43]
1 parent f4c3550 commit 7d7e475

File tree

1 file changed

+42
-20
lines changed

1 file changed

+42
-20
lines changed

presenter/src/main/java/com/foke/together/presenter/screen/SelectMethodScreen.kt

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.foke.together.presenter.screen
22

3+
import android.widget.Toast
34
import androidx.compose.foundation.BorderStroke
5+
import androidx.compose.foundation.layout.Column
46
import androidx.compose.foundation.layout.fillMaxSize
7+
import androidx.compose.foundation.layout.height
58
import androidx.compose.foundation.layout.size
69
import androidx.compose.foundation.shape.RoundedCornerShape
710
import androidx.compose.material.icons.Icons
@@ -13,14 +16,19 @@ import androidx.compose.material3.OutlinedButton
1316
import androidx.compose.material3.Surface
1417
import androidx.compose.material3.Text
1518
import androidx.compose.runtime.Composable
19+
import androidx.compose.ui.Alignment
1620
import androidx.compose.ui.Modifier
21+
import androidx.compose.ui.platform.LocalContext
22+
import androidx.compose.ui.res.stringResource
1723
import androidx.compose.ui.text.font.FontWeight
24+
import androidx.compose.ui.text.style.TextAlign
1825
import androidx.compose.ui.tooling.preview.Preview
1926
import androidx.compose.ui.unit.dp
2027
import androidx.compose.ui.unit.sp
2128
import androidx.constraintlayout.compose.ConstraintLayout
2229
import androidx.constraintlayout.compose.Dimension
2330
import androidx.hilt.navigation.compose.hiltViewModel
31+
import com.foke.together.presenter.R
2432
import com.foke.together.presenter.theme.FourCutTogetherTheme
2533
import com.foke.together.presenter.viewmodel.SelectMethodViewModel
2634

@@ -33,7 +41,10 @@ fun SelectMethodScreen(
3341
ConstraintLayout(
3442
modifier = Modifier.fillMaxSize()
3543
) {
44+
val context = LocalContext.current
45+
3646
val (backKey, title, timerButton, gestureButton) = createRefs()
47+
3748
val topGuideLine = createGuidelineFromTop(0.1f)
3849
val bottomGuideLine = createGuidelineFromBottom(0.1f)
3950
val startGuideLine = createGuidelineFromStart(0.2f)
@@ -72,36 +83,47 @@ fun SelectMethodScreen(
7283

7384
OutlinedButton(
7485
onClick = { navigateToCamera() },
75-
modifier = Modifier.constrainAs(timerButton) {
76-
top.linkTo(title.bottom)
77-
start.linkTo(startGuideLine)
78-
end.linkTo(endGuideLine)
79-
bottom.linkTo(gestureButton.top)
80-
width = Dimension.fillToConstraints
81-
height = Dimension.fillToConstraints
82-
},
86+
modifier = Modifier
87+
.constrainAs(timerButton) {
88+
top.linkTo(title.bottom)
89+
start.linkTo(startGuideLine)
90+
end.linkTo(endGuideLine)
91+
bottom.linkTo(gestureButton.top)
92+
width = Dimension.fillToConstraints
93+
height = Dimension.wrapContent
94+
}
95+
.height(200.dp),
8396
shape = RoundedCornerShape(24.dp),
8497
border = BorderStroke(3.dp, MaterialTheme.colorScheme.primary)
8598
) {
86-
Text(text = "Timer", style = MaterialTheme.typography.titleLarge)
87-
Text(text = "\uFE0F", style = MaterialTheme.typography.titleLarge)
99+
Column(horizontalAlignment = Alignment.CenterHorizontally) {
100+
Text(text = stringResource(id = R.string.select_method_timer_button_icon), style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center, fontSize = 60.sp)
101+
Text(text = stringResource(id = R.string.select_method_timer_button_text), style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center, fontSize = 36.sp)
102+
}
88103
}
89104

90105
OutlinedButton(
91-
onClick = { navigateToCamera() },
92-
modifier = Modifier.constrainAs(gestureButton) {
93-
top.linkTo(timerButton.bottom)
94-
start.linkTo(startGuideLine)
95-
end.linkTo(endGuideLine)
96-
bottom.linkTo(bottomGuideLine)
97-
width = Dimension.fillToConstraints
98-
height = Dimension.fillToConstraints
106+
onClick = {
107+
// TODO: implement gesture function
108+
Toast.makeText(context, context.getString(R.string.select_method_gesture_button_toast), Toast.LENGTH_SHORT).show()
99109
},
110+
modifier = Modifier
111+
.constrainAs(gestureButton) {
112+
top.linkTo(timerButton.bottom)
113+
start.linkTo(startGuideLine)
114+
end.linkTo(endGuideLine)
115+
bottom.linkTo(bottomGuideLine)
116+
width = Dimension.fillToConstraints
117+
height = Dimension.wrapContent
118+
}
119+
.height(200.dp),
100120
shape = RoundedCornerShape(24.dp),
101121
border = BorderStroke(3.dp, MaterialTheme.colorScheme.primary)
102122
) {
103-
Text(text = "Gesture", style = MaterialTheme.typography.titleLarge)
104-
Text(text = "\uD83D\uDC4B", style = MaterialTheme.typography.titleLarge)
123+
Column(horizontalAlignment = Alignment.CenterHorizontally) {
124+
Text(text = stringResource(id = R.string.select_method_gesture_button_icon), style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center, fontSize = 60.sp)
125+
Text(text = stringResource(id = R.string.select_method_gesture_button_text), style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center, fontSize = 36.sp)
126+
}
105127
}
106128
}
107129
}

0 commit comments

Comments
 (0)