joplin icon indicating copy to clipboard operation
joplin copied to clipboard

Mobile: Resolves #4989: Implement sorting of notes

Open jcgurango opened this issue 1 year ago • 6 comments

The mobile apps do not currently have the ability to edit the custom sort of notes (even though these are displayed and function correctly if performed first on Desktop and then synchronized). This is pretty necessary for my personal usage of the app so I've implemented it myself and sharing my solution. I'm open to changing how it all works to conform more to the rest of the app if necessary.

Related issue: https://github.com/laurent22/joplin/issues/4989

Note sorting is implemented by a long-press and drag gesture.

joplin-sorting-demo.webm

If the current sorting is not "Custom Sort", the user is prompted with a message similar to Desktop.

joplin-sorting-message-demo.webm

The original long-press to select is replaced with a swipe gesture. I'm open to making this a setting or something, or maybe we can add a right-swipe menu that includes many actions (delete, duplicate, move, select many).

joplin-sorting-selection-demo.webm

jcgurango avatar Mar 27 '23 08:03 jcgurango

The drag and drop of notes is nice, but unfortunately we then lose the existing long press. Isn't it possible to keep both? If you long press and move the note, you drag and drop it, but if you don't move you open the menu. I think that's how it's generally handled in mobile apps.

If the current sorting is not "Custom Sort", the user is prompted with a message similar to Desktop.

It displays a menu, but the "OK" button seems to be grayed out?

laurent22 avatar May 29 '23 10:05 laurent22

Okay I've kind of combined the two gestures. Now the drag will just start if you've started dragging the item, and the long press is back but won't trigger if you're dragging an item. Not quite sure of the best way to do long-press-then-drag, so if anyone's got suggestions we can try them. Also not sure why your "OK" is greyed out, seems fine on my end: image

Tested on my actual phone too.

jcgurango avatar May 30 '23 16:05 jcgurango

I've been trying to get this working on my laptop but there are so many issues I couldn't. Was it building for you, and did you commit all the changes? For example, I had to add packages to package.json, remove some variables that weren't in use, etc. But even after that, I'm still getting this error:

image

And I don't know how to fix this. If you're interested in getting this PR working I put my changes in this branch, including resolved conflicts:

https://github.com/laurent22/joplin/commits/jcgurango-feature/mobile-sorting

laurent22 avatar Jul 06 '23 18:07 laurent22

@laurent22 Rebased and it's building for me now. Turns out my initial implementation for combining the gestures fell apart when scrolling (i.e. when the list doesn't all fit on the screen). Tried several different ways involving a GestureDetector, composing gestures, etc. This was the best I could come up with, I don't think we're gonna be able to get it to be more responsive than this without some extensive reengineering.

jcgurango avatar Jul 11 '23 15:07 jcgurango

This was the best I could come up with, I don't think we're gonna be able to get it to be more responsive than this without some extensive reengineering.

So what is the issue with the current implementation?

laurent22 avatar Jul 14 '23 13:07 laurent22

@laurent22 it's usable, just that you have to long press and release instead of just long pressing.

jcgurango avatar Jul 14 '23 13:07 jcgurango

@laurent22 Would it be possible to merge this for release 2.12?

Manual sorting is a prerequisite for several note taking workflows not yet possible on mobile and certainly a long-awaited and appreciated feature.

Even if usability is not optimal yet, it would be great if this would be enabled at all. Thank you for the great work!

PaulS-26 avatar Aug 12 '23 18:08 PaulS-26

@jcgurango, sorry for taking time to review this. I would like to test the change on simulator - would you mind fixing the conflict so that the branch can be built?

laurent22 avatar Sep 19 '23 10:09 laurent22

@jcgurango, I'm going to close this pull request for now, but feel free to let me know if you'd like to get it working again

laurent22 avatar Oct 02 '23 14:10 laurent22