Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Fixed inconsistent checklist sorting when the "Move checked items to the bottom" option is enabled ([#59])

## [1.6.0] - 2025-10-29
### Changed
- Compatibility updates for Android 15 & 16
Expand Down Expand Up @@ -91,6 +94,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial release

[#59]: https://github.com/FossifyOrg/Notes/issues/59
[#81]: https://github.com/FossifyOrg/Notes/issues/81
[#83]: https://github.com/FossifyOrg/Notes/issues/83
[#99]: https://github.com/FossifyOrg/Notes/issues/99
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,28 @@ class TasksFragment : NoteFragment(), TasksActionListener {

override fun moveTask(fromPosition: Int, toPosition: Int) {
switchToCustomSorting()

val sortableIndices = mutableListOf<Int>()
val checkedCanBeMoved = config?.moveDoneChecklistItems == false
for (i in 0 until tasks.size) {
if (checkedCanBeMoved || !tasks[i].isDone) {
sortableIndices.add(i)
}
}

if (fromPosition < toPosition) {
for (i in fromPosition until toPosition) {
tasks.swap(i, i + 1)
val toMoveIndex = sortableIndices[i]
if (i + 1 < sortableIndices.size) {
val headingIndex = sortableIndices[i + 1]
tasks.swap(toMoveIndex, headingIndex)
}
}
} else {
for (i in fromPosition downTo toPosition + 1) {
tasks.swap(i, i - 1)
val toMoveIndex = sortableIndices[i]
val headingIndex = sortableIndices[i - 1]
tasks.swap(toMoveIndex, headingIndex)
}
}

Expand Down
Loading