Skip to content

Commit

Permalink
Merge branch 'FoKE-Developers:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
fetiu authored Oct 11, 2024
2 parents c3f1010 + 620ecd0 commit 257bdab
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AppPreferencesSerializer @Inject constructor(): Serializer<AppPreferences>
// You need to check default value of each types from link below
// https://protobuf.dev/programming-guides/proto3/
// e.g. isDebugMode = true
externalCameraIp = AppPolicy.DEFAULT_EXTERNAL_CAMERA_IP
externalCameraIp = AppPolicy.EXTERNAL_CAMERA_DEFAULT_SERVER_URL
build()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class BaseUrlInterceptor: Interceptor {

fun setBaseUrl(newBaseUrl: String) {
baseUrl = newBaseUrl
if (AppPolicy.isDebugMode) {
AppLog.i(TAG, "setBaseUrl", "set to: $newBaseUrl")
}
try {
val sep = newBaseUrl.indexOf("://")
scheme = newBaseUrl.substring(0, sep)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.material3.*
import androidx.compose.runtime.Composable
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 @@ -38,12 +39,12 @@ fun HomeScreen(
id = R.drawable.fourcut_together
),
contentDescription = "FourCuts Together",

modifier = Modifier.constrainAs(play) {
centerTo(parent)
height = Dimension.wrapContent
width = Dimension.wrapContent
},

)

IconButton(
Expand Down Expand Up @@ -76,7 +77,7 @@ fun HomeScreen(
}
) {
Text(
text = "시작하기",
text = stringResource(id = R.string.home_button_start),
style = MaterialTheme.typography.displayLarge,
fontWeight = FontWeight.Bold,
fontSize = 36.sp
Expand Down
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.foke.together.presenter.screen

import android.widget.Toast
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
Expand All @@ -13,14 +16,19 @@ import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.constraintlayout.compose.ConstraintLayout
import androidx.constraintlayout.compose.Dimension
import androidx.hilt.navigation.compose.hiltViewModel
import com.foke.together.presenter.R
import com.foke.together.presenter.theme.FourCutTogetherTheme
import com.foke.together.presenter.viewmodel.SelectMethodViewModel

Expand All @@ -33,7 +41,10 @@ fun SelectMethodScreen(
ConstraintLayout(
modifier = Modifier.fillMaxSize()
) {
val context = LocalContext.current

val (backKey, title, timerButton, gestureButton) = createRefs()

val topGuideLine = createGuidelineFromTop(0.1f)
val bottomGuideLine = createGuidelineFromBottom(0.1f)
val startGuideLine = createGuidelineFromStart(0.2f)
Expand Down Expand Up @@ -72,36 +83,47 @@ fun SelectMethodScreen(

OutlinedButton(
onClick = { navigateToCamera() },
modifier = Modifier.constrainAs(timerButton) {
top.linkTo(title.bottom)
start.linkTo(startGuideLine)
end.linkTo(endGuideLine)
bottom.linkTo(gestureButton.top)
width = Dimension.fillToConstraints
height = Dimension.fillToConstraints
},
modifier = Modifier
.constrainAs(timerButton) {
top.linkTo(title.bottom)
start.linkTo(startGuideLine)
end.linkTo(endGuideLine)
bottom.linkTo(gestureButton.top)
width = Dimension.fillToConstraints
height = Dimension.wrapContent
}
.height(200.dp),
shape = RoundedCornerShape(24.dp),
border = BorderStroke(3.dp, MaterialTheme.colorScheme.primary)
) {
Text(text = "Timer", style = MaterialTheme.typography.titleLarge)
Text(text = "\uFE0F", style = MaterialTheme.typography.titleLarge)
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text(text = stringResource(id = R.string.select_method_timer_button_icon), style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center, fontSize = 60.sp)
Text(text = stringResource(id = R.string.select_method_timer_button_text), style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center, fontSize = 36.sp)
}
}

OutlinedButton(
onClick = { navigateToCamera() },
modifier = Modifier.constrainAs(gestureButton) {
top.linkTo(timerButton.bottom)
start.linkTo(startGuideLine)
end.linkTo(endGuideLine)
bottom.linkTo(bottomGuideLine)
width = Dimension.fillToConstraints
height = Dimension.fillToConstraints
onClick = {
// TODO: implement gesture function
Toast.makeText(context, context.getString(R.string.select_method_gesture_button_toast), Toast.LENGTH_SHORT).show()
},
modifier = Modifier
.constrainAs(gestureButton) {
top.linkTo(timerButton.bottom)
start.linkTo(startGuideLine)
end.linkTo(endGuideLine)
bottom.linkTo(bottomGuideLine)
width = Dimension.fillToConstraints
height = Dimension.wrapContent
}
.height(200.dp),
shape = RoundedCornerShape(24.dp),
border = BorderStroke(3.dp, MaterialTheme.colorScheme.primary)
) {
Text(text = "Gesture", style = MaterialTheme.typography.titleLarge)
Text(text = "\uD83D\uDC4B", style = MaterialTheme.typography.titleLarge)
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text(text = stringResource(id = R.string.select_method_gesture_button_icon), style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center, fontSize = 60.sp)
Text(text = stringResource(id = R.string.select_method_gesture_button_text), style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center, fontSize = 36.sp)
}
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions presenter/src/main/res/drawable/fourcut_together.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
android:viewportHeight="48">
<path
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"
android:fillColor="@color/md_theme_primary"/>
android:fillColor="@color/app_primary_color"/>
<path
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"
android:fillColor="@color/md_theme_primary"/>
android:fillColor="@color/app_primary_color"/>
<path
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"
android:fillColor="@color/md_theme_primary"/>
android:fillColor="@color/app_primary_color"/>
<path
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"
android:fillColor="@color/md_theme_primary"/>
android:fillColor="@color/app_primary_color"/>
<path
android:pathData="M48,26.004H26.133V48H21.973V26.004H0V21.779H21.973V0H26.133V21.779H48V26.004Z"
android:fillColor="@color/md_theme_primary"/>
android:fillColor="@color/app_primary_color"/>
</vector>
2 changes: 2 additions & 0 deletions presenter/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<resources>
<color name="app_primary_color">#00A3A6</color>

<!-- TODO. check to remove xml files -->
<color name="md_theme_primary">#00696B</color>
<color name="md_theme_onPrimary">#FFFFFF</color>
Expand Down
11 changes: 11 additions & 0 deletions presenter/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<resources>
<string name="app_name">presenter</string>

<string name="home_button_start">시작하기</string>
<string name="select_frame_button_next">&#160;&#160;선택 〉</string>

<string name="select_method_timer_button_icon">🕑</string>
<string name="select_method_timer_button_text">Timer</string>
<string name="select_method_gesture_button_icon">👋</string>
<string name="select_method_gesture_button_text">Gesture</string>
<string name="select_method_gesture_button_toast">준비중입니다.</string>

<string name="camera_exclamation_text">촬영 시 움직이지 마세요</string>
</resources>
7 changes: 3 additions & 4 deletions util/src/main/java/com/foke/together/util/AppPolicy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@ package com.foke.together.util
object AppPolicy {
const val isDebugMode = true

const val DEFAULT_EXTERNAL_CAMERA_IP = "192.168.0.71:5000"

// network
const val WEB_SERVER_URL = "https://4cuts.store/"
const val WEB_CONNECT_TIMEOUT = 10L
const val WEB_READ_TIMEOUT = 10L
const val WEB_WRITE_TIMEOUT = 10L
const val WEB_FILE_MAX_CONTENT_LENGTH = 20971520

const val EXTERNAL_CAMERA_DEFAULT_SERVER_URL = "http://192.168.0.71:5000"
const val EXTERNAL_CAMERA_DEFAULT_SERVER_URL = "http://0.0.0.0"
const val EXTERNAL_CAMERA_CONNECT_TIMEOUT = 10L
const val EXTERNAL_CAMERA_READ_TIMEOUT = 10L
const val EXTERNAL_CAMERA_WRITE_TIMEOUT = 10L

// capture settings
const val CAPTURE_INTERVAL = 10000L
const val CAPTURE_COUNT = 4
const val COUNTDOWN_INTERVAL = 10L

// file settings
const val CAPTURED_FOUR_CUT_IMAGE_NAME = "capture"
const val SINGLE_ROW_FINAL_IMAGE_NAME = "final_single_row"
const val TWO_ROW_FINAL_IMAGE_NAME = "final_two_row"

const val DEFAULT_QR_CODE_IMAGE_NAME = "qrcode"
}
1 change: 1 addition & 0 deletions util/src/main/java/com/foke/together/util/TimeUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import java.util.Date
object TimeUtil {
fun getCurrentDisplayTime(): String {
val dateFormat = "yyyy.MM.dd"
// TODO: LocalDate로 변경
val date = Date(System.currentTimeMillis())
val simpleDateFormat = SimpleDateFormat(dateFormat)
val simpleDate: String = simpleDateFormat.format(date)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ class NetworkCall<T>(
call.enqueue(object: Callback<T> {
override fun onResponse(call: Call<T>, response: Response<T>) {
if (AppPolicy.isDebugMode) {
AppLog.e(TAG, "onResponse", "success: $response")
AppLog.e(TAG, "onResponse", ">>>>>>>>>>>>>>>>> start >>>>>>>>>>>>>>>>>")
AppLog.e(TAG, "onResponse", "response: $response")
AppLog.e(TAG, "onResponse", "headers: ${response.headers()}")
response.raw().body?.run {
AppLog.e(TAG, "onResponse", "contentType: ${this.contentType()}")
AppLog.e(TAG, "onResponse", "contentLength: ${this.contentLength()}")
}
AppLog.e(TAG, "onResponse", "<<<<<<<<<<<<<<<<<< end <<<<<<<<<<<<<<<<")
}

if (response.isSuccessful) {
Expand Down

0 comments on commit 257bdab

Please sign in to comment.