Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RulePicker 레이아웃 일부 수정 #98

Merged
merged 2 commits into from
Dec 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.whyranoid.presentation.compose

import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.shape.RoundedCornerShape
Expand All @@ -15,6 +16,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.stringArrayResource
import androidx.compose.ui.res.stringResource
Expand All @@ -29,35 +31,41 @@ fun DateDropDownMenu(
val dateText = stringResource(id = R.string.text_date)
val dateList = stringArrayResource(id = R.array.rule_date_array)
var isDropDownMenuExpanded by remember { mutableStateOf(false) }
Button(
onClick = { isDropDownMenuExpanded = true },
colors = ButtonDefaults
.outlinedButtonColors(
contentColor = colorResource(id = R.color.mogakrun_on_primary)
),
shape = RoundedCornerShape(30),
elevation = ButtonDefaults.elevation(
defaultElevation = 2.dp,
pressedElevation = 4.dp,
disabledElevation = 0.dp
)
) {
Text(text = selectedDate + dateText)
}
Column {
Button(
onClick = { isDropDownMenuExpanded = true },
colors = ButtonDefaults
.outlinedButtonColors(
contentColor = colorResource(id = R.color.mogakrun_on_primary)
),
shape = RoundedCornerShape(30),
elevation = ButtonDefaults.elevation(
defaultElevation = 2.dp,
pressedElevation = 4.dp,
disabledElevation = 0.dp
)
) {
Text(text = selectedDate + dateText)
}

DropdownMenu(
modifier = Modifier
.wrapContentWidth()
.wrapContentHeight(),
expanded = isDropDownMenuExpanded,
onDismissRequest = { isDropDownMenuExpanded = false }
) {
dateList.forEach { date ->
DropdownMenuItem(onClick = {
onDateSelected(date)
isDropDownMenuExpanded = false
}) {
Text(text = date + dateText)
DropdownMenu(
modifier = Modifier
.wrapContentWidth()
.wrapContentHeight()
.heightIn(
0.dp,
LocalConfiguration.current.screenHeightDp.dp / 2 - ButtonDefaults.MinHeight
),
expanded = isDropDownMenuExpanded,
onDismissRequest = { isDropDownMenuExpanded = false }
) {
dateList.forEach { date ->
DropdownMenuItem(onClick = {
onDateSelected(date)
isDropDownMenuExpanded = false
}) {
Text(text = date + dateText)
}
}
}
}
Expand All @@ -71,35 +79,41 @@ fun HourDropDownMenu(
val hourText = stringResource(id = R.string.text_hour)
val hourList = stringArrayResource(id = R.array.rule_hour_array)
var isDropDownMenuExpanded by remember { mutableStateOf(false) }
Button(
onClick = { isDropDownMenuExpanded = true },
colors = ButtonDefaults
.outlinedButtonColors(
contentColor = colorResource(id = R.color.mogakrun_on_primary)
),
shape = RoundedCornerShape(30),
elevation = ButtonDefaults.elevation(
defaultElevation = 2.dp,
pressedElevation = 4.dp,
disabledElevation = 0.dp
)
) {
Text(text = selectedHour + hourText)
}
Column {
Button(
onClick = { isDropDownMenuExpanded = true },
colors = ButtonDefaults
.outlinedButtonColors(
contentColor = colorResource(id = R.color.mogakrun_on_primary)
),
shape = RoundedCornerShape(30),
elevation = ButtonDefaults.elevation(
defaultElevation = 2.dp,
pressedElevation = 4.dp,
disabledElevation = 0.dp
)
) {
Text(text = selectedHour + hourText)
}

DropdownMenu(
modifier = Modifier
.wrapContentWidth()
.height(500.dp),
expanded = isDropDownMenuExpanded,
onDismissRequest = { isDropDownMenuExpanded = false }
) {
hourList.forEach { hour ->
DropdownMenuItem(onClick = {
onHourSelected(hour)
isDropDownMenuExpanded = false
}) {
Text(text = hour + hourText)
DropdownMenu(
modifier = Modifier
.wrapContentWidth()
.wrapContentHeight()
.heightIn(
0.dp,
LocalConfiguration.current.screenHeightDp.dp / 2 - ButtonDefaults.MinHeight
),
expanded = isDropDownMenuExpanded,
onDismissRequest = { isDropDownMenuExpanded = false }
) {
hourList.forEach { hour ->
DropdownMenuItem(onClick = {
onHourSelected(hour)
isDropDownMenuExpanded = false
}) {
Text(text = hour + hourText)
}
}
}
}
Expand All @@ -114,35 +128,41 @@ fun MinuteDropDownMenu(
val minuteList = stringArrayResource(id = R.array.rule_minute_array)
var isDropDownMenuExpanded by remember { mutableStateOf(false) }

Button(
onClick = { isDropDownMenuExpanded = true },
colors = ButtonDefaults
.outlinedButtonColors(
contentColor = colorResource(id = R.color.mogakrun_on_primary)
),
shape = RoundedCornerShape(30),
elevation = ButtonDefaults.elevation(
defaultElevation = 2.dp,
pressedElevation = 4.dp,
disabledElevation = 0.dp
)
) {
Text(text = selectedMinute + minuteText)
}
Column {
Button(
onClick = { isDropDownMenuExpanded = true },
colors = ButtonDefaults
.outlinedButtonColors(
contentColor = colorResource(id = R.color.mogakrun_on_primary)
),
shape = RoundedCornerShape(30),
elevation = ButtonDefaults.elevation(
defaultElevation = 2.dp,
pressedElevation = 4.dp,
disabledElevation = 0.dp
)
) {
Text(text = selectedMinute + minuteText)
}

DropdownMenu(
modifier = Modifier
.wrapContentWidth()
.height(500.dp),
expanded = isDropDownMenuExpanded,
onDismissRequest = { isDropDownMenuExpanded = false }
) {
minuteList.forEach { minute ->
DropdownMenuItem(onClick = {
onMinuteSelected(minute)
isDropDownMenuExpanded = false
}) {
Text(text = minute + minuteText)
DropdownMenu(
modifier = Modifier
.wrapContentWidth()
.wrapContentHeight()
.heightIn(
0.dp,
LocalConfiguration.current.screenHeightDp.dp / 2 - ButtonDefaults.MinHeight
),
expanded = isDropDownMenuExpanded,
onDismissRequest = { isDropDownMenuExpanded = false }
) {
minuteList.forEach { minute ->
DropdownMenuItem(onClick = {
onMinuteSelected(minute)
isDropDownMenuExpanded = false
}) {
Text(text = minute + minuteText)
}
}
}
}
Expand Down