mirror of
https://github.com/FossifyOrg/Notes.git
synced 2025-12-23 23:59:34 -05:00
feat(tasks): add option to uncheck all checked items (#184)
* feat(tasks): uncheck all checked items * docs(changelog): added new feature to CHANGELOG.md * docs(changelog): add issue link and adjust wording for the new feature * refactor: Use "uncheck all items" uniformly * docs(changelog): fix issue reference
This commit is contained in:
@@ -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])
|
||||
|
||||
## [1.3.1] - 2025-07-12
|
||||
### Changed
|
||||
@@ -61,6 +63,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
[#83]: https://github.com/FossifyOrg/Notes/issues/83
|
||||
[#99]: https://github.com/FossifyOrg/Notes/issues/99
|
||||
[#110]: https://github.com/FossifyOrg/Notes/issues/110
|
||||
[#156]: https://github.com/FossifyOrg/Notes/issues/156
|
||||
[#164]: https://github.com/FossifyOrg/Notes/issues/164
|
||||
[#178]: https://github.com/FossifyOrg/Notes/issues/178
|
||||
|
||||
|
||||
@@ -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 =
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user