Skip to content

Commit 4456853

Browse files
committed
Update
1 parent 56ea9aa commit 4456853

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/src/main/java/com/omarea/krscript/ui/DialogLogFragment.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,14 @@ class DialogLogFragment : DialogFragment() {
244244

245245
override fun updateLog(msg: SpannableString?) {
246246
val logView = logViewRef.get() ?: return
247+
val scrollView = logView.parent as? ScrollView ?: return
247248
msg?.let {
248249
logView.post {
250+
val isAtBottom = (logView.bottom - (scrollView.height + scrollView.scrollY)) <= 50
249251
logView.append(it)
250-
(logView.parent as? ScrollView)?.fullScroll(ScrollView.FOCUS_DOWN)
252+
if (isAtBottom) {
253+
scrollView.fullScroll(ScrollView.FOCUS_DOWN)
254+
}
251255
}
252256
}
253257
}

app/src/main/res/layout/kr_dialog_log.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
android:layout_width="match_parent"
4646
android:layout_height="match_parent"
4747
android:overScrollMode="never"
48+
android:paddingEnd="10dp"
4849
android:layout_above="@id/bottom_actions"
4950
android:layout_below="@+id/top_bar">
5051

0 commit comments

Comments
 (0)