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())
.forEach { toolbarKeys.add(createToolbarKey(context, KeyboardIconsSet.instance, it)) }
keyboardAttr.recycle()
fitsSystemWindows = true
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {

View file

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

View file

@ -20,6 +20,7 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
@ -58,36 +59,41 @@ fun SearchSettingsScreen(
content = {
if (content != null) content()
else {
Column(Modifier.verticalScroll(rememberScrollState())) {
settings.forEach {
if (it is Int) {
PreferenceCategory(stringResource(it))
} else {
// 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()
Scaffold { innerPadding ->
Column(
Modifier.verticalScroll(rememberScrollState())
.then(Modifier.padding(bottom = innerPadding.calculateBottomPadding()))
) {
settings.forEach {
if (it is Int) {
PreferenceCategory(stringResource(it))
} else {
// 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) },