Reorderable exercises in routines and workouts#25
Reorderable exercises in routines and workouts#25dpusceddu wants to merge 10 commits intoLibreFitOrg:mainfrom
Conversation
IamDg
left a comment
There was a problem hiding this comment.
Hi @dpusceddu,
I'm really impressed by your implementation—you've done as well as possible. I just tried the debug APK and it works like a charm. Majestic job!
Now, I'll list the refinements that should take little time and will make this PR perfect:
- Add
AnimatedVisibilitytoExerciseCard.ktso the card shortens when the user begins to drag. This will provide better visual feedback for reordering. - Include haptic feedback during drag movement of the exercises in the list.
- In
AppDatabase.kt, Gradle warnsThe corresponding parameter in the supertype ‘Migration’ is named ‘db’. This may cause problems when calling this function with named arguments.so renaming the parameter todbshould fix it. - It looks like CI failed due to a false positive from Room. Fix it by updating the
lint-baseline.xmlwith./gradlew updateLintBaselineand committing the updated file.
|
Thanks for the feedback 🌟 |
|
Oh, yeah. I meant all cards, so the current version is correct (it makes reordering easier). I took a look at the debug APK and it looks awesome! Keep up the good work! Edit: After further testing, I noticed reordering is a little bit messy when dragging a card from the middle or the bottom of the list. What could be the cause? |
|
I have the impression that it's caused by the drag handle changing position by a lot due to the resizing of the cards around, and so the finger and what you're actually dragging become very distanced. So with the one on top nothing bad happens because the drag handle remains in the same spot. Right now I dunno how to fix this with the currently used APIs, but in my mind I think a good solution would be to make the currently dragged card "float" instead of remaining fixed in the list, that way the position of what you're dragging coincides with the position of your finger |
|
I had an idea: since there will be more options in the exercise card (e.g., replace, superset), the solution (and workaround) would be to use the new expressive DropdownMenuGroup instead. Once the user clicks "reorder," all cards collapse and the handle appears. This approach could be a workable solution. Let me know what you think! |
|
Hi @dpusceddu, I've implemented as suggested in previous comment and it looks and works well so I'm confident to merge this. Let me know what you think about it! |
Adds a drag handle to reorder exercises around by dragging them up or down.
Used https://github.com/Calvin-LL/Reorderable as #4 pointed at.
Had to change the database schema to include the position of the exercise in the routine / workout, as previous behavior relied just on the original insert order upon creation of the routine / workout