1
1
package com.teamtuna.emotionaldiary.main
2
2
3
3
import android.os.Bundle
4
+ import androidx.activity.compose.setContent
4
5
import androidx.activity.viewModels
5
6
import androidx.appcompat.app.AppCompatActivity
6
- import com.teamtuna.emotionaldiary.add.EmotionAddFragment
7
- import com.teamtuna.emotionaldiary.presentation.R
7
+ import androidx.compose.foundation.background
8
+ import androidx.compose.foundation.layout.Arrangement.SpaceBetween
9
+ import androidx.compose.foundation.layout.Row
10
+ import androidx.compose.foundation.layout.fillMaxSize
11
+ import androidx.compose.material.Text
12
+ import androidx.compose.material.TextButton
13
+ import androidx.compose.runtime.Composable
14
+ import androidx.compose.ui.Alignment
15
+ import androidx.compose.ui.Modifier
16
+ import androidx.compose.ui.graphics.Color
17
+ import com.google.accompanist.insets.ProvideWindowInsets
18
+ import com.teamtuna.emotionaldiary.compose.theme.EmotionalDiaryTheme
8
19
import dagger.hilt.android.AndroidEntryPoint
9
20
10
21
@AndroidEntryPoint
@@ -14,9 +25,58 @@ class MainActivity : AppCompatActivity() {
14
25
15
26
override fun onCreate (savedInstanceState : Bundle ? ) {
16
27
super .onCreate(savedInstanceState)
17
- setContentView(R .layout.activity_main)
28
+ setContent {
29
+ MainScene ()
30
+ }
18
31
19
- val fragment = EmotionAddFragment ()
20
- supportFragmentManager.beginTransaction().replace(R .id.fragment, fragment).commit()
32
+ }
33
+
34
+ @Composable
35
+ fun MainScene () {
36
+ EmotionalDiaryTheme {
37
+ ProvideWindowInsets {
38
+
39
+ BottomMenu ()
40
+ // fixme bottomAppBar
41
+ // Scaffold(
42
+ // bottomAppBar = {
43
+ //
44
+ // }
45
+ // )
46
+ }
47
+ }
48
+ }
49
+
50
+ @Composable
51
+ fun BottomMenu () {
52
+ val selectedMenu = viewModel.selectedMenu
53
+ Row (
54
+ Modifier
55
+ .background(Color (0xFFEDEAE0 ))
56
+ .fillMaxSize(),
57
+ horizontalArrangement = SpaceBetween ,
58
+ verticalAlignment = Alignment .Bottom
59
+ ) {
60
+ TextButton (onClick = { viewModel.onSelectBottomMenu(BottomMenu .CALENDAR ) }) {
61
+ val color =
62
+ if (selectedMenu.value == BottomMenu .CALENDAR ) Color .Blue else Color .DarkGray
63
+ Text (text = " 달력" , color = color)
64
+ }
65
+ TextButton (onClick = { viewModel.onSelectBottomMenu(BottomMenu .TIMELINE ) }) {
66
+ val color =
67
+ if (selectedMenu.value == BottomMenu .TIMELINE ) Color .Blue else Color .DarkGray
68
+ Text (text = " 타임라인" , color = color)
69
+ }
70
+ TextButton (onClick = { viewModel.onSelectBottomMenu(BottomMenu .ANALYSIS ) }) {
71
+ val color =
72
+ if (selectedMenu.value == BottomMenu .ANALYSIS ) Color .Blue else Color .DarkGray
73
+ Text (text = " 분석" , color = color)
74
+ }
75
+ TextButton (onClick = { viewModel.onSelectBottomMenu(BottomMenu .SETTING ) }) {
76
+ val color =
77
+ if (selectedMenu.value == BottomMenu .SETTING ) Color .Blue else Color .DarkGray
78
+ Text (text = " 설정" , color = color)
79
+ }
80
+ }
21
81
}
22
82
}
0 commit comments