|
@@ -1,6 +1,7 @@
|
|
|
package eu.kanade.presentation.components
|
|
|
|
|
|
import androidx.compose.animation.AnimatedVisibility
|
|
|
+import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
import androidx.compose.foundation.layout.RowScope
|
|
|
import androidx.compose.foundation.layout.WindowInsets
|
|
@@ -20,6 +21,7 @@ import androidx.compose.material3.Icon
|
|
|
import androidx.compose.material3.IconButton
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
import androidx.compose.material3.Text
|
|
|
+import androidx.compose.material3.TextFieldDefaults
|
|
|
import androidx.compose.material3.TopAppBar
|
|
|
import androidx.compose.material3.TopAppBarDefaults
|
|
|
import androidx.compose.material3.TopAppBarScrollBehavior
|
|
@@ -38,8 +40,10 @@ import androidx.compose.ui.graphics.SolidColor
|
|
|
import androidx.compose.ui.graphics.vector.ImageVector
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
import androidx.compose.ui.text.font.FontWeight
|
|
|
+import androidx.compose.ui.text.input.VisualTransformation
|
|
|
import androidx.compose.ui.text.style.TextOverflow
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
+import androidx.compose.ui.unit.sp
|
|
|
import eu.kanade.tachiyomi.R
|
|
|
|
|
|
@Composable
|
|
@@ -63,7 +67,10 @@ fun AppBar(
|
|
|
|
|
|
scrollBehavior: TopAppBarScrollBehavior? = null,
|
|
|
) {
|
|
|
- val isActionMode by derivedStateOf { actionModeCounter > 0 }
|
|
|
+ val isActionMode by remember(actionModeCounter) {
|
|
|
+ derivedStateOf { actionModeCounter > 0 }
|
|
|
+ }
|
|
|
+
|
|
|
AppBar(
|
|
|
modifier = modifier,
|
|
|
titleContent = {
|
|
@@ -216,6 +223,7 @@ fun AppBarActions(
|
|
|
fun SearchToolbar(
|
|
|
searchQuery: String,
|
|
|
onChangeSearchQuery: (String) -> Unit,
|
|
|
+ placeholderText: String? = null,
|
|
|
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
|
|
|
keyboardActions: KeyboardActions = KeyboardActions.Default,
|
|
|
onClickCloseSearch: () -> Unit,
|
|
@@ -223,8 +231,11 @@ fun SearchToolbar(
|
|
|
incognitoMode: Boolean = false,
|
|
|
downloadedOnlyMode: Boolean = false,
|
|
|
scrollBehavior: TopAppBarScrollBehavior? = null,
|
|
|
+ visualTransformation: VisualTransformation = VisualTransformation.None,
|
|
|
+ interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
|
|
) {
|
|
|
val focusRequester = remember { FocusRequester() }
|
|
|
+
|
|
|
AppBar(
|
|
|
titleContent = {
|
|
|
BasicTextField(
|
|
@@ -233,11 +244,40 @@ fun SearchToolbar(
|
|
|
modifier = Modifier
|
|
|
.fillMaxWidth()
|
|
|
.focusRequester(focusRequester),
|
|
|
- textStyle = MaterialTheme.typography.bodyMedium.copy(color = MaterialTheme.colorScheme.onBackground),
|
|
|
+ textStyle = MaterialTheme.typography.titleMedium.copy(
|
|
|
+ color = MaterialTheme.colorScheme.onBackground,
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ fontSize = 18.sp,
|
|
|
+ ),
|
|
|
keyboardOptions = keyboardOptions,
|
|
|
keyboardActions = keyboardActions,
|
|
|
singleLine = true,
|
|
|
cursorBrush = SolidColor(MaterialTheme.colorScheme.onBackground),
|
|
|
+ visualTransformation = visualTransformation,
|
|
|
+ interactionSource = interactionSource,
|
|
|
+ decorationBox = { innerTextField ->
|
|
|
+ TextFieldDefaults.TextFieldDecorationBox(
|
|
|
+ value = searchQuery,
|
|
|
+ innerTextField = innerTextField,
|
|
|
+ enabled = true,
|
|
|
+ singleLine = true,
|
|
|
+ visualTransformation = visualTransformation,
|
|
|
+ interactionSource = interactionSource,
|
|
|
+ placeholder = {
|
|
|
+ if (!placeholderText.isNullOrEmpty()) {
|
|
|
+ Text(
|
|
|
+ text = placeholderText,
|
|
|
+ maxLines = 1,
|
|
|
+ overflow = TextOverflow.Ellipsis,
|
|
|
+ style = MaterialTheme.typography.titleMedium.copy(
|
|
|
+ fontSize = 18.sp,
|
|
|
+ fontWeight = FontWeight.Normal,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ )
|
|
|
+ },
|
|
|
)
|
|
|
},
|
|
|
navigationIcon = Icons.Outlined.ArrowBack,
|