Add missing 1dp separator to some action bar components

This commit is contained in:
Aleksandras Kostarevas 2024-07-22 01:43:06 +03:00
parent 02388e7388
commit 9c37a40006

View File

@ -644,6 +644,20 @@ fun RowScope.PinnedActionItems(onSelect: (Action) -> Unit, onLongSelect: (Action
}
}
@Composable
fun ActionSep() {
val sepCol = if(!LocalInspectionMode.current) {
Color(LocalThemeProvider.current.keyColor)
} else {
MaterialTheme.colorScheme.surfaceVariant
}
Box(modifier = Modifier
.fillMaxWidth()
.height(1.dp)
.background(sepCol)) {}
}
@Composable
fun ActionBar(
words: SuggestedWords?,
@ -661,20 +675,11 @@ fun ActionBar(
val actionBarHeight = 40.dp
val sepCol = if(!LocalInspectionMode.current) {
Color(LocalThemeProvider.current.keyColor)
} else {
MaterialTheme.colorScheme.surfaceVariant
}
val oldActionBar = useDataStore(OldStyleActionsBar)
Column {
if(isActionsExpanded && !oldActionBar.value) {
Box(modifier = Modifier
.fillMaxWidth()
.height(1.dp)
.background(sepCol)) {}
ActionSep()
Surface(
modifier = Modifier
@ -685,10 +690,7 @@ fun ActionBar(
}
}
Box(modifier = Modifier
.fillMaxWidth()
.height(1.dp)
.background(sepCol)) {}
ActionSep()
Surface(
modifier = Modifier
@ -706,7 +708,9 @@ fun ActionBar(
}
if(oldActionBar.value && isActionsExpanded) {
Box(modifier = Modifier.weight(1.0f).fillMaxHeight()) {
Box(modifier = Modifier
.weight(1.0f)
.fillMaxHeight()) {
ActionItems(onActionActivated, onActionAltActivated)
}
} else {
@ -759,6 +763,8 @@ fun ActionWindowBar(
onBack: () -> Unit,
onExpand: () -> Unit
) {
Column {
ActionSep()
Surface(
modifier = Modifier
.fillMaxWidth()
@ -788,6 +794,7 @@ fun ActionWindowBar(
}
}
}
}
@Composable
fun CollapsibleSuggestionsBar(
@ -796,9 +803,13 @@ fun CollapsibleSuggestionsBar(
words: SuggestedWords?,
suggestionStripListener: SuggestionStripView.Listener,
) {
Surface(modifier = Modifier
Column {
ActionSep()
Surface(
modifier = Modifier
.fillMaxWidth()
.height(40.dp), color = MaterialTheme.colorScheme.background)
.height(40.dp), color = MaterialTheme.colorScheme.background
)
{
Row {
val color = MaterialTheme.colorScheme.primary
@ -821,11 +832,14 @@ fun CollapsibleSuggestionsBar(
}
if (words != null) {
SuggestionItems(words, onClick = {
SuggestionItems(
words,
onClick = {
suggestionStripListener.pickSuggestionManually(
words.getInfo(it)
)
}, onLongClick = { suggestionStripListener.requestForgetWord(words.getInfo(it)) })
},
onLongClick = { suggestionStripListener.requestForgetWord(words.getInfo(it)) })
} else {
Spacer(modifier = Modifier.weight(1.0f))
}
@ -845,6 +859,7 @@ fun CollapsibleSuggestionsBar(
}
}
}
}