mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-28 10:38:08 +00:00
better behavior when keyboard is shown
This commit is contained in:
parent
ae461fe8b6
commit
edc883adf3
7 changed files with 36 additions and 35 deletions
|
@ -76,6 +76,7 @@ SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
|
||||||
|
|
||||||
<activity android:name="helium314.keyboard.settings.SettingsActivity2"
|
<activity android:name="helium314.keyboard.settings.SettingsActivity2"
|
||||||
android:theme="@style/platformActivityTheme"
|
android:theme="@style/platformActivityTheme"
|
||||||
|
android:windowSoftInputMode="adjustResize"
|
||||||
android:label="@string/ime_settings"
|
android:label="@string/ime_settings"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|
|
@ -69,7 +69,6 @@ fun SearchPrefScreen(
|
||||||
}
|
}
|
||||||
Surface(
|
Surface(
|
||||||
color = MaterialTheme.colorScheme.surfaceContainer,
|
color = MaterialTheme.colorScheme.surfaceContainer,
|
||||||
//shadowElevation = TopAppBarDefaults.??
|
|
||||||
) {
|
) {
|
||||||
Column {
|
Column {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
|
@ -99,10 +98,9 @@ fun SearchPrefScreen(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
//colors = TextFieldDefaults.colors(
|
colors = TextFieldDefaults.colors(
|
||||||
// textColor = MaterialTheme.colorScheme.onSurface,
|
focusedContainerColor = MaterialTheme.colorScheme.surface
|
||||||
// backgroundColor = MaterialTheme.colorScheme.surface
|
)
|
||||||
//)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,11 +120,7 @@ fun SearchPrefScreen(
|
||||||
else
|
else
|
||||||
CompositionLocalProvider(LocalTextStyle provides MaterialTheme.typography.bodyLarge) {
|
CompositionLocalProvider(LocalTextStyle provides MaterialTheme.typography.bodyLarge) {
|
||||||
val filteredPrefs = SettingsActivity2.allPrefs.filter(searchText.text)
|
val filteredPrefs = SettingsActivity2.allPrefs.filter(searchText.text)
|
||||||
LazyColumn(
|
LazyColumn {
|
||||||
//state = listState, // better not, remembering scroll state when changing search term feels wrong
|
|
||||||
// todo: scrolling should consider keyboard, but not working, from https://developer.android.com/develop/ui/compose/layouts/insets#ime-animations
|
|
||||||
//modifier = Modifier.imePadding().imeNestedScroll()
|
|
||||||
) {
|
|
||||||
items(filteredPrefs) {
|
items(filteredPrefs) {
|
||||||
it.Preference()
|
it.Preference()
|
||||||
}
|
}
|
||||||
|
@ -192,20 +186,15 @@ fun <T: Any> SearchScreen(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
//colors = TextFieldDefaults.colors(
|
colors = TextFieldDefaults.colors(
|
||||||
// textColor = MaterialTheme.colorScheme.onSurface,
|
focusedContainerColor = MaterialTheme.colorScheme.surface
|
||||||
// backgroundColor = MaterialTheme.colorScheme.surface
|
)
|
||||||
//)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CompositionLocalProvider(LocalTextStyle provides MaterialTheme.typography.bodyLarge) {
|
CompositionLocalProvider(LocalTextStyle provides MaterialTheme.typography.bodyLarge) {
|
||||||
val filteredItems = items.filter { filter(searchText.text, it) }
|
val filteredItems = items.filter { filter(searchText.text, it) }
|
||||||
LazyColumn(
|
LazyColumn {
|
||||||
//state = listState, // better not, remembering scroll state when changing search term feels wrong
|
|
||||||
// todo: scrolling should consider keyboard, but not working, from https://developer.android.com/develop/ui/compose/layouts/insets#ime-animations
|
|
||||||
//modifier = Modifier.imePadding().imeNestedScroll()
|
|
||||||
) {
|
|
||||||
items(filteredItems) {
|
items(filteredItems) {
|
||||||
itemContent(it)
|
itemContent(it)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,18 +14,11 @@ import helium314.keyboard.latin.utils.prefs
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
// todo (roughly in order)
|
// todo (roughly in order)
|
||||||
// make all prefs actually work
|
// try making a dialog with reduced padding
|
||||||
// advanced (not much)
|
// avoid duplicate code in SearchScreen
|
||||||
// try moving the recomposition of pref change somewhere else, so it's not duplicated everywhere
|
// work on todos in other files
|
||||||
// make the pref lists more compact (compare with old settings)
|
|
||||||
// try making text size similar to old state (also in dialogs)
|
|
||||||
// more similar dialog style args (for all dialogs, or for none)
|
|
||||||
// check whether dialogs have the same colors, i think currently it's a bit inconsistent
|
|
||||||
// see all the properties for each alertDialog -> any way to set it in a single place?
|
|
||||||
// title too huge for bg image and text on spacebar dialogs, also maybe somewhere else -> where to set in one place?
|
|
||||||
// check dark and light theme (don't have dynamic)
|
// check dark and light theme (don't have dynamic)
|
||||||
// rename both settingsActivities
|
// rename both settingsActivities
|
||||||
// work on todos in other files
|
|
||||||
// calling KeyboardSwitcher.getInstance().forceUpdateKeyboardTheme(requireContext()) while keyboard is showing shows just full screen background
|
// calling KeyboardSwitcher.getInstance().forceUpdateKeyboardTheme(requireContext()) while keyboard is showing shows just full screen background
|
||||||
// but reload while keyboard is showing would be great (isn't it at least semi-done when changing one-handed mode?)
|
// but reload while keyboard is showing would be great (isn't it at least semi-done when changing one-handed mode?)
|
||||||
// use better / more structured and clear names and arrangement of files
|
// use better / more structured and clear names and arrangement of files
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package helium314.keyboard.settings.dialogs
|
package helium314.keyboard.settings.dialogs
|
||||||
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.compose.foundation.layout.imePadding
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.utils.Log
|
import helium314.keyboard.latin.utils.Log
|
||||||
|
@ -46,5 +48,6 @@ fun CustomizeLayoutDialog(
|
||||||
valid
|
valid
|
||||||
},
|
},
|
||||||
singleLine = false,
|
singleLine = false,
|
||||||
|
modifier = Modifier.imePadding()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,12 @@ import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.material3.contentColorFor
|
import androidx.compose.material3.contentColorFor
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
|
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.tooling.preview.Preview
|
||||||
import androidx.compose.ui.window.DialogProperties
|
import androidx.compose.ui.window.DialogProperties
|
||||||
|
import helium314.keyboard.settings.Theme
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ThreeButtonAlertDialog(
|
fun ThreeButtonAlertDialog(
|
||||||
|
@ -55,6 +58,19 @@ fun ThreeButtonAlertDialog(
|
||||||
shape = MaterialTheme.shapes.medium,
|
shape = MaterialTheme.shapes.medium,
|
||||||
containerColor = MaterialTheme.colorScheme.surface,
|
containerColor = MaterialTheme.colorScheme.surface,
|
||||||
textContentColor = contentColorFor(MaterialTheme.colorScheme.surface),
|
textContentColor = contentColorFor(MaterialTheme.colorScheme.surface),
|
||||||
properties = DialogProperties(),
|
properties = DialogProperties(decorFitsSystemWindows = false), // otherwise Modifier.imePadding() is ignored
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
Theme {
|
||||||
|
ThreeButtonAlertDialog(
|
||||||
|
onDismissRequest = {},
|
||||||
|
onConfirmed = { },
|
||||||
|
text = { Text("hello") },
|
||||||
|
title = { Text("title") },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -110,9 +110,9 @@ fun AdvancedSettingsScreen(
|
||||||
SettingsActivity2.allPrefs.map[Settings.PREF_ENABLE_EMOJI_ALT_PHYSICAL_KEY]!!.Preference()
|
SettingsActivity2.allPrefs.map[Settings.PREF_ENABLE_EMOJI_ALT_PHYSICAL_KEY]!!.Preference()
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
|
||||||
SettingsActivity2.allPrefs.map[Settings.PREF_SHOW_SETUP_WIZARD_ICON]!!.Preference()
|
SettingsActivity2.allPrefs.map[Settings.PREF_SHOW_SETUP_WIZARD_ICON]!!.Preference()
|
||||||
SettingsActivity2.allPrefs.map[Settings.PREF_ABC_AFTER_SYMBOL_SPACE]!!.Preference() // todo: this is ugly
|
SettingsActivity2.allPrefs.map[Settings.PREF_ABC_AFTER_SYMBOL_SPACE]!!.Preference()
|
||||||
SettingsActivity2.allPrefs.map[Settings.PREF_ABC_AFTER_EMOJI]!!.Preference() // todo: this is ugly
|
SettingsActivity2.allPrefs.map[Settings.PREF_ABC_AFTER_EMOJI]!!.Preference()
|
||||||
SettingsActivity2.allPrefs.map[Settings.PREF_ABC_AFTER_CLIP]!!.Preference() // todo: this is ugly
|
SettingsActivity2.allPrefs.map[Settings.PREF_ABC_AFTER_CLIP]!!.Preference()
|
||||||
SettingsActivity2.allPrefs.map[Settings.PREF_CUSTOM_CURRENCY_KEY]!!.Preference()
|
SettingsActivity2.allPrefs.map[Settings.PREF_CUSTOM_CURRENCY_KEY]!!.Preference()
|
||||||
SettingsActivity2.allPrefs.map[Settings.PREF_MORE_POPUP_KEYS]!!.Preference()
|
SettingsActivity2.allPrefs.map[Settings.PREF_MORE_POPUP_KEYS]!!.Preference()
|
||||||
SettingsActivity2.allPrefs.map[NonSettingsPrefs.CUSTOM_SYMBOLS_NUMBER_LAYOUTS]!!.Preference()
|
SettingsActivity2.allPrefs.map[NonSettingsPrefs.CUSTOM_SYMBOLS_NUMBER_LAYOUTS]!!.Preference()
|
||||||
|
|
|
@ -34,7 +34,6 @@ import helium314.keyboard.latin.utils.DeviceProtectedUtils
|
||||||
import helium314.keyboard.latin.utils.Log
|
import helium314.keyboard.latin.utils.Log
|
||||||
import helium314.keyboard.latin.utils.getActivity
|
import helium314.keyboard.latin.utils.getActivity
|
||||||
import helium314.keyboard.latin.utils.getStringResourceOrName
|
import helium314.keyboard.latin.utils.getStringResourceOrName
|
||||||
import helium314.keyboard.latin.utils.infoDialog
|
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.latin.utils.switchTo
|
import helium314.keyboard.latin.utils.switchTo
|
||||||
import helium314.keyboard.settings.AllPrefs
|
import helium314.keyboard.settings.AllPrefs
|
||||||
|
|
Loading…
Add table
Reference in a new issue