I am currently working on an Android app where users can order their list via drag and drop in any order they want. Therefore, I must store the sort order in a variable and a column. I was thinking of giving each row a number like 100000, 200000, 300000, etc and if a user moves an item between 100000 and 200000, then its sort number becomes the average of its neighbours ie 150000. So the farther apart the numbers, the fewer times I have to "reset" the sort numbers when they converge onto each other
There are a few things I am worried about:
First is what is the most efficient? Do large numbers use more resources or take longer to sort? I only expect ~40 rows so if large numbers take longer to sort, I might be better off using smaller numbers and "resetting" more often.
Second is ensuring cross-platform compatibility in the future. For now, I only have to worry about this working with my Android app which uses Java and SQLite which haves longs with max of 2 ^ 63-1. But in the future I may have to worry about things like syncing between an iOS app which uses Objective C and maybe a web client. I am not familiar with those technologies so it would be helpful if anyone could point out any cross-compatibility problems I might have with them and how I can prevent them now so I won't have to modify my stuff later.
Thanks
Aucun commentaire:
Enregistrer un commentaire