mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-24 04:20:07 +01:00
implement the undone checklist item moving
This commit is contained in:
parent
a66d5c0e89
commit
fa63a699b8
@ -94,6 +94,9 @@ class WidgetAdapter(val context: Context, val intent: Intent) : RemoteViewsServi
|
||||
if (note?.type == TYPE_CHECKLIST) {
|
||||
val checklistItemType = object : TypeToken<List<ChecklistItem>>() {}.type
|
||||
checklistItems = Gson().fromJson<ArrayList<ChecklistItem>>(note!!.value, checklistItemType) ?: ArrayList(1)
|
||||
if (context.config.moveUndoneChecklistItems) {
|
||||
checklistItems .sortBy { it.isDone }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ import com.simplemobiletools.notes.pro.R
|
||||
import com.simplemobiletools.notes.pro.activities.SimpleActivity
|
||||
import com.simplemobiletools.notes.pro.adapters.ChecklistAdapter
|
||||
import com.simplemobiletools.notes.pro.dialogs.NewChecklistItemDialog
|
||||
import com.simplemobiletools.notes.pro.extensions.config
|
||||
import com.simplemobiletools.notes.pro.extensions.notesDB
|
||||
import com.simplemobiletools.notes.pro.extensions.updateWidgets
|
||||
import com.simplemobiletools.notes.pro.helpers.NOTE_ID
|
||||
@ -44,6 +45,10 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
||||
|
||||
val checklistItemType = object : TypeToken<List<ChecklistItem>>() {}.type
|
||||
items = Gson().fromJson<ArrayList<ChecklistItem>>(note!!.value, checklistItemType) ?: ArrayList(1)
|
||||
if (config!!.moveUndoneChecklistItems) {
|
||||
items.sortBy { it.isDone }
|
||||
}
|
||||
|
||||
context!!.updateTextColors(view.checklist_holder)
|
||||
setupFragment()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user