Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Option to uncheck all checked items ([#156]: https://github.com/FossifyOrg/Notes/issues/156)
Comment thread
TopFox marked this conversation as resolved.
Outdated

## [1.3.1] - 2025-07-12
### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ class MainActivity : SimpleActivity() {
findItem(R.id.delete_note).isVisible = multipleNotesExist
findItem(R.id.open_search).isVisible = !isCurrentItemChecklist
findItem(R.id.remove_done_items).isVisible = isCurrentItemChecklist
findItem(R.id.uncheck_all_items).isVisible = isCurrentItemChecklist
findItem(R.id.sort_checklist).isVisible = isCurrentItemChecklist
findItem(R.id.import_folder).isVisible = !isQPlus()
findItem(R.id.lock_note).isVisible =
Expand Down Expand Up @@ -316,6 +317,7 @@ class MainActivity : SimpleActivity() {
R.id.settings -> launchSettings()
R.id.about -> launchAbout()
R.id.remove_done_items -> fragment?.handleUnlocking { removeDoneItems() }
R.id.uncheck_all_items -> fragment?.handleUnlocking { uncheckAllItems() }
R.id.sort_checklist -> fragment?.handleUnlocking { displaySortChecklistDialog() }
else -> return@setOnMenuItemClickListener false
}
Expand Down Expand Up @@ -1555,6 +1557,10 @@ class MainActivity : SimpleActivity() {
getPagerAdapter().removeDoneCheckListItems(binding.viewPager.currentItem)
}

private fun uncheckAllItems() {
getPagerAdapter().uncheckAllItems(binding.viewPager.currentItem)
}

private fun displaySortChecklistDialog() {
SortChecklistDialog(this, mCurrentNote.id) {
getPagerAdapter().refreshChecklist(binding.viewPager.currentItem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val activity
(fragments[position] as? TasksFragment)?.removeCheckedItems()
}

fun uncheckAllItems(position: Int) {
(fragments[position] as? TasksFragment)?.uncheckAllItems()
}

fun refreshChecklist(position: Int) {
(fragments[position] as? TasksFragment)?.saveAndReload()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ class TasksFragment : NoteFragment(), TasksActionListener {
setupAdapter()
}

fun uncheckAllItems() {
tasks = tasks.map { it.copy(isDone = false) }.toMutableList()
saveAndReload()
}

private fun updateUIVisibility() {
binding.apply {
fragmentPlaceholder.beVisibleIf(tasks.isEmpty())
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/menu/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
android:id="@+id/remove_done_items"
android:title="@string/delete_checked_items"
app:showAsAction="never" />
<item
android:id="@+id/uncheck_all_items"
android:title="@string/uncheck_all_items"
app:showAsAction="never" />
<item
android:id="@+id/sort_checklist"
android:icon="@drawable/ic_sort_vector"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<string name="add_new_checklist_items">Add new checklist items</string>
<string name="checklist_is_empty">The checklist is empty</string>
<string name="delete_checked_items">Delete checked items</string>
<string name="uncheck_all_items">Uncheck all items</string>
<string name="add_to_the_top">Add to the top</string>
<string name="use_for_this_checklist">Use for this checklist only</string>
<plurals name="num_checked_items">
Expand Down
Loading