mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-06-05 17:00:23 +02:00
Moved done checklist setting to the sorting dialog (#462)
This commit is contained in:
@ -38,7 +38,6 @@ class SettingsActivity : SimpleActivity() {
|
||||
setupMonospacedFont()
|
||||
setupShowKeyboard()
|
||||
setupShowNotePicker()
|
||||
setupMoveUndoneChecklistItems()
|
||||
setupShowWordCount()
|
||||
setupEnableLineWrap()
|
||||
setupFontSize()
|
||||
@ -133,14 +132,6 @@ class SettingsActivity : SimpleActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupMoveUndoneChecklistItems() {
|
||||
settings_move_undone_checklist_items.isChecked = config.moveDoneChecklistItems
|
||||
settings_move_undone_checklist_items_holder.setOnClickListener {
|
||||
settings_move_undone_checklist_items.toggle()
|
||||
config.moveDoneChecklistItems = settings_move_undone_checklist_items.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupShowWordCount() {
|
||||
settings_show_word_count.isChecked = config.showWordCount
|
||||
settings_show_word_count_holder.setOnClickListener {
|
||||
|
@ -106,9 +106,6 @@ class WidgetAdapter(val context: Context, val intent: Intent) : RemoteViewsServi
|
||||
|
||||
// checklist title can be null only because of the glitch in upgrade to 6.6.0, remove this check in the future
|
||||
checklistItems = checklistItems.filter { it.title != null }.toMutableList() as ArrayList<ChecklistItem>
|
||||
if (context.config.moveDoneChecklistItems) {
|
||||
checklistItems.sortBy { it.isDone }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ class SortChecklistDialog(private val activity: SimpleActivity, private val call
|
||||
init {
|
||||
setupSortRadio()
|
||||
setupOrderRadio()
|
||||
setupMoveUndoneChecklistItems()
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok) { _, _ -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
@ -48,6 +49,13 @@ class SortChecklistDialog(private val activity: SimpleActivity, private val call
|
||||
orderBtn.isChecked = true
|
||||
}
|
||||
|
||||
private fun setupMoveUndoneChecklistItems() {
|
||||
view.settings_move_undone_checklist_items.isChecked = config.moveDoneChecklistItems
|
||||
view.settings_move_undone_checklist_items_holder.setOnClickListener {
|
||||
view.settings_move_undone_checklist_items.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
private fun dialogConfirmed() {
|
||||
val sortingRadio = view.sorting_dialog_radio_sorting
|
||||
var sorting = when (sortingRadio.checkedRadioButtonId) {
|
||||
@ -61,7 +69,9 @@ class SortChecklistDialog(private val activity: SimpleActivity, private val call
|
||||
|
||||
if (currSorting != sorting) {
|
||||
config.sorting = sorting
|
||||
callback()
|
||||
}
|
||||
|
||||
config.moveDoneChecklistItems = view.settings_move_undone_checklist_items.isChecked
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
@ -160,6 +160,9 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
||||
updateUIVisibility()
|
||||
ChecklistItem.sorting = requireContext().config.sorting
|
||||
items.sort()
|
||||
if (context?.config?.moveDoneChecklistItems == true) {
|
||||
items.sortBy { it.isDone }
|
||||
}
|
||||
ChecklistAdapter(
|
||||
activity = activity as SimpleActivity,
|
||||
items = items,
|
||||
|
Reference in New Issue
Block a user