Skip to content

Commit 2c03abc

Browse files
hacky delayed scroll, has to be a better way
1 parent 1f605e2 commit 2c03abc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/src/main/kotlin/org/fossify/notes/activities/MainActivity.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import android.util.TypedValue
2323
import android.view.ActionMode
2424
import android.view.Gravity
2525
import android.view.MenuItem
26-
import android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE
27-
import android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
2826
import android.view.inputmethod.EditorInfo
2927
import android.webkit.WebResourceRequest
3028
import android.webkit.WebView
@@ -551,7 +549,6 @@ class MainActivity : SimpleActivity() {
551549
}
552550

553551
private fun initViewPager(wantedNoteId: Long? = null) {
554-
window.setSoftInputMode(SOFT_INPUT_STATE_VISIBLE or SOFT_INPUT_ADJUST_PAN)
555552
NotesHelper(this).getNotes { notes ->
556553
notes.filter { it.shouldBeUnlocked(this) }
557554
.forEach(::removeProtection)

app/src/main/kotlin/org/fossify/notes/fragments/TextFragment.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package org.fossify.notes.fragments
22

33
import android.annotation.SuppressLint
44
import android.content.Context
5+
import android.graphics.Rect
56
import android.graphics.Typeface
67
import android.os.Bundle
78
import android.text.Editable
@@ -169,6 +170,12 @@ class TextFragment : NoteFragment() {
169170
requestFocus()
170171
val inputManager = requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
171172
inputManager.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
173+
174+
val rect = Rect()
175+
noteEditText.getFocusedRect(rect)
176+
binding.notesScrollview.postDelayed({
177+
binding.notesScrollview.smoothScrollTo(0, rect.bottom)
178+
}, 1000)
172179
}
173180
}
174181
}

0 commit comments

Comments
 (0)