Skip to content

Commit 7de9dba

Browse files
committed
UI 가이드 확정 & 구현 [#133]
- HomeScreen Color scheme 재수정. - Skip SelectMethod Screen - 카메리 화면 clip + 타이머 오버레이화면 추가 - bottomAppBar 적용
1 parent d0d1b81 commit 7de9dba

File tree

8 files changed

+211
-94
lines changed

8 files changed

+211
-94
lines changed

presenter/src/main/java/com/foke/together/presenter/component/Basic.kt

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import androidx.compose.material.icons.Icons
1515
import androidx.compose.material.icons.filled.Add
1616
import androidx.compose.material.icons.filled.Remove
1717
import androidx.compose.material.icons.filled.Start
18+
import androidx.compose.material3.BottomAppBar
1819
import androidx.compose.material3.Button
1920
import androidx.compose.material3.ButtonColors
2021
import androidx.compose.material3.Card
@@ -288,12 +289,16 @@ fun AppTopBar(
288289
when(alignment){
289290
Alignment.CenterHorizontally -> {
290291
CenterAlignedTopAppBar(
292+
modifier = Modifier.fillMaxWidth().wrapContentSize().padding(
293+
start = AppTheme.size.layoutPadding,
294+
end = AppTheme.size.layoutPadding
295+
),
291296
title = {
292297
Text(
293298
text = title,
294299
style = titleStyle,
295300
textAlign = TextAlign.Center,
296-
color = AppTheme.colorScheme.border
301+
color = AppTheme.colorScheme.top
297302
)
298303
},
299304
colors = TopAppBarDefaults.topAppBarColors(
@@ -309,6 +314,10 @@ fun AppTopBar(
309314
}
310315
Alignment.Start -> {
311316
TopAppBar(
317+
modifier = Modifier.fillMaxWidth().wrapContentSize().padding(
318+
start = AppTheme.size.layoutPadding,
319+
end = AppTheme.size.layoutPadding
320+
),
312321
title = {
313322
Text(
314323
text = title,
@@ -431,4 +440,26 @@ fun AppTextField(
431440
),
432441
enabled = enabled
433442
)
443+
}
444+
445+
@Composable
446+
fun AppBottomBar(
447+
content: @Composable (RowScope.() -> Unit)
448+
){
449+
BottomAppBar(
450+
modifier = Modifier.fillMaxWidth().padding(
451+
start = AppTheme.size.layoutPadding,
452+
end = AppTheme.size.layoutPadding,
453+
bottom = AppTheme.size.layoutPadding
454+
),
455+
containerColor = AppTheme.colorScheme.bottom,
456+
contentColor = AppTheme.colorScheme.top,
457+
){
458+
Row(
459+
modifier = Modifier.fillMaxWidth().wrapContentHeight(),
460+
horizontalArrangement = Arrangement.SpaceEvenly,
461+
verticalAlignment = Alignment.CenterVertically,
462+
content = content
463+
)
464+
}
434465
}

presenter/src/main/java/com/foke/together/presenter/navigation/NavGraph.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private fun addSelectFrameScreen(
7070
navGraphBuilder.composable(route = NavRoute.SelectFrame.path) {
7171
SelectFrameScreen(
7272
navigateToMethod = {
73-
navController.navigate(NavRoute.SelectMethod.path)
73+
navController.navigate(NavRoute.InternalCamera.path)
7474
},
7575
popBackStack = {
7676
navController.popBackStack(NavRoute.Home.path, inclusive = false)

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ import androidx.compose.runtime.Composable
2222
import androidx.compose.runtime.DisposableEffect
2323
import androidx.compose.ui.Alignment
2424
import androidx.compose.ui.Modifier
25+
import androidx.compose.ui.graphics.vector.ImageVector
26+
import androidx.compose.ui.graphics.vector.rememberVectorPainter
2527
import androidx.compose.ui.res.painterResource
2628
import androidx.compose.ui.res.stringResource
29+
import androidx.compose.ui.res.vectorResource
2730
import androidx.compose.ui.text.font.FontWeight
2831
import androidx.compose.ui.tooling.preview.Devices
2932
import androidx.compose.ui.tooling.preview.Preview
@@ -97,12 +100,13 @@ fun HomeScreenContent(
97100
verticalArrangement = Arrangement.SpaceEvenly,
98101
horizontalAlignment = Alignment.CenterHorizontally
99102
){
100-
Image(
101-
painter = painterResource(
102-
id = R.drawable.fourcut_together
103+
Icon(
104+
imageVector = ImageVector.vectorResource(
105+
id = R.drawable.fourcut_together,
103106
),
104107
contentDescription = "FourCuts Together",
105108
modifier = Modifier.wrapContentSize(),
109+
tint = AppTheme.colorScheme.top
106110
)
107111
AppButton(
108112
onClick = { navigationSelectFrame() },

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

Lines changed: 68 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ package com.foke.together.presenter.screen
22

33
import android.content.Context
44
import androidx.camera.view.PreviewView
5+
import androidx.compose.animation.core.animateFloatAsState
6+
import androidx.compose.animation.core.tween
7+
import androidx.compose.animation.AnimatedVisibility
8+
import androidx.compose.animation.scaleIn
9+
import androidx.compose.animation.scaleOut
10+
import androidx.compose.foundation.background
511
import androidx.compose.foundation.layout.Arrangement
612
import androidx.compose.foundation.layout.Box
713
import androidx.compose.foundation.layout.Column
@@ -11,6 +17,7 @@ import androidx.compose.foundation.layout.fillMaxSize
1117
import androidx.compose.foundation.layout.fillMaxWidth
1218
import androidx.compose.foundation.layout.padding
1319
import androidx.compose.foundation.layout.wrapContentHeight
20+
import androidx.compose.foundation.shape.RoundedCornerShape
1421
import androidx.compose.material3.BottomAppBar
1522
import androidx.compose.material3.ExperimentalMaterial3Api
1623
import androidx.compose.material3.Text
@@ -20,12 +27,16 @@ import androidx.compose.runtime.mutableStateOf
2027
import androidx.compose.runtime.remember
2128
import androidx.compose.ui.Alignment
2229
import androidx.compose.ui.Modifier
30+
import androidx.compose.ui.draw.alpha
31+
import androidx.compose.ui.draw.clip
32+
import androidx.compose.ui.graphics.Color
2333
import androidx.compose.ui.platform.LocalContext
2434
import androidx.compose.ui.res.stringResource
2535
import androidx.compose.ui.text.font.FontWeight
2636
import androidx.compose.ui.text.style.TextAlign
2737
import androidx.compose.ui.tooling.preview.Devices
2838
import androidx.compose.ui.tooling.preview.Preview
39+
import androidx.compose.ui.unit.dp
2940
import androidx.compose.ui.unit.sp
3041
import androidx.compose.ui.viewinterop.AndroidView
3142
import androidx.hilt.navigation.compose.hiltViewModel
@@ -34,9 +45,11 @@ import androidx.lifecycle.compose.LifecycleEventEffect
3445
import androidx.lifecycle.compose.LocalLifecycleOwner
3546
import androidx.lifecycle.compose.collectAsStateWithLifecycle
3647
import com.foke.together.presenter.R
48+
import com.foke.together.presenter.component.AppBottomBar
3749
import com.foke.together.presenter.component.AppTopBar
3850
import com.foke.together.presenter.component.BasicScaffold
3951
import com.foke.together.presenter.screen.state.InternalCameraState
52+
import com.foke.together.presenter.theme.AppTheme
4053
import com.foke.together.presenter.theme.FourCutTogetherTheme
4154
import com.foke.together.presenter.viewmodel.InternelCameraViewModel
4255
import com.foke.together.util.AppLog
@@ -55,6 +68,8 @@ fun InternalCameraScreenRoot(
5568
val context = LocalContext.current
5669
val captureCount by viewModel.captureCount.collectAsStateWithLifecycle()
5770
val progress by viewModel.progressState.collectAsStateWithLifecycle()
71+
val isFlashAnimationVisible by viewModel.flashAnimationState.collectAsStateWithLifecycle()
72+
val countdownSeconds by viewModel.countdownSeconds.collectAsStateWithLifecycle()
5873
LifecycleEventEffect(Lifecycle.Event.ON_START) {
5974
viewModel.setCaptureTimer(context) { navigateToGenerateImage() }
6075
AppLog.d(TAG, "LifecycleEventEffect. ON_START", "")
@@ -71,6 +86,8 @@ fun InternalCameraScreenRoot(
7186
state = state,
7287
captureCount = captureCount,
7388
progress = progress,
89+
isFlashAnimationVisible = isFlashAnimationVisible,
90+
countdownSeconds = countdownSeconds,
7491
initialPreview = { context, previewView ->
7592
viewModel.initial(context, lifecycleOwner, previewView)
7693
},
@@ -86,9 +103,16 @@ fun InternalCameraScreen(
86103
state : InternalCameraState,
87104
captureCount : Int,
88105
progress: Float,
106+
isFlashAnimationVisible: Boolean,
107+
countdownSeconds: Int,
89108
initialPreview : (Context, PreviewView) -> Unit,
90109
releasePreview : (Context) -> Unit,
91110
){
111+
val previewAlpha by animateFloatAsState(
112+
targetValue = if (isFlashAnimationVisible) 0.0f else 1.0f,
113+
animationSpec = tween(durationMillis = if (isFlashAnimationVisible) 50 else 150),
114+
label = "preview_alpha"
115+
)
92116
BasicScaffold(
93117
modifier = Modifier.fillMaxSize(),
94118
topBar = {
@@ -98,7 +122,14 @@ fun InternalCameraScreen(
98122
)
99123
},
100124
bottomBar = {
101-
BottomAppBar { }
125+
AppBottomBar{
126+
Text(
127+
modifier = Modifier.fillMaxWidth().wrapContentHeight(),
128+
text = stringResource(id = R.string.camera_exclamation_text),
129+
style = AppTheme.typography.title,
130+
textAlign = TextAlign.Center
131+
)
132+
}
102133
}
103134
){ paddingValues ->
104135
Column(
@@ -111,28 +142,50 @@ fun InternalCameraScreen(
111142
verticalArrangement = Arrangement.SpaceEvenly,
112143
horizontalAlignment = Alignment.CenterHorizontally,
113144
){
114-
Text(
115-
modifier = Modifier.fillMaxWidth().wrapContentHeight(),
116-
text = stringResource(id = R.string.camera_exclamation_text),
117-
fontWeight = FontWeight.Bold,
118-
fontSize = 24.sp,
119-
textAlign = TextAlign.Center
120-
)
121145
Box(
122-
modifier = Modifier.aspectRatio(1.5f).fillMaxHeight()
146+
modifier = Modifier.aspectRatio(1.5f).fillMaxHeight(0.8f),
123147
) {
124148
AndroidView(
125-
modifier = Modifier.align(Alignment.Center).fillMaxSize(),
149+
modifier = Modifier
150+
.align(Alignment.Center)
151+
.fillMaxSize()
152+
.clip(RoundedCornerShape(AppTheme.size.icon))
153+
.alpha(previewAlpha)
154+
.background(
155+
color = AppTheme.colorScheme.bottom
156+
),
126157
factory = { context ->
127158
PreviewView(context).also { preview ->
128159
initialPreview(context, preview)
160+
129161
}
130162
},
131163
onRelease = { previewView ->
132164
releasePreview(previewView.context)
133165
}
134-
135166
)
167+
168+
// Countdown overlay
169+
this@Column.AnimatedVisibility(
170+
visible = countdownSeconds > 0,
171+
enter = scaleIn(),
172+
exit = scaleOut(),
173+
modifier = Modifier.align(Alignment.Center)
174+
) {
175+
Text(
176+
text = countdownSeconds.toString(),
177+
fontSize = 80.sp,
178+
fontWeight = FontWeight.Bold,
179+
color = Color.White,
180+
modifier = Modifier
181+
.background(
182+
Color.Black.copy(alpha = 0.5f),
183+
shape = AppTheme.shapes.container
184+
)
185+
.padding(24.dp)
186+
)
187+
}
188+
136189
}
137190
}
138191
}
@@ -147,11 +200,15 @@ fun InternalScreenPreview(){
147200
val state by remember { mutableStateOf(InternalCameraState()) }
148201
val captureCount by remember{ mutableStateOf(1) }
149202
val progress by remember{ mutableStateOf(1f)}
203+
val isFlashAnimationVisible by remember{ mutableStateOf(false)}
204+
val countdownSeconds by remember{ mutableStateOf(3)}
150205
FourCutTogetherTheme() {
151206
InternalCameraScreen(
152207
state = state,
153208
captureCount = captureCount,
154209
progress = progress,
210+
isFlashAnimationVisible = isFlashAnimationVisible,
211+
countdownSeconds = countdownSeconds,
155212
initialPreview = { context, previewView ->
156213

157214
},

0 commit comments

Comments
 (0)