Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into mod/#143-mod-today…
Browse files Browse the repository at this point in the history
…-empty
  • Loading branch information
Hyobeen-Park committed Jul 18, 2024
2 parents 8540ff6 + 5c4183b commit b34dbe0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.terning.core.designsystem.component.textfield
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.text.input.ImeAction
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.Grey400
Expand All @@ -18,8 +20,11 @@ fun SearchTextField(
leftIcon: Int,
enabled: Boolean = true,
readOnly: Boolean = false,
onDoneAction: (() -> Unit)? = null,
onSearchAction: () -> Unit? = {},
) {
val keyboardController = LocalSoftwareKeyboardController.current
val focusManager = LocalFocusManager.current

TerningBasicTextField(
value = text,
onValueChange = onValueChange,
Expand All @@ -33,14 +38,17 @@ fun SearchTextField(
hintColor = Grey300,
leftIcon = leftIcon,
leftIconColor = TerningMain,
imeAction = if (text.isNotBlank()) {
ImeAction.Search
} else {
ImeAction.Done
},
imeAction = ImeAction.Search,
enabled = enabled,
readOnly = readOnly,
onDoneAction = onDoneAction,
onSearchAction = {
if (text.isNotBlank()) {
keyboardController?.hide()
keyboardController?.hide()
focusManager.clearFocus()
onSearchAction()
}
},
helperColor = TerningMain
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.ImeAction
Expand All @@ -46,7 +44,7 @@ fun TerningBasicTextField(
strokeWidth: Float = 1f,
leftIcon: Int? = null,
leftIconColor: Color = TerningMain,
imeAction: ImeAction? = ImeAction.Done,
imeAction: ImeAction = ImeAction.Done,
maxTextLength: Int? = null,
showTextLength: Boolean = false,
hint: String = "",
Expand All @@ -55,30 +53,24 @@ fun TerningBasicTextField(
enabled: Boolean = true,
helperColor: Color,
readOnly: Boolean = false,
onDoneAction: (() -> Unit)? = null,
onDoneAction: () -> Unit? = {},
onSearchAction: () -> Unit? = {},
) {
val keyboardController = LocalSoftwareKeyboardController.current
val focusManager = LocalFocusManager.current
val isFocused: MutableState<Boolean> = remember { mutableStateOf(false) }

BasicTextField(
value = value,
onValueChange = onValueChange,
onValueChange = {
if (maxTextLength == null || it.length <= maxTextLength) {
onValueChange(it)
}
},
singleLine = true,
maxLines = 1,
keyboardOptions = KeyboardOptions(
imeAction = imeAction ?: ImeAction.Done
),
keyboardOptions = KeyboardOptions(imeAction = imeAction),
keyboardActions = KeyboardActions(
onDone = {
if (value.isNotBlank()) {
keyboardController?.hide()
focusManager.clearFocus()
if (onDoneAction != null) {
onDoneAction()
}
}
}
onDone = { onDoneAction() },
onSearch = { onSearchAction() },
),

modifier = modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fun HomeRoute(
}
}

LaunchedEffect(currentSortBy.value) {
LaunchedEffect(homeFilteringState, currentSortBy.value) {
when (homeFilteringState) {
is UiState.Success ->
with((homeFilteringState as UiState.Success<HomeFilteringInfoModel>).data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ class HomeViewModel @Inject constructor(
getProfile()
getFilteringInfo()
getHomeTodayInternList()
getRecommendInternsData(
sortBy = _homeSortByState.value,
startYear = 2024,
startMonth = 8,
)
}

fun getRecommendInternsData(sortBy: Int, startYear: Int, startMonth: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fun SearchProcessScreen(
.padding(top = 8.dp)
.focusRequester(focusRequester)
.addFocusCleaner(focusManager),
onDoneAction = {
onSearchAction = {
viewModel.getSearchList(
keyword = state.text,
sortBy = SORT_BY,
Expand Down

0 comments on commit b34dbe0

Please sign in to comment.