mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-14 18:57:07 -07:00
Fix Regist Scrolling on Android harder
This commit is contained in:
parent
e368a82e8f
commit
4f60ceb1d4
1 changed files with 4 additions and 1 deletions
|
@ -60,8 +60,11 @@ class RegistExecuteActivity: AppCompatActivity()
|
|||
logTextView.movementMethod = ScrollingMovementMethod()
|
||||
viewModel.logText.observe(this, Observer {
|
||||
val textLayout = logTextView.layout ?: return@Observer
|
||||
val lineCount = textLayout.lineCount
|
||||
if(lineCount < 1)
|
||||
return@Observer
|
||||
logTextView.text = it
|
||||
val scrollY = textLayout.getLineBottom(logTextView.lineCount - 1) - logTextView.height + logTextView.paddingTop + logTextView.paddingBottom
|
||||
val scrollY = textLayout.getLineBottom(lineCount - 1) - logTextView.height + logTextView.paddingTop + logTextView.paddingBottom
|
||||
logTextView.scrollTo(0, max(scrollY, 0))
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue