Use setFitsSystemWindows in all keyboard views.

Fix last item on settings screens.
This commit is contained in:
eranl 2025-04-14 23:49:47 +03:00
parent 2cba77cdee
commit 988c99aeae
3 changed files with 34 additions and 26 deletions

View file

@ -71,6 +71,7 @@ class ClipboardHistoryView @JvmOverloads constructor(
getEnabledClipboardToolbarKeys(context.prefs()) getEnabledClipboardToolbarKeys(context.prefs())
.forEach { toolbarKeys.add(createToolbarKey(context, KeyboardIconsSet.instance, it)) } .forEach { toolbarKeys.add(createToolbarKey(context, KeyboardIconsSet.instance, it)) }
keyboardAttr.recycle() keyboardAttr.recycle()
fitsSystemWindows = true
} }
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {

View file

@ -105,6 +105,7 @@ public final class EmojiPalettesView extends LinearLayout
R.styleable.EmojiPalettesView_categoryPageIndicatorColor, 0); R.styleable.EmojiPalettesView_categoryPageIndicatorColor, 0);
emojiPalettesViewAttr.recycle(); emojiPalettesViewAttr.recycle();
mEmojiLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false); mEmojiLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false);
setFitsSystemWindows(true);
} }
@Override @Override

View file

@ -20,6 +20,7 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextField import androidx.compose.material3.TextField
@ -58,36 +59,41 @@ fun SearchSettingsScreen(
content = { content = {
if (content != null) content() if (content != null) content()
else { else {
Column(Modifier.verticalScroll(rememberScrollState())) { Scaffold { innerPadding ->
settings.forEach { Column(
if (it is Int) { Modifier.verticalScroll(rememberScrollState())
PreferenceCategory(stringResource(it)) .then(Modifier.padding(bottom = innerPadding.calculateBottomPadding()))
} else { ) {
// this only animates appearing prefs settings.forEach {
// a solution would be using a list(visible to key) if (it is Int) {
AnimatedVisibility(visible = it != null) { PreferenceCategory(stringResource(it))
if (it != null) } else {
SettingsActivity.settingsContainer[it]?.Preference() // this only animates appearing prefs
// a solution would be using a list(visible to key)
AnimatedVisibility(visible = it != null) {
if (it != null)
SettingsActivity.settingsContainer[it]?.Preference()
}
} }
} }
} }
// lazyColumn has janky scroll for a while (not sure why compose gets smoother after a while)
// maybe related to unnecessary recompositions? but even for just displaying text it's there
// didn't manage to improve things with @Immutable list wrapper and other lazy list hints
// so for now: just use "normal" Column
// even though it takes up to ~50% longer to load it's much better UX
// and the missing appear animations could be added
// LazyColumn {
// items(prefs.filterNotNull(), key = { it }) {
// Box(Modifier.animateItem()) {
// if (it is Int)
// PreferenceCategory(stringResource(it))
// else
// SettingsActivity.settingsContainer[it]!!.Preference()
// }
// }
// }
} }
// lazyColumn has janky scroll for a while (not sure why compose gets smoother after a while)
// maybe related to unnecessary recompositions? but even for just displaying text it's there
// didn't manage to improve things with @Immutable list wrapper and other lazy list hints
// so for now: just use "normal" Column
// even though it takes up to ~50% longer to load it's much better UX
// and the missing appear animations could be added
// LazyColumn {
// items(prefs.filterNotNull(), key = { it }) {
// Box(Modifier.animateItem()) {
// if (it is Int)
// PreferenceCategory(stringResource(it))
// else
// SettingsActivity.settingsContainer[it]!!.Preference()
// }
// }
// }
} }
}, },
filteredItems = { SettingsActivity.settingsContainer.filter(it) }, filteredItems = { SettingsActivity.settingsContainer.filter(it) },