This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 86
Sorting for Cards on Mainscreen
Anselm Binninger edited this page Mar 7, 2018
·
3 revisions
- All cards are added in the update method of the CardManager
- The order of how the cards will appear on the main screen depends on when they're added. Also note that this does not apply for asynchronous added cards (Only mensa for now)
- Card.java implements the Comparable interface. It stores the position of each card within the SharedPreferences.
- Cards are identified by their type (eg. NewsCard), which means you can not change the order of different newscards, but only their overall position.
- The CardManager uses a liststructure that allows concurrent modification and sorting, which means cards are inserted according to their natural order (which is implemented in the Cards.java Base class)
- When a card is added that does not have a stored position yet, it'll be appended to the end of the list and it's position will be updated.
- Simply drag and drop cards on their target position.
- The position in the SharedPreferences will be updated and it'll stay the same even upon restart.
Constraints:
- You can not drop a card below the RestoreCard.
- You can not drop a card before the SupportUsCard (Dismiss it first)