Minor global search UI tweaks

This commit is contained in:
arkon 2022-11-27 15:16:08 -05:00
parent 4f2a794fba
commit 44366ac058
5 changed files with 25 additions and 10 deletions

View file

@ -35,7 +35,7 @@ fun GlobalSearchScreen(
onLongClickItem: (Manga) -> Unit, onLongClickItem: (Manga) -> Unit,
) { ) {
Scaffold( Scaffold(
topBar = { topBar = { scrollBehavior ->
GlobalSearchToolbar( GlobalSearchToolbar(
searchQuery = state.searchQuery, searchQuery = state.searchQuery,
progress = state.progress, progress = state.progress,
@ -43,6 +43,7 @@ fun GlobalSearchScreen(
navigateUp = navigateUp, navigateUp = navigateUp,
onChangeSearchQuery = onChangeSearchQuery, onChangeSearchQuery = onChangeSearchQuery,
onSearch = onSearch, onSearch = onSearch,
scrollBehavior = scrollBehavior,
) )
}, },
) { paddingValues -> ) { paddingValues ->
@ -86,7 +87,7 @@ fun GlobalSearchContent(
is GlobalSearchItemResult.Success -> { is GlobalSearchItemResult.Success -> {
if (result.isEmpty) { if (result.isEmpty) {
Text( Text(
text = stringResource(id = R.string.no_results_found), text = stringResource(R.string.no_results_found),
modifier = Modifier modifier = Modifier
.padding( .padding(
horizontal = MaterialTheme.padding.medium, horizontal = MaterialTheme.padding.medium,

View file

@ -29,7 +29,7 @@ fun MigrateSearchScreen(
onLongClickItem: (Manga) -> Unit, onLongClickItem: (Manga) -> Unit,
) { ) {
Scaffold( Scaffold(
topBar = { topBar = { scrollBehavior ->
GlobalSearchToolbar( GlobalSearchToolbar(
searchQuery = state.searchQuery, searchQuery = state.searchQuery,
progress = state.progress, progress = state.progress,
@ -37,6 +37,7 @@ fun MigrateSearchScreen(
navigateUp = navigateUp, navigateUp = navigateUp,
onChangeSearchQuery = onChangeSearchQuery, onChangeSearchQuery = onChangeSearchQuery,
onSearch = onSearch, onSearch = onSearch,
scrollBehavior = scrollBehavior,
) )
}, },
) { paddingValues -> ) { paddingValues ->

View file

@ -5,7 +5,9 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
@ -20,6 +22,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import eu.kanade.presentation.util.padding import eu.kanade.presentation.util.padding
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -61,7 +64,7 @@ fun GlobalSearchResultItem(
@Composable @Composable
fun GlobalSearchEmptyResultItem() { fun GlobalSearchEmptyResultItem() {
Text( Text(
text = stringResource(id = R.string.no_results_found), text = stringResource(R.string.no_results_found),
modifier = Modifier modifier = Modifier
.padding( .padding(
horizontal = MaterialTheme.padding.medium, horizontal = MaterialTheme.padding.medium,
@ -90,12 +93,19 @@ fun GlobalSearchLoadingResultItem() {
fun GlobalSearchErrorResultItem(message: String?) { fun GlobalSearchErrorResultItem(message: String?) {
Column( Column(
modifier = Modifier modifier = Modifier
.padding(vertical = MaterialTheme.padding.medium) .padding(
horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small,
)
.fillMaxWidth(), .fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
) { ) {
Icon(imageVector = Icons.Outlined.Error, contentDescription = null) Icon(imageVector = Icons.Outlined.Error, contentDescription = null)
Text(text = message ?: stringResource(id = R.string.unknown_error)) Spacer(Modifier.height(4.dp))
Text(
text = message ?: stringResource(R.string.unknown_error),
textAlign = TextAlign.Center,
)
} }
} }

View file

@ -3,6 +3,7 @@ package eu.kanade.presentation.browse.components
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -16,6 +17,7 @@ fun GlobalSearchToolbar(
navigateUp: () -> Unit, navigateUp: () -> Unit,
onChangeSearchQuery: (String?) -> Unit, onChangeSearchQuery: (String?) -> Unit,
onSearch: (String) -> Unit, onSearch: (String) -> Unit,
scrollBehavior: TopAppBarScrollBehavior,
) { ) {
Box { Box {
SearchToolbar( SearchToolbar(
@ -23,6 +25,7 @@ fun GlobalSearchToolbar(
onChangeSearchQuery = onChangeSearchQuery, onChangeSearchQuery = onChangeSearchQuery,
onSearch = onSearch, onSearch = onSearch,
navigateUp = navigateUp, navigateUp = navigateUp,
scrollBehavior = scrollBehavior,
) )
if (progress in 1 until total) { if (progress in 1 until total) {
LinearProgressIndicator( LinearProgressIndicator(

View file

@ -132,7 +132,7 @@ fun MigrateDialog(
AlertDialog( AlertDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
title = { title = {
Text(text = stringResource(id = R.string.migration_dialog_what_to_include)) Text(text = stringResource(R.string.migration_dialog_what_to_include))
}, },
text = { text = {
Column { Column {
@ -155,7 +155,7 @@ fun MigrateDialog(
onDismissRequest() onDismissRequest()
}, },
) { ) {
Text(text = stringResource(id = R.string.action_show_manga)) Text(text = stringResource(R.string.action_show_manga))
} }
TextButton(onClick = { TextButton(onClick = {
scope.launchIO { scope.launchIO {
@ -165,7 +165,7 @@ fun MigrateDialog(
} }
} }
},) { },) {
Text(text = stringResource(id = R.string.copy)) Text(text = stringResource(R.string.copy))
} }
TextButton(onClick = { TextButton(onClick = {
scope.launchIO { scope.launchIO {
@ -179,7 +179,7 @@ fun MigrateDialog(
} }
} }
},) { },) {
Text(text = stringResource(id = R.string.migrate)) Text(text = stringResource(R.string.migrate))
} }
} }
}, },