Restore pageRange advanced options
This commit is contained in:
1 parent
1690651428
commit
62c3e9fd99
3 files changed
+27
-3
No files matched your search
@@ -159,8 +159,8 @@ class SearchLayout @JvmOverloads constructor(
|
||||
if (isAdvancedMode) {
|
||||
urlBuilder.advanceSearch = advancedState.advanceSearch
|
||||
urlBuilder.minRating = advancedState.minRating
|
||||
val pageFrom = advancedState.page.first
|
||||
val pageTo = advancedState.page.last
|
||||
val pageFrom = advancedState.fromPage
|
||||
val pageTo = advancedState.toPage
|
||||
if (pageTo != -1 && pageTo < 10) {
|
||||
throw EhException(context.getString(R.string.search_sp_err1))
|
||||
} else if (pageFrom != -1 && pageTo != -1 && pageTo - pageFrom < 20) {
|
||||
|
||||
@@ -11,5 +11,6 @@ object AdvanceTable {
|
||||
data class AdvancedSearchOption(
|
||||
val advanceSearch: Int = 0,
|
||||
val minRating: Int = 0,
|
||||
val page: IntRange = -1..-1,
|
||||
val fromPage: Int = -1,
|
||||
val toPage: Int = -1,
|
||||
)
|
||||
@@ -2,6 +2,8 @@ package com.hippo.ehviewer.ui.main
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.text.BasicTextField
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material3.Checkbox
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExposedDropdownMenuBox
|
||||
@@ -14,11 +16,13 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringArrayResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import com.hippo.ehviewer.R
|
||||
|
||||
@Composable
|
||||
@@ -72,6 +76,25 @@ fun SearchAdvanced(
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
var enabled by rememberSaveable { mutableStateOf(false) }
|
||||
Checkbox(checked = enabled, onCheckedChange = { enabled = it })
|
||||
Text(text = stringResource(id = R.string.search_sp), modifier = Modifier.align(Alignment.CenterVertically))
|
||||
BasicTextField(
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||
value = if (enabled && state.fromPage != -1) state.fromPage.toString() else "",
|
||||
onValueChange = { onStateChanged(state.copy(fromPage = it.toInt())) },
|
||||
enabled = enabled,
|
||||
)
|
||||
Text(text = stringResource(id = R.string.search_sp_to), modifier = Modifier.align(Alignment.CenterVertically))
|
||||
BasicTextField(
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||
value = if (enabled && state.toPage != -1) state.toPage.toString() else "",
|
||||
onValueChange = { onStateChanged(state.copy(toPage = it.toInt())) },
|
||||
enabled = enabled,
|
||||
)
|
||||
Text(text = stringResource(id = R.string.search_sp_suffix), modifier = Modifier.align(Alignment.CenterVertically))
|
||||
}
|
||||
Text(text = stringResource(id = R.string.search_sf))
|
||||
Row {
|
||||
Row(modifier = Modifier.weight(1f)) {
|
||||
|
||||
Reference in new issue
Block a user