File tree Expand file tree Collapse file tree
krscript/src/main/java/com/omarea/krscript/ui Expand file tree Collapse file tree Original file line number Diff line number Diff 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()
Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff line change 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"
You can’t perform that action at this time.
0 commit comments