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

View File

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

View File

@ -5,7 +5,9 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
@ -20,6 +22,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.util.padding
import eu.kanade.tachiyomi.R
@ -61,7 +64,7 @@ fun GlobalSearchResultItem(
@Composable
fun GlobalSearchEmptyResultItem() {
Text(
text = stringResource(id = R.string.no_results_found),
text = stringResource(R.string.no_results_found),
modifier = Modifier
.padding(
horizontal = MaterialTheme.padding.medium,
@ -90,12 +93,19 @@ fun GlobalSearchLoadingResultItem() {
fun GlobalSearchErrorResultItem(message: String?) {
Column(
modifier = Modifier
.padding(vertical = MaterialTheme.padding.medium)
.padding(
horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small,
)
.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
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.fillMaxWidth
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -16,6 +17,7 @@ fun GlobalSearchToolbar(
navigateUp: () -> Unit,
onChangeSearchQuery: (String?) -> Unit,
onSearch: (String) -> Unit,
scrollBehavior: TopAppBarScrollBehavior,
) {
Box {
SearchToolbar(
@ -23,6 +25,7 @@ fun GlobalSearchToolbar(
onChangeSearchQuery = onChangeSearchQuery,
onSearch = onSearch,
navigateUp = navigateUp,
scrollBehavior = scrollBehavior,
)
if (progress in 1 until total) {
LinearProgressIndicator(

View File

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