mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-20 10:30:07 +01:00
Added sorting to the widget (#624)
This commit is contained in:
parent
b1bc7f5511
commit
7376a4d8d7
@ -1487,6 +1487,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
private fun displaySortChecklistDialog() {
|
private fun displaySortChecklistDialog() {
|
||||||
SortChecklistDialog(this) {
|
SortChecklistDialog(this) {
|
||||||
getPagerAdapter().refreshChecklist(view_pager.currentItem)
|
getPagerAdapter().refreshChecklist(view_pager.currentItem)
|
||||||
|
updateWidgets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import com.google.gson.reflect.TypeToken
|
|||||||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||||
import com.simplemobiletools.commons.extensions.setText
|
import com.simplemobiletools.commons.extensions.setText
|
||||||
import com.simplemobiletools.commons.extensions.setTextSize
|
import com.simplemobiletools.commons.extensions.setTextSize
|
||||||
|
import com.simplemobiletools.commons.helpers.SORT_BY_CUSTOM
|
||||||
import com.simplemobiletools.commons.helpers.WIDGET_TEXT_COLOR
|
import com.simplemobiletools.commons.helpers.WIDGET_TEXT_COLOR
|
||||||
import com.simplemobiletools.notes.pro.R
|
import com.simplemobiletools.notes.pro.R
|
||||||
import com.simplemobiletools.notes.pro.R.id.widget_text_holder
|
import com.simplemobiletools.notes.pro.R.id.widget_text_holder
|
||||||
@ -129,6 +130,13 @@ 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
|
// 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>
|
checklistItems = checklistItems.filter { it.title != null }.toMutableList() as ArrayList<ChecklistItem>
|
||||||
|
val sorting = context.config?.sorting ?: 0
|
||||||
|
if (sorting and SORT_BY_CUSTOM == 0) {
|
||||||
|
checklistItems.sort()
|
||||||
|
if (context?.config?.moveDoneChecklistItems == true) {
|
||||||
|
checklistItems.sortBy { it.isDone }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user