Fix minRating advanced search
This commit is contained in:
1 parent
b9e1d79be6
commit
2b8bfab44b
2 files changed
+4
-3
No files matched your search
@@ -10,7 +10,7 @@ object AdvanceTable {
|
||||
|
||||
data class AdvancedSearchOption(
|
||||
val advanceSearch: Int = 0,
|
||||
val minRating: Int = 0,
|
||||
val minRating: Int = -1,
|
||||
val fromPage: Int = -1,
|
||||
val toPage: Int = -1,
|
||||
)
|
||||
@@ -59,7 +59,7 @@ fun SearchAdvanced(
|
||||
OutlinedTextField(
|
||||
modifier = Modifier.menuAnchor(),
|
||||
readOnly = true,
|
||||
value = minRatingItems[state.minRating],
|
||||
value = minRatingItems[if (state.minRating in 2..5) state.minRating - 1 else 0],
|
||||
onValueChange = {},
|
||||
label = { Text(stringResource(id = R.string.search_sr)) },
|
||||
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) },
|
||||
@@ -77,7 +77,8 @@ fun SearchAdvanced(
|
||||
text = { Text(selectionOption) },
|
||||
onClick = {
|
||||
expanded = false
|
||||
onStateChanged(state.copy(minRating = minRatingItems.indexOf(selectionOption)))
|
||||
val index = minRatingItems.indexOf(selectionOption)
|
||||
onStateChanged(state.copy(minRating = if (index > 0) index + 1 else -1))
|
||||
},
|
||||
contentPadding = ExposedDropdownMenuDefaults.ItemContentPadding,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user