mirror of
				https://github.com/SimpleMobileTools/Simple-Notes.git
				synced 2025-06-05 17:00:23 +02:00 
			
		
		
		
	Merge pull request #629 from Aga-C/add-widget-sorting
Added sorting to the widget (#624)
This commit is contained in:
		| @@ -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 } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user