willowtreeapps/vocable-android

Remove duplicate category state in EditCategoriesViewModel

Closed this issue · 0 comments

EditCategoriesViewModel currently holds separate state for reordering as well as adding and removing categories. This was necessitated by the fact that the ViewPager/List that displays categories gets reset every time the list changes, so reordering categories would change pages and be a jarring experience for the user.

However, this workaround creates misdirection as there are now multiple sources of truth for the list of categories. There should be a way to make the ViewPager/List maintain its position even through reordering. ListAdapter, and its associated diffing logic is likely the solution, and this might even enable reordering animations, which would further improve UX.

On completion of this ticket, EditCategoriesViewModel, should have a single source of truth for the categories list within.