-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feat/#59-calendar-…
…month # Conflicts: # feature/src/main/java/com/terning/feature/main/MainScreen.kt
- Loading branch information
Showing
21 changed files
with
666 additions
and
143 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
core/src/main/java/com/terning/core/designsystem/component/button/ChangeFilterButton.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.terning.core.designsystem.component.button | ||
|
||
import androidx.annotation.StringRes | ||
import androidx.compose.foundation.BorderStroke | ||
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.foundation.interaction.collectIsPressedAsState | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.wrapContentHeight | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.ripple.LocalRippleTheme | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import com.terning.core.designsystem.theme.Grey400 | ||
import com.terning.core.designsystem.theme.TerningMain | ||
import com.terning.core.designsystem.theme.TerningSub1 | ||
import com.terning.core.designsystem.theme.TerningSub5 | ||
import com.terning.core.designsystem.theme.TerningTheme | ||
import com.terning.core.designsystem.theme.White | ||
import com.terning.core.util.NoRippleTheme | ||
|
||
@Composable | ||
fun ChangeFilterButton( | ||
isSelected: Boolean, | ||
@StringRes text: Int, | ||
cornerRadius: Dp, | ||
paddingVertical: Dp, | ||
onButtonClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
val interactionSource = remember { MutableInteractionSource() } | ||
val isPressed by interactionSource.collectIsPressedAsState() | ||
val backgroundColor = when { | ||
!isSelected && !isPressed -> White | ||
!isSelected && isPressed -> TerningSub5 | ||
else -> TerningMain | ||
} | ||
val textColor = when { | ||
!isSelected -> Grey400 | ||
else -> White | ||
} | ||
val borderColor = when { | ||
!isSelected && !isPressed -> TerningMain | ||
!isSelected && isPressed -> TerningSub1 | ||
else -> TerningMain | ||
} | ||
|
||
CompositionLocalProvider(LocalRippleTheme provides NoRippleTheme) { | ||
Button( | ||
contentPadding = PaddingValues(vertical = paddingVertical), | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.wrapContentHeight(), | ||
interactionSource = interactionSource, | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = backgroundColor, | ||
contentColor = textColor, | ||
), | ||
border = BorderStroke( | ||
width = 1.dp, | ||
color = borderColor | ||
), | ||
shape = RoundedCornerShape(cornerRadius), | ||
onClick = { onButtonClick() } | ||
) { | ||
Text( | ||
text = stringResource(id = text), | ||
style = TerningTheme.typography.button3, | ||
textAlign = TextAlign.Center, | ||
) | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
core/src/main/java/com/terning/core/designsystem/component/item/InternItemWithShadow.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.terning.core.designsystem.component.item | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.terning.core.designsystem.theme.Grey200 | ||
import com.terning.core.designsystem.theme.White | ||
import com.terning.core.extension.customShadow | ||
|
||
@Composable | ||
fun InternItemWithShadow( | ||
imageUrl: String, | ||
title: String, | ||
dateDeadline: String, | ||
workingPeriod: String, | ||
isScraped: Boolean, | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.customShadow( | ||
color = Grey200, | ||
shadowRadius = 10.dp, | ||
shadowWidth = 2.dp, | ||
) | ||
.background( | ||
color = White, | ||
shape = RoundedCornerShape(10.dp) | ||
) | ||
) { | ||
InternItem( | ||
imageUrl = imageUrl, | ||
title = title, | ||
dateDeadline = dateDeadline, | ||
workingPeriod = workingPeriod, | ||
isScraped = isScraped | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
148 changes: 148 additions & 0 deletions
148
feature/src/main/java/com/terning/feature/home/changefilter/ChangeFilterRoute.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
package com.terning.feature.home.changefilter | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.shadow | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import androidx.navigation.NavController | ||
import com.terning.core.designsystem.component.button.RectangleButton | ||
import com.terning.core.designsystem.component.datepicker.DatePickerUI | ||
import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar | ||
import com.terning.core.designsystem.theme.TerningTheme | ||
import com.terning.feature.R | ||
import com.terning.feature.home.changefilter.component.ChangeFilteringRadioGroup | ||
import com.terning.feature.home.changefilter.component.FilteringMainTitleText | ||
import com.terning.feature.home.changefilter.component.FilteringSubTitleText | ||
import com.terning.feature.home.home.HomeViewModel | ||
import com.terning.feature.home.home.model.InternFilterData | ||
import com.terning.feature.home.home.model.UserNameState | ||
import com.terning.feature.home.home.navigation.navigateHome | ||
import java.util.Calendar | ||
|
||
val currentYear = Calendar.getInstance().get(Calendar.YEAR) | ||
val currentMonth = Calendar.getInstance().get(Calendar.MONTH) | ||
|
||
@Composable | ||
fun ChangeFilterRoute( | ||
navController: NavController, | ||
) { | ||
ChangeFilterScreen(navController) | ||
} | ||
|
||
@Composable | ||
fun ChangeFilterScreen( | ||
navController: NavController, | ||
viewModel: HomeViewModel = hiltViewModel(), | ||
) { | ||
Scaffold( | ||
topBar = { | ||
BackButtonTopAppBar( | ||
title = stringResource(id = R.string.change_filter_top_bar_title), | ||
onBackButtonClick = { navController.popBackStack() }, | ||
modifier = Modifier | ||
.shadow(elevation = 2.dp) | ||
) | ||
} | ||
) { paddingValues -> | ||
Column( | ||
modifier = Modifier | ||
.padding( | ||
top = paddingValues.calculateTopPadding(), | ||
) | ||
) { | ||
ShowTitle( | ||
mainTitle = stringResource(id = R.string.change_filter_grade_main), | ||
subTitle = stringResource(id = R.string.filtering_status1_sub), | ||
modifier = Modifier.padding( | ||
top = 31.dp, | ||
start = 24.dp, | ||
end = 24.dp | ||
) | ||
) | ||
ChangeFilteringRadioGroup( | ||
filterType = 0, | ||
internFilterData = viewModel.userName.internFilter, | ||
onButtonClick = { viewModel.setGrade(it) } | ||
) | ||
|
||
UserNameState( | ||
userName = "남지우자랑스러운티엘이되", | ||
internFilter = InternFilterData( | ||
grade = 4, | ||
workingPeriod = 1, | ||
startYear = 2024, | ||
startMonth = 7, | ||
) | ||
) | ||
|
||
ShowTitle( | ||
mainTitle = stringResource(id = R.string.filtering_status2_title), | ||
subTitle = stringResource(id = R.string.filtering_status2_sub), | ||
modifier = Modifier.padding( | ||
top = 39.dp, | ||
start = 24.dp, | ||
end = 24.dp | ||
) | ||
) | ||
ChangeFilteringRadioGroup( | ||
filterType = 1, | ||
internFilterData = viewModel.userName.internFilter, | ||
onButtonClick = { viewModel.setWorkingPeriod(it) } | ||
) | ||
|
||
ShowTitle( | ||
mainTitle = stringResource(id = R.string.filtering_status3_title), | ||
subTitle = stringResource(id = R.string.filtering_status3_sub), | ||
modifier = Modifier.padding( | ||
top = 39.dp, | ||
start = 24.dp, | ||
end = 24.dp | ||
) | ||
) | ||
|
||
Spacer(modifier = Modifier.weight(1f)) | ||
DatePickerUI( | ||
chosenYear = currentYear, | ||
chosenMonth = currentMonth, | ||
) | ||
Spacer(modifier = Modifier.weight(1f)) | ||
|
||
RectangleButton( | ||
style = TerningTheme.typography.button0, | ||
paddingVertical = 19.dp, | ||
text = R.string.change_filter_save, | ||
onButtonClick = { | ||
navController.navigateHome() | ||
} | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
private fun ShowTitle( | ||
mainTitle: String, | ||
subTitle: String, | ||
modifier: Modifier = Modifier, | ||
) { | ||
FilteringMainTitleText( | ||
text = mainTitle, | ||
modifier = modifier.padding() | ||
) | ||
FilteringSubTitleText( | ||
text = subTitle, | ||
modifier = Modifier | ||
.padding( | ||
top = 3.dp, | ||
bottom = 13.dp, | ||
start = 24.dp, | ||
end = 24.dp | ||
) | ||
) | ||
} |
81 changes: 81 additions & 0 deletions
81
...rc/main/java/com/terning/feature/home/changefilter/component/ChangeFilteringRadioGroup.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package com.terning.feature.home.changefilter.component | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.wrapContentHeight | ||
import androidx.compose.foundation.lazy.grid.GridCells | ||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid | ||
import androidx.compose.foundation.lazy.grid.itemsIndexed | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.mutableIntStateOf | ||
import androidx.compose.runtime.mutableStateListOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.terning.core.designsystem.component.button.ChangeFilterButton | ||
import com.terning.feature.R | ||
import com.terning.feature.home.home.model.InternFilterData | ||
|
||
@Composable | ||
fun ChangeFilteringRadioGroup( | ||
filterType: Int, | ||
internFilterData: InternFilterData?, | ||
onButtonClick: (Int) -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
val options = if (filterType == 0) { | ||
listOf( | ||
R.string.filtering_status1_button1, | ||
R.string.filtering_status1_button2, | ||
R.string.filtering_status1_button3, | ||
R.string.filtering_status1_button4, | ||
) | ||
} else { | ||
listOf( | ||
R.string.filtering_status2_button1, | ||
R.string.filtering_status2_button2, | ||
R.string.filtering_status2_button3, | ||
) | ||
} | ||
|
||
val selectedIndex = remember { mutableIntStateOf(0) } | ||
var selectedButton = remember { mutableStateListOf(false, false, false, false) } | ||
|
||
if (filterType == 0) { | ||
selectedButton[ | ||
internFilterData?.grade ?: 0 | ||
] = true | ||
} else { | ||
selectedButton[ | ||
internFilterData?.workingPeriod ?: 0 | ||
] = true | ||
} | ||
|
||
LazyVerticalGrid( | ||
columns = GridCells.Fixed(options.size), | ||
horizontalArrangement = Arrangement.spacedBy(12.dp), | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.wrapContentHeight() | ||
.padding(horizontal = 24.dp) | ||
|
||
) { | ||
itemsIndexed(options) { index, option -> | ||
ChangeFilterButton( | ||
isSelected = selectedButton[index], | ||
modifier = Modifier | ||
.wrapContentHeight(), | ||
text = options[index], | ||
cornerRadius = 10.dp, | ||
paddingVertical = 10.dp, | ||
onButtonClick = { | ||
selectedIndex.intValue = option | ||
selectedButton.indices.forEach { i -> selectedButton[i] = false } | ||
selectedButton[index] = true | ||
onButtonClick(index) | ||
} | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.