Make delete, rename and move undoable

A delete is no longer a removal: it is a move into a hidden .plainfiles-trash folder on the same volume, which costs a rename and keeps the item recoverable. The snackbar offers Undo for delete, rename and a pasted cut; the handle is cleared as soon as it is used.

domain/Trash carries four deliberate limits: the trash lives on the users own volume, so it counts against their free space until it expires (24 hours, purged opportunistically, no startup hook and no empty-trash chore); a name taken again in the meantime is never overwritten, so an item returns beside it; a delete through Androids own dialog is not staged because the system owns it; and each item is staged in its own slot so two files sharing a name cannot overwrite each other on the way in. When a pasted move landing names cannot be established with confidence, no undo is offered rather than risking the wrong file moving back.
This commit is contained in:
2026-10-15 09:06:24 +02:00
parent 77acb80f17
commit 02780c97e5
8 changed files with 685 additions and 13 deletions
+18
View File
@@ -38,6 +38,24 @@ upload needs a **higher `versionCode`** than every previous upload.
### Added
- **Undo for delete, rename and move.** A delete is now a *move* into a hidden
`.plainfiles-trash` folder on the same volume rather than a removal, so the snackbar can
offer to put it back; a rename and a pasted cut record how to reverse themselves. Four
deliberate limits, all carried in `domain/Trash`: the trash sits on the user's own volume,
so it counts against their free space until it expires (24 hours, purged opportunistically
so there is no startup hook to forget and no "empty trash" chore); a name taken again in
the meantime is never overwritten, so an item returns *beside* it under a free name; a
delete that went through Android's own dialog is not staged, because the system owns that
one and its trash with it; and when a pasted move's landing names cannot be established
with confidence, no undo is offered at all rather than risking putting the wrong file
back. The undo handle is cleared the moment it is used, so a second tap cannot replay it.
- **Keep the browsed folder and view settings across process death.** `SavedStateHandle`
carries the folder plus the sort key, direction, view mode and hidden-files setting. The
search query, the selection and the clipboard are deliberately *not* restored — a
restored query would hide the folder's contents on launch with no visible cause, and a
paste that survived a reboot would be a nasty surprise.
- **7z extraction.** Commons Compress already contained a pure-Java 7z reader
(`SevenZFile`), so this needed no new native code and no library beyond the XZ one the
`.xz` fix above required — the docs had simply assumed the format was off-limits and said