Tombol arsip dan tombol hapus di kasih halaman konfirmasi
This commit is contained in:
parent
9811773186
commit
10315f22ef
@ -449,8 +449,83 @@ fun EditableFullScreenNoteView(
|
||||
) {
|
||||
var title by remember { mutableStateOf(note.title) }
|
||||
var content by remember { mutableStateOf(note.content) }
|
||||
var showArchiveDialog by remember { mutableStateOf(false) }
|
||||
var showDeleteDialog by remember { mutableStateOf(false) }
|
||||
val dateFormat = remember { SimpleDateFormat("dd MMMM yyyy, HH:mm", Locale("id", "ID")) }
|
||||
|
||||
// Dialog Konfirmasi Arsip
|
||||
if (showArchiveDialog) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showArchiveDialog = false },
|
||||
title = {
|
||||
Text(
|
||||
text = "Arsipkan Catatan?",
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
text = {
|
||||
Text(
|
||||
text = "Catatan ini akan dipindahkan ke arsip. Anda masih bisa mengaksesnya nanti.",
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(
|
||||
onClick = {
|
||||
if (title.isNotBlank()) {
|
||||
onSave(title, content)
|
||||
}
|
||||
onArchive()
|
||||
showArchiveDialog = false
|
||||
}
|
||||
) {
|
||||
Text("Arsipkan", color = MaterialTheme.colorScheme.primary)
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = { showArchiveDialog = false }) {
|
||||
Text("Batal", color = MaterialTheme.colorScheme.onSurface)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// Dialog Konfirmasi Hapus
|
||||
if (showDeleteDialog) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showDeleteDialog = false },
|
||||
title = {
|
||||
Text(
|
||||
text = "Hapus Catatan?",
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
text = {
|
||||
Text(
|
||||
text = "Catatan ini akan dihapus permanen dan tidak bisa dikembalikan.",
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(
|
||||
onClick = {
|
||||
onDelete()
|
||||
showDeleteDialog = false
|
||||
}
|
||||
) {
|
||||
Text("Hapus", color = Color(0xFFEF4444))
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = { showDeleteDialog = false }) {
|
||||
Text("Batal", color = MaterialTheme.colorScheme.onSurface)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
containerColor = MaterialTheme.colorScheme.background,
|
||||
topBar = {
|
||||
@ -479,15 +554,10 @@ fun EditableFullScreenNoteView(
|
||||
tint = if (note.isPinned) Color(0xFFFBBF24) else MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
}
|
||||
IconButton(onClick = {
|
||||
if (title.isNotBlank()) {
|
||||
onSave(title, content)
|
||||
}
|
||||
onArchive()
|
||||
}) {
|
||||
IconButton(onClick = { showArchiveDialog = true }) {
|
||||
Icon(Icons.Default.Archive, contentDescription = "Arsipkan", tint = MaterialTheme.colorScheme.onSurface)
|
||||
}
|
||||
IconButton(onClick = onDelete) {
|
||||
IconButton(onClick = { showDeleteDialog = true }) {
|
||||
Icon(Icons.Default.Delete, contentDescription = "Hapus", tint = MaterialTheme.colorScheme.onSurface)
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user