Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyPlaces>Tracks root folder and subfolders lose sorting order #19333

Closed
sonora opened this issue Mar 16, 2024 · 19 comments · Fixed by #19814
Closed

MyPlaces>Tracks root folder and subfolders lose sorting order #19333

sonora opened this issue Mar 16, 2024 · 19 comments · Fixed by #19814
Assignees
Labels
Milestone

Comments

@sonora
Copy link
Member

sonora commented Mar 16, 2024

Have to re-open this. With intense use in the last 2 weeks, at least once daily the sorting order of MyPlaces>Tracks and its subfolders resets to "Last modified", while I positively always set everything to A-Z.

There must be one or several remnants in our code always setting things back to "Last modified".

Candidates are after a fresh app start, manual profile change, a navigation (without using turn-by-turn mode), or after making more track folders visible on map.

@scaidermern
Copy link
Contributor

A never ending story ☹️

@scaidermern
Copy link
Contributor

In #17955 I added a video how to reproduce this bug.

And just now I reproduced it by simply changing the visibility of two tracks to false. This also changed the sorting order of the tracks root folder.

@yuriiurshuliak
Copy link

The bug has been reproduced. I managed to reproduce it on the current release version, but it's not occurring on the latest nightly version. To reproduce the bug on the release version, navigate to "My places" and ensure that the "Sort by" option in both the Tracks and Visible on map folders is set to "Last modified" mode. Then attempt to switch the sorting in both folders to "Name: A - Z" mode, and after confirming the last change, click on the cross in the upper left corner and return to the map. Revisit the "My places - Tracks" folder, and you'll observe that the sorting automatically reverts to "Last modified" mode.

OsmAnd 4.6.13, released: 2024-01-19
OsmAnd~ 4.7.0#1864m, released: 2024-03-19

Release version Nightly version
video_2024-03-19_16-01-05.mp4
video_2024-03-19_16-01-07.mp4

@sonora
Copy link
Member Author

sonora commented Mar 21, 2024

I believe there are multiple different ways to independently reproduce issues about the sorting order of the new tracks screens. Someone knowledgeable about that code should go tyhroug the entire code base, search for places where the sort order is changed, and check for potential occurences of unwanted changes happening... or else we may not fix these issues for good for another long time...

@sonora
Copy link
Member Author

sonora commented Mar 23, 2024

Side note: about something which confuses some readers of the screenshots and recordings:

When using the "Sort subfolders" action, its initial screen highlights one of the sorting options with a color. By convention you may think this is the current sorting order used for the subfolders, but in fact it seems not. (In fact it even shows if not all subfolders are sorted the same.) Not sure what it means to be - perhaps the highlighting needs removing here to avoid confusion.

@Rowin63
Copy link

Rowin63 commented Apr 3, 2024

I don´t know why, but all my tracks sub-folders are set back to sorting "last edited".

@Rowin63
Copy link

Rowin63 commented Apr 3, 2024

I think, changing Osmands data folder could have caused it.
And new created folders do have this sorting as "standard".

@sonora
Copy link
Member Author

sonora commented Apr 3, 2024

In my cases it had nothing to do with changing the data folder or creating new folders... happens during app use, with just occasionally displaying/hiding groups of tracks.

@vshcherb
Copy link
Member

vshcherb commented Apr 6, 2024

@sonora it's impossible that setting would randomly changed, @Chumva please share what setting is for sorting and where it's possibly changed in the code

@vshcherb vshcherb added this to the 4.7-android milestone Apr 6, 2024
@vshcherb vshcherb modified the milestones: 4.7-android, 4.8-android Apr 16, 2024
@Rowin63
Copy link

Rowin63 commented Apr 22, 2024

After editing some folders names, the listing gets mixed up in "configure map>tracks"

Screenshot_20240422_074324_OsmAnd+

But it is correct in "my places > tracks"

@sonora
Copy link
Member Author

sonora commented Apr 22, 2024

Yes, same here. Let's please also fix in this issue, or if needed we can create a second one.

@Rowin63
Copy link

Rowin63 commented Apr 22, 2024

Yes, same here. Let's please also fix in this issue, or if needed we can create a second one.

