Skip to content

Commit 524a6c2

Browse files
committed
Update
1 parent df172e6 commit 524a6c2

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

app/src/main/java/com/omarea/common/ui/DialogHelper.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,13 +378,15 @@ class DialogHelper {
378378
}).setView(view).setCancelable(cancelable).create()
379379

380380
if (context is Activity) {
381-
dialog.show()
381+
// Tính & set nền blur TRƯỚC khi show() để không có khung hình nào
382+
// dialog hiện ra mà chưa có nền mờ (tránh nháy mờ/rõ).
382383
dialog.window?.run {
383384
setWindowBlurBg(this, context)
384385
decorView.run {
385386
systemUiVisibility = context.window.decorView.systemUiVisibility // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
386387
}
387388
}
389+
dialog.show()
388390
} else {
389391
dialog.window?.run {
390392
setWindowAnimations(R.style.windowAnim2)

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ class ActionListFragment : androidx.fragment.app.Fragment(), PageLayoutRender.On
334334
return krScriptActionHandler?.openFileChooser(callback) ?: false
335335
}
336336
})
337-
progressBarDialog.hideDialog()
337+
// Không hideDialog() ở đây nữa — sẽ tắt sau khi dialog tham số
338+
// mới (đã có nền mờ) hiện lên, xem bên dưới.
338339

339340
val customRunner = krScriptActionHandler?.openParamsPage(action, linearLayout) {
340341
try {
@@ -355,13 +356,19 @@ class ActionListFragment : androidx.fragment.app.Fragment(), PageLayoutRender.On
355356
val dialog = if (isLongList) {
356357
AlertDialog.Builder(requireContext(), if (darkMode) R.style.kr_full_screen_dialog_dark else R.style.kr_full_screen_dialog_light)
357358
.setView(dialogView).create().apply {
358-
show()
359+
// Set nền blur TRƯỚC show() để tránh nháy (frame đầu không mờ)
359360
window?.let { DialogHelper.setWindowBlurBg(it, requireActivity()) }
361+
show()
360362
}
361363
} else {
362364
DialogHelper.customDialog(requireActivity(), dialogView).dialog
363365
}
364366

367+
// Chỉ tắt dialog "loading" SAU KHI dialog tham số (đã có nền mờ) hiện lên,
368+
// để lúc nào màn hình cũng có một dialog mờ che phủ, không có khoảng
369+
// trống bị "tắt mờ" giữa 2 dialog.
370+
progressBarDialog.hideDialog()
371+
365372
dialogView.findViewById<TextView>(R.id.title).text = action.title
366373
dialogView.findViewById<TextView>(R.id.desc).apply { if (action.desc.isEmpty()) visibility = View.GONE else text = action.desc }
367374
dialogView.findViewById<TextView>(R.id.warn).apply { if (action.warning.isEmpty()) visibility = View.GONE else text = action.warning }
@@ -375,6 +382,9 @@ class ActionListFragment : androidx.fragment.app.Fragment(), PageLayoutRender.On
375382
Toast.makeText(requireContext(), "" + ex.message, Toast.LENGTH_LONG).show()
376383
}
377384
}
385+
} else {
386+
// openParamsPage tự xử lý UI riêng (không phải dialog blur ở trên) -> tắt loading ngay
387+
progressBarDialog.hideDialog()
378388
}
379389
}
380390
}

0 commit comments

Comments
 (0)