mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-19 18:10:07 +01:00
Merge pull request #629 from Aga-C/add-widget-sorting
Added sorting to the widget (#624)
This commit is contained in:
commit
01db7c05df
@ -1275,6 +1275,7 @@ class MainActivity : SimpleActivity() {
|
||||
private fun displaySortChecklistDialog() {
|
||||
SortChecklistDialog(this) {
|
||||
getPagerAdapter().refreshChecklist(view_pager.currentItem)
|
||||
updateWidgets()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import android.widget.RemoteViewsService
|
||||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||
import com.simplemobiletools.commons.extensions.setText
|
||||
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.notes.pro.R
|
||||
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
|
||||
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