Skip to content

Commit 404bce4

Browse files
committed
Upload file
1 parent 4be070f commit 404bce4

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ class DialogLogFragment : androidx.fragment.app.DialogFragment() {
201201
}
202202
}
203203

204+
private fun isAtBottom(scrollView: ScrollView): Boolean {
205+
val child = scrollView.getChildAt(0)
206+
return child.bottom <= scrollView.height + scrollView.scrollY + 4
207+
}
208+
204209
override fun handleMessage(msg: Message) {
205210
when (msg.what) {
206211
EVENT_EXIT -> onExit(msg.obj)
@@ -251,12 +256,17 @@ class DialogLogFragment : androidx.fragment.app.DialogFragment() {
251256
override fun updateLog(msg: SpannableString?) {
252257
msg?.let {
253258
logView?.post {
259+
val scrollView = logView?.parent as? ScrollView
260+
val shouldScroll = scrollView?.let { isAtBottom(it) } ?: true
261+
254262
logView?.append(it)
255-
(logView?.parent as? ScrollView)?.fullScroll(ScrollView.FOCUS_DOWN)
263+
264+
if (shouldScroll) {
265+
scrollView?.fullScroll(ScrollView.FOCUS_DOWN)
266+
}
256267
}
257268
}
258269
}
259-
}
260270

261271
override fun onResume() {
262272
super.onResume()

pio/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ android {
2020
minSdkVersion 23
2121
targetSdkVersion 28
2222
versionCode Integer.parseInt(new java.text.SimpleDateFormat("yyMMddHH").format(new Date()))
23-
versionName "1.2.7"
23+
versionName "1.2.8"
2424
}
2525
signingConfigs {
2626
release {

pio/src/main/res/layout/dialog_about.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
android:textSize="11sp" />
2626
<CheckBox
2727
android:textSize="11dp"
28-
android:textColor="#888"
28+
android:textColor="#BB888888"
2929
android:id="@+id/notification_ui"
3030
android:layout_width="match_parent"
3131
android:layout_height="wrap_content"

0 commit comments

Comments
 (0)