File tree Expand file tree Collapse file tree
app/src/main/java/com/tool/tree Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -364,22 +364,19 @@ class TextEditorActivity : AppCompatActivity() {
364364 if (isSaving) return
365365 if (! hasUnsavedChanges()) { finish(); return }
366366
367- // Cấu hình DialogButton truyền dạng Boolean kết hợp kèm block lắng nghe kết quả ở cuối
368367 DialogHelper .confirm(
369368 this ,
370369 title = getString(R .string.editor_unsaved_title),
371370 message = getString(R .string.editor_unsaved_message),
372- onConfirm = DialogHelper .DialogButton (getString(R .string.editor_save), true ),
373- onCancel = DialogHelper .DialogButton (getString(R .string.editor_discard), false )
374- ) { confirmed -> // Nhận kết quả Boolean trả về khi người dùng tương tác với một trong hai nút
375- if (confirmed) {
371+ onConfirm = DialogHelper .DialogButton (getString(R .string.editor_save), Runnable {
376372 saveFile(showProgress = false , showToast = true ) { success ->
377373 if (success) finish()
378374 }
379- } else {
375+ }),
376+ onCancel = DialogHelper .DialogButton (getString(R .string.editor_discard), Runnable {
380377 finish()
381- }
382- }
378+ })
379+ )
383380 }
384381
385382 override fun onCreateOptionsMenu (menu : Menu ): Boolean {
You can’t perform that action at this time.
0 commit comments