Skip to content

Commit

Permalink
[refactor/#21] time picker, tag Bottom 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
imtaejugkim committed Jan 16, 2025
1 parent b892e78 commit 25a5779
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,76 @@ package org.memento.presentation.plusbottomsheet

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
import androidx.compose.material3.TabRowDefaults.tabIndicatorOffset
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.launch
import org.memento.R
import org.memento.presentation.util.noRippleClickable
import org.memento.ui.MementoBottomSheet
import org.memento.ui.RepeatSelectorContent
import org.memento.ui.theme.darkModeColors

@Composable
fun MainPlusBottomSheet(
tagColor: String,
deadLineText : String,
deadLineText: String,
onNavigateDeadLineSetting: () -> Unit,
onNavigateTagSetting: () -> Unit
) {
val pages = listOf(R.drawable.ic_check_tab, R.drawable.ic_check_tab, R.drawable.ic_check_tab)
val pages = listOf(R.drawable.ic_check_tab, R.drawable.ic_calendar_tab, R.drawable.ic_brain_tab)
val pagerState = rememberPagerState(
pageCount = { 3 }
)
val coroutineScope = rememberCoroutineScope()

TabRow(
selectedTabIndex = pagerState.currentPage,
Box(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 13.dp),
containerColor = darkModeColors.gray09,
indicator = { tabPositions ->
Modifier.tabIndicatorOffset(tabPositions[pagerState.currentPage])
},
divider = { }
contentAlignment = Alignment.Center
) {
pages.forEachIndexed { index, _ ->
Tab(
selected = pagerState.currentPage == index,
onClick = {
coroutineScope.launch {
pagerState.scrollToPage(index)
}
},
modifier = Modifier.padding(all = 3.dp)
) {
Image(
painter = painterResource(pages[index]),
contentDescription = "탭 아이콘",
modifier = Modifier.padding(all = 3.dp)
Row(
modifier = Modifier
.background(
color = darkModeColors.gray08,
shape = CircleShape
)
.padding(all = 3.dp),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
) {
pages.forEachIndexed { index, image ->
val isSelected = pagerState.currentPage == index
Box(
modifier = Modifier
.size(38.dp)
.background(
color = if (isSelected) darkModeColors.black else darkModeColors.gray08,
shape = CircleShape
)
.noRippleClickable {
coroutineScope.launch {
pagerState.animateScrollToPage(index)
}
},
contentAlignment = Alignment.Center
) {
Image(
painter = painterResource(image),
contentDescription = "탭 아이콘",
)
}
}
}
}
Expand All @@ -80,12 +80,13 @@ fun MainPlusBottomSheet(
state = pagerState,
) { page ->
when (page) {
0 -> AddToDoScreen (
0 -> AddToDoScreen(
deadLineText = deadLineText,
tagColor = tagColor,
onNavigateDeadLineSetting = onNavigateDeadLineSetting,
onNavigateTagSetting = onNavigateTagSetting
)

1 -> AddPlanScreen()
2 -> BrainDumpScreen()
else -> AddToDoScreen(
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/org/memento/ui/MementoTagBottomSheetItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ fun getDummyTagData(): List<ColorTagData> {
ColorTagData("SOPT", "#33FF57"),
ColorTagData("Fitness", "#3357FF"),
ColorTagData("Project", "#FFD700"),
ColorTagData("Project", "#FFD700"),
ColorTagData("Untitled", "#FF5733"),
ColorTagData("SOPT", "#33FF57"),
ColorTagData("Fitness", "#3357FF"),
ColorTagData("Project", "#FFD700"),
ColorTagData("Project", "#FFD700"),
ColorTagData("Untitled", "#FF5733"),
ColorTagData("SOPT", "#33FF57"),
ColorTagData("Fitness", "#3357FF"),
ColorTagData("Project", "#FFD700"),
)
}

Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/org/memento/ui/MementoTimePicker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.memento.ui
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Text
Expand Down Expand Up @@ -57,7 +58,7 @@ fun MementoTimePicker(
)
},
) { index ->
onTimeSelected(getFormattedTime())
// onTimeSelected(getFormattedTime())
Text(
text = index.toString().padStart(2, '0'),
style =
Expand All @@ -80,7 +81,7 @@ fun MementoTimePicker(
)
},
) { index ->
onTimeSelected(getFormattedTime())
// onTimeSelected(getFormattedTime())
Text(
text = minuteValues[index].toString().padStart(2, '0'),
style =
Expand All @@ -103,7 +104,7 @@ fun MementoTimePicker(
)
},
) { index ->
onTimeSelected(getFormattedTime())
// onTimeSelected(getFormattedTime())
Text(
text = periods[index],
style =
Expand Down

0 comments on commit 25a5779

Please sign in to comment.