Skip to content

Commit 257bdab

Browse files
authored
Merge branch 'FoKE-Developers:main' into main
2 parents c3f1010 + 620ecd0 commit 257bdab

File tree

11 files changed

+126
-48
lines changed

11 files changed

+126
-48
lines changed

data/src/main/java/com/foke/together/data/datasource/local/datastore/AppPreferencesSerializer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class AppPreferencesSerializer @Inject constructor(): Serializer<AppPreferences>
1515
// You need to check default value of each types from link below
1616
// https://protobuf.dev/programming-guides/proto3/
1717
// e.g. isDebugMode = true
18-
externalCameraIp = AppPolicy.DEFAULT_EXTERNAL_CAMERA_IP
18+
externalCameraIp = AppPolicy.EXTERNAL_CAMERA_DEFAULT_SERVER_URL
1919
build()
2020
}
2121

external/src/main/java/com/foke/together/external/camera/external/interceptor/BaseUrlInterceptor.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class BaseUrlInterceptor: Interceptor {
1919

2020
fun setBaseUrl(newBaseUrl: String) {
2121
baseUrl = newBaseUrl
22+
if (AppPolicy.isDebugMode) {
23+
AppLog.i(TAG, "setBaseUrl", "set to: $newBaseUrl")
24+
}
2225
try {
2326
val sep = newBaseUrl.indexOf("://")
2427
scheme = newBaseUrl.substring(0, sep)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import androidx.compose.material3.*
99
import androidx.compose.runtime.Composable
1010
import androidx.compose.ui.Modifier
1111
import androidx.compose.ui.res.painterResource
12+
import androidx.compose.ui.res.stringResource
1213
import androidx.compose.ui.text.font.FontWeight
1314
import androidx.compose.ui.tooling.preview.Preview
1415
import androidx.compose.ui.unit.dp
@@ -38,12 +39,12 @@ fun HomeScreen(
3839
id = R.drawable.fourcut_together
3940
),
4041
contentDescription = "FourCuts Together",
42+
4143
modifier = Modifier.constrainAs(play) {
4244
centerTo(parent)
4345
height = Dimension.wrapContent
4446
width = Dimension.wrapContent
4547
},
46-
4748
)
4849

4950
IconButton(
@@ -76,7 +77,7 @@ fun HomeScreen(
7677
}
7778
) {
7879
Text(
79-
text = "시작하기",
80+
text = stringResource(id = R.string.home_button_start),
8081
style = MaterialTheme.typography.displayLarge,
8182
fontWeight = FontWeight.Bold,
8283
fontSize = 36.sp

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

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
package com.foke.together.presenter.screen
22

33
import androidx.compose.foundation.Image
4+
import androidx.compose.foundation.clickable
5+
import androidx.compose.foundation.layout.Box
46
import androidx.compose.foundation.layout.PaddingValues
57
import androidx.compose.foundation.layout.aspectRatio
68
import androidx.compose.foundation.layout.fillMaxSize
79
import androidx.compose.foundation.layout.size
10+
import androidx.compose.foundation.layout.width
811
import androidx.compose.foundation.pager.HorizontalPager
912
import androidx.compose.foundation.pager.PageSize
1013
import androidx.compose.foundation.pager.rememberPagerState
1114
import androidx.compose.material.icons.Icons
1215
import androidx.compose.material.icons.automirrored.filled.ArrowBack
13-
import androidx.compose.material.icons.automirrored.filled.ArrowForward
16+
import androidx.compose.material3.Button
1417
import androidx.compose.material3.Icon
1518
import androidx.compose.material3.IconButton
1619
import androidx.compose.material3.MaterialTheme
@@ -20,6 +23,7 @@ import androidx.compose.runtime.Composable
2023
import androidx.compose.ui.Alignment
2124
import androidx.compose.ui.Modifier
2225
import androidx.compose.ui.res.painterResource
26+
import androidx.compose.ui.res.stringResource
2327
import androidx.compose.ui.text.font.FontWeight
2428
import androidx.compose.ui.tooling.preview.Preview
2529
import androidx.compose.ui.unit.dp
@@ -50,8 +54,8 @@ fun SelectFrameScreen(
5054
val (backKey, title, pager, frameSelectButton) = createRefs()
5155
val topGuideLine = createGuidelineFromTop(0.1f)
5256
val bottomGuideLine = createGuidelineFromBottom(0.1f)
53-
val startGuideLine = createGuidelineFromStart(0.2f)
54-
val endGuideLine = createGuidelineFromEnd(0.2f)
57+
val startGuideLine = createGuidelineFromStart(0.1f)
58+
val endGuideLine = createGuidelineFromEnd(0.1f)
5559

5660
IconButton(
5761
onClick = { popBackStack() },
@@ -99,18 +103,46 @@ fun SelectFrameScreen(
99103
state = pagerState,
100104
pageSize = PageSize.Fill,
101105
contentPadding = PaddingValues(
102-
start = 25.dp,
103-
end = 25.dp
106+
start = 40.dp,
107+
end = 40.dp
104108
)
105109
) { page ->
106110
when(page){
107-
CutFrameType.MAKER_FAIRE.ordinal -> Image(painter = painterResource(id = R.drawable.maker_faire_frame), contentDescription = "maker_faire_frame")
108-
CutFrameType.FOURCUT_LIGHT.ordinal -> Image(painter = painterResource(id = R.drawable.fourcut_frame_medium_light), contentDescription = "fourcut_frame_medium_light")
109-
CutFrameType.FOURCUT_DARK.ordinal -> Image(painter = painterResource(id = R.drawable.fourcut_frame_medium_dark), contentDescription = "fourcut_frame_medium_dark")
111+
CutFrameType.MAKER_FAIRE.ordinal -> {
112+
Box(
113+
contentAlignment = Alignment.Center,
114+
modifier = Modifier
115+
.clickable {
116+
viewModel.setCutFrameType(pagerState.currentPage)
117+
navigateToMethod()
118+
}
119+
) { Image(painter = painterResource(id = R.drawable.maker_faire_frame), contentDescription = "maker_faire_frame") }
120+
}
121+
CutFrameType.FOURCUT_LIGHT.ordinal -> {
122+
Box(
123+
contentAlignment = Alignment.Center,
124+
modifier = Modifier
125+
.clickable {
126+
viewModel.setCutFrameType(pagerState.currentPage)
127+
navigateToMethod()
128+
}
129+
130+
) { Image(painter = painterResource(id = R.drawable.fourcut_frame_medium_light), contentDescription = "fourcut_frame_medium_light") }
131+
}
132+
CutFrameType.FOURCUT_DARK.ordinal -> {
133+
Box(
134+
modifier = Modifier
135+
.clickable {
136+
viewModel.setCutFrameType(pagerState.currentPage)
137+
navigateToMethod()
138+
},
139+
contentAlignment = Alignment.Center
140+
) { Image(painter = painterResource(id = R.drawable.fourcut_frame_medium_dark), contentDescription = "fourcut_frame_medium_dark") }
141+
}
110142
}
111143
}
112144

113-
IconButton(
145+
Button(
114146
onClick = {
115147
viewModel.setCutFrameType(pagerState.currentPage)
116148
navigateToMethod()
@@ -122,13 +154,13 @@ fun SelectFrameScreen(
122154
bottom.linkTo(bottomGuideLine)
123155
height = Dimension.wrapContent
124156
width = Dimension.wrapContent
125-
},
157+
}.width(200.dp),
126158
) {
127-
Icon(
128-
modifier = Modifier.size(85.dp),
129-
imageVector = Icons.AutoMirrored.Filled.ArrowForward,
130-
contentDescription = "Camera Navigation Button Icon",
131-
tint = MaterialTheme.colorScheme.primary
159+
Text(
160+
text = stringResource(id = R.string.select_frame_button_next),
161+
style = MaterialTheme.typography.displayLarge,
162+
fontWeight = FontWeight.Bold,
163+
fontSize = 36.sp
132164
)
133165
}
134166
}

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
}

presenter/src/main/res/drawable/fourcut_together.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
android:viewportHeight="48">
66
<path
77
android:pathData="M2.449,8.8V6.599C4.578,6.599 6.035,6.326 6.803,5.761C7.571,5.197 7.973,4.203 8.012,2.78H2.449V0.559H12.23V2.78C11.885,6.21 10.044,8.158 6.668,8.605C5.555,8.742 4.539,8.82 3.637,8.82L2.449,8.8ZM2.89,17.627V9.717H17.792V11.938H7.09V12.6H17.792V14.783H7.09V15.406H17.792V17.627H2.89ZM13.42,9.054V0.423H17.793V3.248H19.98V5.917H17.793V9.054H13.42Z"
8-
android:fillColor="@color/md_theme_primary"/>
8+
android:fillColor="@color/app_primary_color"/>
99
<path
1010
android:pathData="M33.327,16.925C32.847,16.769 32.387,16.535 31.984,16.185C31.562,15.814 31.198,15.328 30.91,14.703C30.603,14.08 30.373,13.281 30.201,12.307C30.028,11.333 29.951,10.163 29.951,8.78C29.951,5.02 30.622,2.565 31.984,1.396C32.713,0.753 33.691,0.441 34.899,0.441C35.437,0.441 35.973,0.519 36.453,0.656C36.951,0.792 37.412,1.046 37.815,1.396C38.238,1.747 38.582,2.233 38.89,2.877C39.197,3.5 39.427,4.299 39.599,5.273C39.772,6.228 39.848,7.397 39.848,8.781C39.848,12.56 39.178,15.015 37.815,16.185C37.087,16.808 36.109,17.12 34.9,17.12C34.343,17.12 33.826,17.061 33.327,16.925ZM35.283,14.197C35.418,14.139 35.533,14.002 35.648,13.807C35.744,13.593 35.84,13.301 35.936,12.892C36.013,12.482 36.09,11.957 36.128,11.295C36.186,10.633 36.205,9.794 36.205,8.781C36.205,6.132 36.013,4.455 35.649,3.774C35.457,3.442 35.208,3.267 34.901,3.267C34.767,3.267 34.632,3.306 34.517,3.364C34.383,3.442 34.268,3.559 34.153,3.774C34.037,3.969 33.941,4.28 33.864,4.689C33.769,5.08 33.711,5.625 33.653,6.287C33.615,6.949 33.596,7.787 33.596,8.781C33.596,11.43 33.769,13.106 34.152,13.807C34.343,14.139 34.592,14.295 34.899,14.295C35.035,14.295 35.15,14.275 35.283,14.197ZM41.153,17.627V0.423H45.526V17.627H41.153Z"
11-
android:fillColor="@color/md_theme_primary"/>
11+
android:fillColor="@color/app_primary_color"/>
1212
<path
1313
android:pathData="M2.459,30.503H5.777V44.2L10.399,43.927V46.519L2.459,46.967V30.503ZM11.415,47.454V39.213H8.673V36.544H11.415V30.426H14.772V47.454H11.415ZM15.597,47.551V30.347H18.973V47.55H15.597V47.551Z"
14-
android:fillColor="@color/md_theme_primary"/>
14+
android:fillColor="@color/app_primary_color"/>
1515
<path
1616
android:pathData="M40.932,40.79V36.952H38.419C37.307,38.53 35.85,39.504 34.065,39.894C32.262,40.284 30.823,40.478 29.711,40.478V38.062C32.357,38.062 34.084,37.594 34.928,36.659H29.711V34.262H36.021C36.098,33.852 36.117,33.386 36.137,32.917H29.711V30.482H39.473V32.917C39.473,33.405 39.435,33.853 39.358,34.282H40.93V30.347H45.304V40.79H40.932ZM37.748,44.395C35.619,46.46 33.05,47.493 30.058,47.493V44.96C31.151,44.96 32.11,44.667 32.954,44.064C33.778,43.479 34.431,42.836 34.891,42.174C35.352,41.512 35.6,41.063 35.6,40.829H39.877C39.877,41.063 40.127,41.511 40.606,42.174C41.086,42.836 41.738,43.479 42.581,44.064C43.444,44.667 44.403,44.96 45.516,44.96V47.493C42.505,47.493 39.916,46.46 37.748,44.395Z"
17-
android:fillColor="@color/md_theme_primary"/>
17+
android:fillColor="@color/app_primary_color"/>
1818
<path
1919
android:pathData="M48,26.004H26.133V48H21.973V26.004H0V21.779H21.973V0H26.133V21.779H48V26.004Z"
20-
android:fillColor="@color/md_theme_primary"/>
20+
android:fillColor="@color/app_primary_color"/>
2121
</vector>

presenter/src/main/res/values/colors.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<resources>
2+
<color name="app_primary_color">#00A3A6</color>
3+
24
<!-- TODO. check to remove xml files -->
35
<color name="md_theme_primary">#00696B</color>
46
<color name="md_theme_onPrimary">#FFFFFF</color>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
<resources>
22
<string name="app_name">presenter</string>
3+
4+
<string name="home_button_start">시작하기</string>
5+
<string name="select_frame_button_next">&#160;&#160;선택 〉</string>
6+
7+
<string name="select_method_timer_button_icon">🕑</string>
8+
<string name="select_method_timer_button_text">Timer</string>
9+
<string name="select_method_gesture_button_icon">👋</string>
10+
<string name="select_method_gesture_button_text">Gesture</string>
11+
<string name="select_method_gesture_button_toast">준비중입니다.</string>
12+
13+
<string name="camera_exclamation_text">촬영 시 움직이지 마세요</string>
314
</resources>

util/src/main/java/com/foke/together/util/AppPolicy.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,26 @@ package com.foke.together.util
33
object AppPolicy {
44
const val isDebugMode = true
55

6-
const val DEFAULT_EXTERNAL_CAMERA_IP = "192.168.0.71:5000"
7-
86
// network
97
const val WEB_SERVER_URL = "https://4cuts.store/"
108
const val WEB_CONNECT_TIMEOUT = 10L
119
const val WEB_READ_TIMEOUT = 10L
1210
const val WEB_WRITE_TIMEOUT = 10L
1311
const val WEB_FILE_MAX_CONTENT_LENGTH = 20971520
1412

15-
const val EXTERNAL_CAMERA_DEFAULT_SERVER_URL = "http://192.168.0.71:5000"
13+
const val EXTERNAL_CAMERA_DEFAULT_SERVER_URL = "http://0.0.0.0"
1614
const val EXTERNAL_CAMERA_CONNECT_TIMEOUT = 10L
1715
const val EXTERNAL_CAMERA_READ_TIMEOUT = 10L
1816
const val EXTERNAL_CAMERA_WRITE_TIMEOUT = 10L
1917

18+
// capture settings
2019
const val CAPTURE_INTERVAL = 10000L
2120
const val CAPTURE_COUNT = 4
2221
const val COUNTDOWN_INTERVAL = 10L
2322

23+
// file settings
2424
const val CAPTURED_FOUR_CUT_IMAGE_NAME = "capture"
2525
const val SINGLE_ROW_FINAL_IMAGE_NAME = "final_single_row"
2626
const val TWO_ROW_FINAL_IMAGE_NAME = "final_two_row"
27-
2827
const val DEFAULT_QR_CODE_IMAGE_NAME = "qrcode"
2928
}

util/src/main/java/com/foke/together/util/TimeUtil.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import java.util.Date
66
object TimeUtil {
77
fun getCurrentDisplayTime(): String {
88
val dateFormat = "yyyy.MM.dd"
9+
// TODO: LocalDate로 변경
910
val date = Date(System.currentTimeMillis())
1011
val simpleDateFormat = SimpleDateFormat(dateFormat)
1112
val simpleDate: String = simpleDateFormat.format(date)

0 commit comments

Comments
 (0)