diff --git a/core/ui/src/main/java/pokitmons/pokit/core/ui/utils/ModifierUtils.kt b/core/ui/src/main/java/pokitmons/pokit/core/ui/utils/ModifierUtils.kt index ca9eb912..6220a9eb 100644 --- a/core/ui/src/main/java/pokitmons/pokit/core/ui/utils/ModifierUtils.kt +++ b/core/ui/src/main/java/pokitmons/pokit/core/ui/utils/ModifierUtils.kt @@ -2,7 +2,7 @@ package pokitmons.pokit.core.ui.utils import androidx.compose.ui.Modifier -internal fun Modifier.conditional(condition : Boolean, modifier : Modifier.() -> Modifier) : Modifier { +internal fun Modifier.conditional(condition: Boolean, modifier: Modifier.() -> Modifier): Modifier { return if (condition) { then(modifier(Modifier)) } else { diff --git a/feature/search/src/androidTest/java/pokitmons/pokit/search/ExampleInstrumentedTest.kt b/feature/search/src/androidTest/java/pokitmons/pokit/search/ExampleInstrumentedTest.kt index 5802e982..b07df8db 100644 --- a/feature/search/src/androidTest/java/pokitmons/pokit/search/ExampleInstrumentedTest.kt +++ b/feature/search/src/androidTest/java/pokitmons/pokit/search/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package pokitmons.pokit.search -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.assertEquals - /** * Instrumented test, which will execute on an Android device. * diff --git a/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt b/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt index efbbc478..545e0dec 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt @@ -13,8 +13,8 @@ import androidx.compose.ui.unit.dp import pokitmons.pokit.core.ui.theme.PokitTheme import pokitmons.pokit.search.components.filter.FilterArea import pokitmons.pokit.search.components.filterbottomsheet.FilterBottomSheet -import pokitmons.pokit.search.components.searchitemlist.SearchItemList import pokitmons.pokit.search.components.recentsearchword.RecentSearchWord +import pokitmons.pokit.search.components.searchitemlist.SearchItemList import pokitmons.pokit.search.components.toolbar.Toolbar import pokitmons.pokit.search.model.Filter import pokitmons.pokit.search.model.FilterType @@ -25,7 +25,7 @@ import pokitmons.pokit.search.model.SearchScreenStep @Composable fun SearchScreenContainer( viewModel: SearchViewModel, - onBackPressed: () -> Unit + onBackPressed: () -> Unit, ) { val state by viewModel.state.collectAsState() val searchWord by viewModel.searchWord.collectAsState() @@ -54,7 +54,7 @@ fun SearchScreenContainer( fun SearchScreen( state: SearchScreenState = SearchScreenState(), currentSearchWord: String = "", - linkList : List = emptyList(), + linkList: List = emptyList(), onClickBack: () -> Unit = {}, inputSearchWord: (String) -> Unit = {}, onClickSearch: () -> Unit = {}, @@ -65,63 +65,63 @@ fun SearchScreen( onClickFilterSelect: () -> Unit = {}, onClickFilterItem: (FilterType) -> Unit = {}, hideBottomSheet: () -> Unit = {}, - onClickFilterSave : (Filter) -> Unit = {}, + onClickFilterSave: (Filter) -> Unit = {}, toggleSortOrder: () -> Unit = {}, ) { - Column( - modifier = Modifier.fillMaxSize() - ) { - Toolbar( - onClickBack = onClickBack, - inputSearchWord = inputSearchWord, - currentSearchWord = currentSearchWord, - onClickSearch = onClickSearch, - onClickRemove = remember {{ inputSearchWord("") }} - ) + Column( + modifier = Modifier.fillMaxSize() + ) { + Toolbar( + onClickBack = onClickBack, + inputSearchWord = inputSearchWord, + currentSearchWord = currentSearchWord, + onClickSearch = onClickSearch, + onClickRemove = remember { { inputSearchWord("") } } + ) - if (state.step == SearchScreenStep.INPUT) { - RecentSearchWord( - onClickRemoveAll = onClickRemoveAllRecentSearchWord, - onToggleAutoSave = onClickUseRecentSearchWord, - useAutoSave = state.useRecentSearchWord, - recentSearchWords = state.recentSearchWords, - onClickRemoveSearchWord = onClickRemoveRecentSearchWord, - onClickSearchWord = onClickRecentSearchWord - ) - } + if (state.step == SearchScreenStep.INPUT) { + RecentSearchWord( + onClickRemoveAll = onClickRemoveAllRecentSearchWord, + onToggleAutoSave = onClickUseRecentSearchWord, + useAutoSave = state.useRecentSearchWord, + recentSearchWords = state.recentSearchWords, + onClickRemoveSearchWord = onClickRemoveRecentSearchWord, + onClickSearchWord = onClickRecentSearchWord + ) + } - if (state.step == SearchScreenStep.RESULT){ - FilterArea( - filter = state.filter, - onClickFilter = onClickFilterSelect, - onClickBookmark = remember{{ onClickFilterItem(FilterType.Collect) }}, - onClickPokitName = remember {{ onClickFilterItem(FilterType.Pokit) }}, - onClickPeriod = remember {{ onClickFilterItem(FilterType.Period) }} - ) - } + if (state.step == SearchScreenStep.RESULT) { + FilterArea( + filter = state.filter, + onClickFilter = onClickFilterSelect, + onClickBookmark = remember { { onClickFilterItem(FilterType.Collect) } }, + onClickPokitName = remember { { onClickFilterItem(FilterType.Pokit) } }, + onClickPeriod = remember { { onClickFilterItem(FilterType.Period) } } + ) + } - HorizontalDivider( - thickness = 6.dp, - color = PokitTheme.colors.backgroundPrimary - ) + HorizontalDivider( + thickness = 6.dp, + color = PokitTheme.colors.backgroundPrimary + ) - if (state.step == SearchScreenStep.RESULT) { - SearchItemList( - modifier = Modifier - .fillMaxWidth() - .weight(1f), - onToggleSort = toggleSortOrder, - useRecentOrder = state.sortRecent, - links = linkList - ) - } + if (state.step == SearchScreenStep.RESULT) { + SearchItemList( + modifier = Modifier + .fillMaxWidth() + .weight(1f), + onToggleSort = toggleSortOrder, + useRecentOrder = state.sortRecent, + links = linkList + ) + } - FilterBottomSheet( - filter = state.filter ?: Filter(), - firstShowType = state.firstBottomSheetFilterType, - show = state.showFilterBottomSheet, - onDismissRequest = hideBottomSheet, - onSaveClilck = onClickFilterSave - ) - } + FilterBottomSheet( + filter = state.filter ?: Filter(), + firstShowType = state.firstBottomSheetFilterType, + show = state.showFilterBottomSheet, + onDismissRequest = hideBottomSheet, + onSaveClilck = onClickFilterSave + ) + } } diff --git a/feature/search/src/main/java/pokitmons/pokit/search/SearchViewModel.kt b/feature/search/src/main/java/pokitmons/pokit/search/SearchViewModel.kt index 9ae07a26..b8c0055a 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/SearchViewModel.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/SearchViewModel.kt @@ -87,7 +87,7 @@ class SearchViewModel : ViewModel() { } } - fun showFilterBottomSheetWithType(type : FilterType) { + fun showFilterBottomSheetWithType(type: FilterType) { _state.update { state -> state.copy( showFilterBottomSheet = true, @@ -112,7 +112,7 @@ class SearchViewModel : ViewModel() { null } else { filter - }, + } ) } diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/atom/CalendarCell.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/atom/CalendarCell.kt index 2da6eb7c..2cb7dc3d 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/atom/CalendarCell.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/atom/CalendarCell.kt @@ -22,7 +22,7 @@ import pokitmons.pokit.search.model.Date internal fun CalendarCellView( date: Date, onClick: ((Date) -> Unit)? = null, - state: CalendarCellState = CalendarCellState.ACTIVE + state: CalendarCellState = CalendarCellState.ACTIVE, ) { val backgroundColor = getBackgroundColor(state = state) val textColor = getTextColor(state = state) @@ -48,7 +48,7 @@ internal fun CalendarCellView( modifier = Modifier.align(Alignment.Center), textAlign = TextAlign.Center, text = date.day.toString(), - style = PokitTheme.typography.body1Medium.copy(color = textColor), + style = PokitTheme.typography.body1Medium.copy(color = textColor) ) } } @@ -58,7 +58,7 @@ enum class CalendarCellState { } @Composable -private fun getTextColor(state: CalendarCellState) : Color { +private fun getTextColor(state: CalendarCellState): Color { return when (state) { CalendarCellState.INACTIVE -> { PokitTheme.colors.textTertiary @@ -76,7 +76,7 @@ private fun getTextColor(state: CalendarCellState) : Color { } @Composable -private fun getBackgroundColor(state: CalendarCellState) : Color { +private fun getBackgroundColor(state: CalendarCellState): Color { return when (state) { CalendarCellState.IN_RANGE -> { Orange100 diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/calendar/Calendar.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/calendar/Calendar.kt index 0255ba1c..d2c92eb2 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/calendar/Calendar.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/calendar/Calendar.kt @@ -43,9 +43,11 @@ internal fun CalendarView( endDate: Date? = null, onClickCell: (Date) -> Unit = {}, ) { - var currentPage by remember { mutableStateOf(calendarPage)} + var currentPage by remember { mutableStateOf(calendarPage) } val calendarCells = remember( - currentPage, startDate, endDate + currentPage, + startDate, + endDate ) { getCells(year = currentPage.year, month = currentPage.month, startDate = startDate, endDate = endDate) } @@ -134,8 +136,7 @@ internal fun CalendarView( onClick = onClickCell, state = CalendarCellState.IN_RANGE ) - } - else { + } else { CalendarCellView( date = cell.date, onClick = onClickCell, @@ -145,5 +146,4 @@ internal fun CalendarView( } } } - } diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/calendar/Preview.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/calendar/Preview.kt index 460c5d39..89781404 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/calendar/Preview.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/calendar/Preview.kt @@ -31,19 +31,21 @@ private fun Preview() { calendarPage = CalendarPage(endDate), startDate = startDate, endDate = endDate, - onClickCell = remember{{ date -> - val currentStartDate = startDate - if (currentStartDate != null && endDate == null) { - if (date <= currentStartDate) { - startDate = date + onClickCell = remember { + { date -> + val currentStartDate = startDate + if (currentStartDate != null && endDate == null) { + if (date <= currentStartDate) { + startDate = date + } else { + endDate = date + } } else { - endDate = date + startDate = date + endDate = null } - } else { - startDate = date - endDate = null - } - }} + } + } ) } } diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/filter/Filter.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/filter/Filter.kt index 69955588..4f18074a 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/filter/Filter.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/filter/Filter.kt @@ -20,8 +20,8 @@ import pokitmons.pokit.core.ui.components.atom.button.attributes.PokitButtonSize import pokitmons.pokit.core.ui.components.atom.button.attributes.PokitButtonStyle import pokitmons.pokit.core.ui.components.atom.button.attributes.PokitButtonType import pokitmons.pokit.search.R -import pokitmons.pokit.core.ui.R.drawable as coreDrawable import pokitmons.pokit.search.model.Filter +import pokitmons.pokit.core.ui.R.drawable as coreDrawable @Composable fun FilterArea( @@ -29,7 +29,7 @@ fun FilterArea( onClickFilter: () -> Unit = {}, onClickPeriod: () -> Unit = {}, onClickPokitName: () -> Unit = {}, - onClickBookmark: () -> Unit = {} + onClickBookmark: () -> Unit = {}, ) { val scrollState = rememberScrollState() diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/filter/Preview.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/filter/Preview.kt index 3ddc2643..176015e0 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/filter/Preview.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/filter/Preview.kt @@ -31,7 +31,7 @@ private fun Preview() { FilterArea( filter = Filter( startDate = Date(year = 2024, month = 7, day = 20), - endDate = Date(year = 2024, month = 7, day = 20), + endDate = Date(year = 2024, month = 7, day = 20) ) ) diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/FilterBottomSheet.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/FilterBottomSheet.kt index 6472df04..648c08ae 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/FilterBottomSheet.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/FilterBottomSheet.kt @@ -40,7 +40,7 @@ fun FilterBottomSheet( onSaveClilck: (Filter) -> Unit = {}, pokits: List = samplePokits, show: Boolean = false, - onDismissRequest: () -> Unit = {} + onDismissRequest: () -> Unit = {}, ) { val bottomSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) var visibility by remember { mutableStateOf(show) } @@ -61,10 +61,12 @@ fun FilterBottomSheet( if (visibility) { ModalBottomSheet( - onDismissRequest = remember{{ - onDismissRequest() - visibility = false - }}, + onDismissRequest = remember { + { + onDismissRequest() + visibility = false + } + }, sheetState = bottomSheetState, scrimColor = Color.Transparent, shape = RoundedCornerShape(topStart = 20.dp, topEnd = 20.dp), @@ -99,5 +101,4 @@ fun FilterBottomSheet( ) } } - } diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/FilterBottomSheetContent.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/FilterBottomSheetContent.kt index cc32d64b..63584cd0 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/FilterBottomSheetContent.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/FilterBottomSheetContent.kt @@ -123,7 +123,7 @@ fun FilterBottomSheetContent( .padding(12.dp) .clickable( indication = null, - interactionSource = remember { MutableInteractionSource() }, + interactionSource = remember { MutableInteractionSource() } ) { currentFilter = currentFilter.copy(bookmark = !currentFilter.bookmark) } @@ -131,7 +131,7 @@ fun FilterBottomSheetContent( ) { PokitCheckbox( checked = currentFilter.bookmark, - onClick = {currentFilter = currentFilter.copy(bookmark = !currentFilter.bookmark)} + onClick = { currentFilter = currentFilter.copy(bookmark = !currentFilter.bookmark) } ) Spacer(modifier = Modifier.width(16.dp)) Text( diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/Preview.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/Preview.kt index 6d498221..16a5bcef 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/Preview.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/filterbottomsheet/Preview.kt @@ -9,7 +9,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import pokitmons.pokit.core.ui.theme.PokitTheme - @Preview(showBackground = true) @Composable private fun Preview() { diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/recentsearchword/RecentSearchWord.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/recentsearchword/RecentSearchWord.kt index f3aef7b5..b15b4939 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/recentsearchword/RecentSearchWord.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/recentsearchword/RecentSearchWord.kt @@ -39,7 +39,6 @@ internal fun RecentSearchWord( .padding(start = 20.dp, end = 20.dp, top = 16.dp, bottom = 28.dp), horizontalAlignment = Alignment.CenterHorizontally ) { - Row( modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically @@ -115,6 +114,5 @@ internal fun RecentSearchWord( } } } - } } diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/searchitemlist/SearchItemList.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/searchitemlist/SearchItemList.kt index fcfad970..c462b3f3 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/searchitemlist/SearchItemList.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/searchitemlist/SearchItemList.kt @@ -21,8 +21,8 @@ import androidx.compose.ui.unit.dp import pokitmons.pokit.core.ui.components.block.linkcard.LinkCard import pokitmons.pokit.core.ui.theme.PokitTheme import pokitmons.pokit.search.model.Link -import pokitmons.pokit.search.R.string as SearchString import pokitmons.pokit.core.ui.R.drawable as coreDrawable +import pokitmons.pokit.search.R.string as SearchString @Composable internal fun SearchItemList( @@ -31,7 +31,7 @@ internal fun SearchItemList( useRecentOrder: Boolean = true, links: List = emptyList(), onClickLinkKebab: (Link) -> Unit = {}, - onClickLink: (Link) -> Unit = {} + onClickLink: (Link) -> Unit = {}, ) { Column( modifier = modifier diff --git a/feature/search/src/main/java/pokitmons/pokit/search/components/toolbar/Toolbar.kt b/feature/search/src/main/java/pokitmons/pokit/search/components/toolbar/Toolbar.kt index 48abec10..40dc69b0 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/components/toolbar/Toolbar.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/components/toolbar/Toolbar.kt @@ -22,8 +22,8 @@ import pokitmons.pokit.core.ui.components.atom.input.PokitInput import pokitmons.pokit.core.ui.components.atom.input.attributes.PokitInputIcon import pokitmons.pokit.core.ui.components.atom.input.attributes.PokitInputIconPosition import pokitmons.pokit.core.ui.components.atom.input.attributes.PokitInputShape -import pokitmons.pokit.search.R.string as SearchString import pokitmons.pokit.core.ui.R.drawable as coreDrawable +import pokitmons.pokit.search.R.string as SearchString @Composable internal fun Toolbar( @@ -40,7 +40,7 @@ internal fun Toolbar( modifier = Modifier .fillMaxWidth() .padding(horizontal = 12.dp, vertical = 8.dp), - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { IconButton( modifier = Modifier.size(40.dp), @@ -60,12 +60,15 @@ internal fun Toolbar( hintText = stringResource(id = SearchString.placeholder_input_search_word), onChangeText = inputSearchWord, shape = PokitInputShape.ROUND, - icon = if (currentSearchWord.isNotEmpty()) + icon = if (currentSearchWord.isNotEmpty()) { PokitInputIcon( position = PokitInputIconPosition.RIGHT, resourceId = coreDrawable.icon_24_x - ) else null, - onClickIcon = remember{ + ) + } else { + null + }, + onClickIcon = remember { { onClickRemove() focusRequester.requestFocus() diff --git a/feature/search/src/main/java/pokitmons/pokit/search/model/CalendarCell.kt b/feature/search/src/main/java/pokitmons/pokit/search/model/CalendarCell.kt index ec0e065c..a19b2db3 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/model/CalendarCell.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/model/CalendarCell.kt @@ -4,5 +4,5 @@ data class CalendarCell( val date: Date = Date(), val selected: Boolean = false, val inSelectRange: Boolean = false, - val currentMonth: Boolean = true + val currentMonth: Boolean = true, ) diff --git a/feature/search/src/main/java/pokitmons/pokit/search/model/CalendarPage.kt b/feature/search/src/main/java/pokitmons/pokit/search/model/CalendarPage.kt index 06288eeb..92a20ebb 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/model/CalendarPage.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/model/CalendarPage.kt @@ -11,7 +11,7 @@ data class CalendarPage( month = date?.month ?: (Calendar.getInstance().get(Calendar.MONTH) + 1) ) - fun prevPage() : CalendarPage { + fun prevPage(): CalendarPage { return if (month == 1) { CalendarPage( year = year - 1, @@ -25,7 +25,7 @@ data class CalendarPage( } } - fun nextPage() : CalendarPage { + fun nextPage(): CalendarPage { return if (month == 12) { CalendarPage( year = year + 1, diff --git a/feature/search/src/main/java/pokitmons/pokit/search/model/Date.kt b/feature/search/src/main/java/pokitmons/pokit/search/model/Date.kt index c5e3168f..aa65a803 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/model/Date.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/model/Date.kt @@ -6,7 +6,7 @@ data class Date( val day: Int = 1, ) : Comparable { override fun compareTo(other: Date): Int { - return compareValuesBy(this, other, {it.year}, {it.month}, {it.day}) + return compareValuesBy(this, other, { it.year }, { it.month }, { it.day }) } override fun toString(): String { diff --git a/feature/search/src/main/java/pokitmons/pokit/search/model/Filter.kt b/feature/search/src/main/java/pokitmons/pokit/search/model/Filter.kt index 6e0eac15..aad44146 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/model/Filter.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/model/Filter.kt @@ -9,9 +9,9 @@ data class Filter( val bookmark: Boolean = false, val notRead: Boolean = false, val startDate: Date? = null, - val endDate: Date? = null + val endDate: Date? = null, ) { - fun addPokit(pokit: Pokit) : Filter { + fun addPokit(pokit: Pokit): Filter { return if (selectedPokits.contains(pokit)) { this } else { @@ -19,9 +19,9 @@ data class Filter( } } - fun getDateString() : String? { + fun getDateString(): String? { return if (startDate != null && endDate != null) { - "${startDate}~${endDate}" + "$startDate~$endDate" } else if (startDate != null) { "$startDate" } else { @@ -34,6 +34,6 @@ data class Filter( } } -enum class FilterType(val stringResourceId : Int, val index : Int) { +enum class FilterType(val stringResourceId: Int, val index: Int) { Pokit(R.string.pokit, 0), Collect(R.string.collect_show, 1), Period(R.string.period, 2) } diff --git a/feature/search/src/main/java/pokitmons/pokit/search/model/SearchScreenState.kt b/feature/search/src/main/java/pokitmons/pokit/search/model/SearchScreenState.kt index 782a2973..034bf214 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/model/SearchScreenState.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/model/SearchScreenState.kt @@ -7,7 +7,7 @@ data class SearchScreenState( val useRecentSearchWord: Boolean = false, val showFilterBottomSheet: Boolean = false, val firstBottomSheetFilterType: FilterType = FilterType.Pokit, - val sortRecent: Boolean = true + val sortRecent: Boolean = true, ) enum class SearchScreenStep { diff --git a/feature/search/src/main/java/pokitmons/pokit/search/utils/CalendarUtils.kt b/feature/search/src/main/java/pokitmons/pokit/search/utils/CalendarUtils.kt index da8f4e62..0e0c3297 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/utils/CalendarUtils.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/utils/CalendarUtils.kt @@ -10,7 +10,7 @@ fun getCells( month: Int, startDate: Date?, endDate: Date?, -) : List { +): List { val cells = getDefaultCalendarCells(year = year, month = month) if (startDate == null && endDate == null) { return cells @@ -29,7 +29,6 @@ fun getCells( return changedCells } - private fun getDayAmountOfMonth(year: Int, month: Int): Int { return when (month) { 2 -> { @@ -50,7 +49,6 @@ private fun getDayAmountOfMonth(year: Int, month: Int): Int { } } - /** * 달력 상에서 이전달에 해당하는 요일의 리스트를 리턴합니다. */ @@ -89,7 +87,7 @@ private fun firstDaysOfNextMonth(year: Int, month: Int): List { return List(8 - startDayOfWeek) { it + 1 } } -private fun getDefaultCalendarCells(year : Int, month: Int) : List { +private fun getDefaultCalendarCells(year: Int, month: Int): List { val lastMonthCells = lastDaysOfPrevMonth(year, month).map { day -> if (month == 1) { CalendarCell(date = Date(year = year - 1, month = 12, day = day), currentMonth = false) diff --git a/feature/search/src/test/java/pokitmons/pokit/search/ExampleUnitTest.kt b/feature/search/src/test/java/pokitmons/pokit/search/ExampleUnitTest.kt index 0ca66c2a..44a19e7b 100644 --- a/feature/search/src/test/java/pokitmons/pokit/search/ExampleUnitTest.kt +++ b/feature/search/src/test/java/pokitmons/pokit/search/ExampleUnitTest.kt @@ -1,8 +1,7 @@ package pokitmons.pokit.search -import org.junit.Test - import org.junit.Assert.assertEquals +import org.junit.Test /** * Example local unit test, which will execute on the development machine (host).