There was an error while loading. Please reload this page.
1 parent 5b67a7a commit 1f64122Copy full SHA for 1f64122
1 file changed
app/src/main/kotlin/org/fossify/notes/fragments/TextFragment.kt
@@ -206,9 +206,17 @@ class TextFragment : NoteFragment() {
206
}
207
208
private fun setupKeyboardListener() {
209
- requireActivity().window.decorView.setOnApplyWindowInsetsListener { view, insets ->
210
- scrollToEndOfNote()
211
- view.onApplyWindowInsets(insets)
+ requireActivity().window.decorView.apply {
+ setOnApplyWindowInsetsListener { view, insets ->
+ val windowInsets = WindowInsetsCompat.toWindowInsetsCompat(insets)
212
+ if (windowInsets.isVisible(WindowInsetsCompat.Type.ime())) {
213
+ if (config!!.placeCursorToEnd) {
214
+ scrollToEndOfNote()
215
+ }
216
+ setOnApplyWindowInsetsListener(null) // clear to avoid scrolling every time
217
218
+ view.onApplyWindowInsets(insets)
219
220
221
222
0 commit comments