Skip to content

Commit cd35821

Browse files
committed
Update
1 parent d7ad0a4 commit cd35821

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,22 @@ class DialogLogFragment : DialogFragment() {
223223
override fun onProgress(current: Int, total: Int) {
224224
shellProgress?.post {
225225
when {
226-
current < 0 -> {
227-
shellProgress?.visibility = View.VISIBLE
228-
shellProgress?.isIndeterminate = true
226+
current < 0 -> shellProgress?.apply {
227+
visibility = View.VISIBLE
228+
isIndeterminate = true
229229
}
230230
current >= total -> shellProgress?.visibility = View.GONE
231-
else -> {
232-
shellProgress?.visibility = View.VISIBLE
233-
shellProgress?.isIndeterminate = false
234-
shellProgress?.max = total
235-
shellProgress?.progress = current
236-
val params = shellProgress?.layoutParams
237-
params?.height = 4
238-
shellProgress?.layoutParams = params
231+
else -> shellProgress?.apply {
232+
visibility = View.VISIBLE
233+
isIndeterminate = false
234+
max = total
235+
progress = current
236+
(layoutParams as? ViewGroup.MarginLayoutParams)?.let { params ->
237+
params.height = 4
238+
params.topMargin = 44
239+
layoutParams = params
240+
}
241+
requestLayout()
239242
}
240243
}
241244
}

0 commit comments

Comments
 (0)