You may activate my previously created ticket (#19634), if you want to (I closed it again, because I was not sure if it´s a double of this here or not) Thanks!

@vshcherb
Copy link
Member

The problem of that issue it's still in reproducing phase (I hope we will get more time to put some logs after release rush)

@sonora
Copy link
Member Author

sonora commented Apr 25, 2024

With this commit for #19634 it is now like this:

  • Sort MyTracks A-Z (both root screen and subfolder sorting).
  • On that screen tap on 'Visible on map', (there all tracks are falsely sorted by 'Last modified'). Tap a track and 'Apply', to show it on the map. (Or remove a visible one from the map, this also reproduces the issue.)
  • Re-enter Menu/MyPlaces/MyTracks: Now root folder and also all subfolders' track sorting has reverted to 'Last modified'.

And PS: This fix increases for my setup (3500 tracks in 70 subfolders) the time to enter that screen which was meanwhile down to 2-3sec to like 15+ sec again... (every time I enter it, there seems no caching or remembering)

@Rowin63
Copy link

Rowin63 commented Apr 27, 2024

And PS: This fix increases for my setup (3500 tracks in 70 subfolders) the time to enter that screen which was meanwhile down to 2-3sec to like 15+ sec again... (every time I enter it, there seems no caching or remembering)

THIS is exactly the behavior I have on my Tablet (Galaxy Tab S6), since a few releases (maybe a month or so?). Takes around 20s every time I open "my places / tracks" or "configure map / tracks".
I did a complete fresh install but it did not change (latest Osmand+ 4.7.11)
The tablet runs Android 12.
I dont see this issue on my other devices, all running Android 13 (Android 12 seems to be the only difference). Didn´t open an issue yet, was searching the cause on my side. Have the same data on all devices (reduced track data, not as many as before).

@sonora
Copy link
Member Author

sonora commented May 5, 2024

Looks like the problem is associated with the "Visible on map" tracks screen, we have 2 error cases:

  1. Any sort modification (also to e.g. 'Nearest') on any tab of the 'Visible Tracks' screen resets the 'MyPlaces>Tracks' screen (and its subfolder sorting) to 'Last Modified'.
  2. Adding or removing a track to/from 'visible' via the 'Visible on map' screen (independent of how the 'On map' folder is sorted) resets the MyPlaces>Tracks screen (and subfolder sorting) to 'Last Modified'.

'Last modified' is the default value. So if we forget to set the sortMode somewhere, or try to set it to something invalid, that would cause this effect.

@sonora
Copy link
Member Author

sonora commented May 5, 2024

@Chumva BaseTrackFolderFragment.java's TracksSortMode getTracksSortMode() is the very method eventually causing this, I've verified that both error cases come from exactly this line:

And: This issue is connected to #19634: We use two different sets of sortMode settings for the MyPlaces>Tracks folders and the Visible on map screen's tabs, should use the same.

@sonora sonora changed the title Tracks root folder and subfolders lose sorting order MyPlaces>Tracks root folder and subfolders lose sorting order May 5, 2024
@vshcherb vshcherb modified the milestones: 4.8-android, 4.7-android May 6, 2024
@vshcherb vshcherb modified the milestones: 4.7-android, 4.8-android May 6, 2024
@sonora
Copy link
Member Author

sonora commented May 7, 2024

To elaborate: The issue comes from the different scopes of sort modes we save on the 'MyPlaces>Tracks' vs. the 'Visible on map' screens. Tentative TODOs:

  1. On Configure map>Trscks we do not display a tab for folders which contain no tracks directly but only subfolders. Correspondingly, their sort order gets lost in

    This needs mitigating. Most prominently for the root ("Tracks") folder.

  2. Reversely, the sort order for tabs which have no folder equivalent gets lost when the sort modes are saved from MyPlaces>Tracks. Most notably "ALL" and "ON MAP".

  3. The sort order for the tabs needs to be synced with that of the root folder and remembered (saved) "in both directions".

@sonora
Copy link
Member Author

sonora commented May 8, 2024

This PR fixes (1) and (2) above #19814. It preserves the existing sort modes when saved in the two separate tack screens we have.

As a consequence, we need to have the method removeSurplusTabsSortModes() to at some point clean up the TRACKS_TABS_SORT_MODES no longer needed on both screens. For now I only call it under sortSubFolder(...), we may find better or additional places to call it, e.g. when folders are deleted.

Issue #19634 is not yet fixed by this PR. We now need code sorting the tabs on 'Configure map/Tracks' according to the 'MyPlaces>Track's' screens rootFolder's sortMode, from what I see that is so far completely missing.

@Chumva Chumva linked a pull request May 9, 2024 that will close this issue
@Chumva Chumva closed this as completed May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants