Skip to content

Tracks folder listing is mixed up (Configure map>tracks>menu) #19634

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

Closed
Rowin63 opened this issue Apr 22, 2024 · 34 comments · Fixed by #19673, #21298, #21310, #21504 or #21520
Closed

Tracks folder listing is mixed up (Configure map>tracks>menu) #19634

Rowin63 opened this issue Apr 22, 2024 · 34 comments · Fixed by #19673, #21298, #21310, #21504 or #21520
Assignees
Milestone

Comments

@Rowin63
Copy link

Rowin63 commented Apr 22, 2024

Description

The track folders are not listed aphabetical anymore, but mixed up

Steps to reproduce

go to "configure map / tracks / folder menue"

Actual result

after changing some folders names the track folders are not in alphabetical order anymore

(but in "my places / tracks" the listing is correct)

Expected result

keep them in order

Your Environment (required)

OsmAnd Version: +4.7.10
Android/iOS version: 13
Device model: S20+

@Rowin63
Copy link
Author

Rowin63 commented Apr 22, 2024

Sotty, double!

@sonora
Copy link
Member

sonora commented Apr 22, 2024

It's a regressiion, and seems separate from and in addition to #19333.

@sonora sonora reopened this Apr 22, 2024
@sonora
Copy link
Member

sonora commented Apr 22, 2024

Apparently, the function "Sort subfolders" on the MyTracks screen also successfully sorts all tracks of 'folder' "Visible on map" and on its associated screen, but not the folder list itself on that screen (neither the folder tabs nor the folder list).

@sonora
Copy link
Member

sonora commented Apr 24, 2024

The folder list on the 'Visible on map' screen and list menu seems always by the folders' time stamp, I find no way currently to sort it alphabetically.

@vshcherb
Copy link
Member

To fix: The order on Configure Map should be identical to My places screen

@vshcherb vshcherb added this to the 4.7-android milestone Apr 25, 2024
@0xRe1nk0 0xRe1nk0 linked a pull request Apr 26, 2024 that will close this issue
@sonora
Copy link
Member

sonora commented Apr 26, 2024

It looks like now we 'reversed' the issue: The function "Sort subfolders" on the MyTracks screen now successfully also sorts all folders on "Visible on map", but now all tracks in the folders on "Visible on map" are always sorted by 'Last modified".

@sonora sonora reopened this Apr 26, 2024
@vshcherb vshcherb modified the milestones: 4.7-android, 4.8-android Apr 27, 2024
@vshcherb
Copy link
Member

  1. Too much code (it looks suspicous that we implement different sorting algorithms) on My Places and here
  2. Didn't fix the issue ?
  3. Introduced delay - non-optimal

Technical note

  • We should have simple API TracksManager.getFolderList() - which will return list of tabs in order (saved in My Places)
  • That API should be used in Configure Map and In My Places

@vshcherb
Copy link
Member

Merged to #19683

@Chumva Chumva self-assigned this May 6, 2024
@sonora
Copy link
Member

sonora commented May 6, 2024

@Chumva

EDIT: Here's a more complete TODO analysis: #19333 (comment).

The issue is the sort mode for the "root" ("Tracks") folder in the MyPlaces>Tracks screen: That very sort mode should be also used

  • for the "ALL" tab of the Configure map>Tracks folder,
  • as well as for its tabs
  • and its tab dialog order.

In

and when there is no track directly in the root folder (all in subfolders), no sort mode is saved for the Tracks folder (as there is no corresponding tab), and that causes #19333. Also we need to add/correct code to use that sort mode for the tabs and the tab selection dialog to fix this issue.

@sonora
Copy link
Member

sonora commented May 8, 2024

@Chumva The connected issue #19333 of sort modes not syncing between the 2 track screens is fixed with PR #19814.

To fix this issue here, we now just need to add code to sort the 'Configrue map>Tracks' tabs (and in a separate block the smart folder tabs) according to TRACKS_TABS_SORT_MODES(GPX-root-folder). (Potentially here here.)

@Chumva
Copy link
Member

Chumva commented May 10, 2024

Yes, also we need to make it a universal code, for my places & configure tracks

@sonora
Copy link
Member

sonora commented May 15, 2024

@Chumva here's a hotfix to resolve the current randomness: a6e896f. We can refine the code as we go along, ok?

@sonora
Copy link
Member

sonora commented May 15, 2024

PS: Perhaps we can even consider this issue solved for now, I am not sure it makes much sense in practice to offer more tab orders than A-Z and Z-A.

The hotfix uses the root folder's sorting also for the tab order, but is currently limited to A-Z and Z-A, defaulting to A-Z for all other root folder sort modes.

@Zirochkabila
Copy link
Contributor

Zirochkabila commented Nov 28, 2024

OsmAnd~ 5.0.0#3836m, Released: 2024-11-28

Sorting filter does not work at the Subfolder level (Last modified is always displayed)

For example, sorting tracks inside a folder works correctly

2024-11-28.19.09.31.mp4

@Rowin63
Copy link
Author

Rowin63 commented Nov 29, 2024

What's worse: Now the sort order is not preserved between app starts (I have things A-Z, it always jumps back to "Last modified".)

"3dots > sorting subfolders" still shows up as set to "A-Z" (it's "blue", selected), but actual sorting is "last modified"

@vshcherb
Copy link
Member

Minor issue, we shouldn't highlight item

@sonora
Copy link
Member

sonora commented Nov 29, 2024

Yes, the highlighting in the "Switch folders" list is a mere "suggestion", not the current value.

  • But that's not the issue I am reporting, it is this: Sort the main "My Places / Tracks screen" itself A-Z, restart the app: It will fall back to "Last modified".
  • Second, but comparatively minor issue is the subfolders not being grouped under parent folders, see above.

@Rowin63
Copy link
Author

Rowin63 commented Nov 29, 2024

Minor issue, we shouldn't highlight item

Sorry, poorly expressed.
What I wanted to say: "A-Z" was my selected option. After app restart it still is selected, but the sorting always falls back to "last edited".

@vshcherb
Copy link
Member

vshcherb commented Dec 1, 2024

To fix:

  • But that's not the issue I am reporting, it is this: Sort the main "My Places / Tracks screen" itself A-Z, restart the app: It will fall back to "Last modified".
  • Second, but comparatively minor issue is the subfolders not being grouped under parent folders, see above.

@vshcherb vshcherb added and-bugs and removed tdebt labels Dec 1, 2024
@nazar-kutz nazar-kutz linked a pull request Dec 2, 2024 that will close this issue
@nazar-kutz
Copy link
Contributor

nazar-kutz commented Dec 2, 2024

@sonora, It seems, I can't reproduce the second problem (#19634 (comment)).
If select "A-Z" sorting for root folder ("Tracks") in My Places -> Tracks, subfolders display grouped under parent folders on Configure Map -> Tracks "Switch folder" bottom sheet.

Select "A-Z" for "Tracks" folder Subfolders are grouped under parent folders

Maybe you have a different sorting mode selected for the root folder and this caused the problem?

@Chumva Chumva closed this as completed Dec 3, 2024
@nazar-kutz
Copy link
Contributor

nazar-kutz commented Dec 3, 2024

How sorting works currently

I decided to describe in a little more detail the principles of track sorting at the moment, to clarify certain points for this feature testing, support and further development.

My Places -> Tracks

On the My Places -> Tracks screen, you can configure the sorting order separately for each standard folder (a physical directory on the device) and each smart folder (a set of customizable filters that helps structure tracks according to certain parameters).

  • The selected sorting mode applies only to the content directly located in the folder.
  • Content in subfolders does not inherit this sorting mode; instead, sorting for each subfolder is configured manually and independently.

To simplify the process of setting sorting modes for subfolders, you can use the Sort subfolders feature:

  1. Open the folder whose subfolders need a sorting mode applied.
  2. Tap the additional options button (three-dots button) in the toolbar at the top of the screen.
  3. Select the Sort subfolders option from the dropdown menu.
  4. In the dialog that appears, choose the desired sorting order.

Key details:

  • The selected sorting order will be applied to all subfolders of the folder.
  • The sorting mode of the folder itself (from which the option was triggered) will remain unchanged.
  • Later, you can individually adjust the sorting mode for each subfolder as needed.
    This feature simplifies the process of manually setting sorting modes, preventing the need to open each folder and its subfolders individually to configure sorting.
  • When opened, this menu highlights the currently selected sort type for the folder. It is important to note that this menu does not display any information about the sort type selected for subfolders, as the content in them can be sorted in different modes. This highlighting can be seen as a hint as to which mode the base folder is sorted in, if we want to set the same sort mode for subfolders.

Smart folders features related to sorting

Smart Folders have specific features:

  • All Smart Folders have only one level of nesting, meaning they do not contain subfolders.
  • Smart Folders are displayed directly in the root directory "Tracks" on the My Places -> Tracks screen, alongside regular first-level subfolders. For Android, this corresponds to the "Tracks" folder in the file system, and for iOS -- the "GPX" folder.

Sorting Smart Folders

  • When changing the sorting order of the root folder "Tracks", regular folders and Smart Folders are sorted together as a single list.
  • This results in both types being displayed intermixed, without separation into distinct categories.

Configure Map -> Tracks

The Configure Map -> Tracks screen has a unique sorting approach tailored for managing the visibility of tracks and folders on the map.

Key Features:

  1. Tab structure instead of a tree view:
    • Tabs are displayed as a horizontal list at the top of the screen.
    • Tab display order:
      1. On map -- shows all tracks currently visible on the map.
      2. All -- displays all available tracks.
      3. Smart folders -- sorted according to the sort mode set for the root "Tracks" folder via My Places -> Tracks
      4. Physical folders -- listed below smart folders, sorted using the same mode.
  2. Flattened folder structure:
    • All folders are displayed as a single list without hierarchy showing only folder names.

Display tabs as a bottom sheet

It is also possible to view tabs as a dialog:

  • Tap on the "switch folder" button (to the left of the three dots menu button) opens a bottom sheet dialog.
  • Unlike the horizontal menu, this dialog includes parent folder name for nested folders that placed deeper than in the root folder "Tracks".

Automatically update tabs order after new sort mode selected for "Tracks" tab

It is important to note that the order of tabs on the Configure Map -> Tracks screen is synchronized with the sorting mode selected for the "Tracks" root folder. It meens that every time the sorting mode for the Tracks tab is changed, the tabs order on this screen and in the "Switch folder" dialog updates instantly, reflecting the newly selected order.

@nazar-kutz
Copy link
Contributor

Further Tasks

During working on fixes for this issue and related, several another issues were discovered that are not critical for the current task but require separate consideration and, potentially, fixes within other tasks. These notes are documented here to avoid losing them:

Saving sort mode in "Selection mode" (My Places -> Tracks)

On the My Places -> Tracks screen, it's possible to enter "Selection mode" (via three-dots button -> Select or by long-pressing any folder/track).
In this mode, a sort mode can be set for a folder, but it is not saved after exiting the mode.

Temporary sorting on the track selection screen

On the track selection screen (e.g., when choosing "Follow Track"), it is possible to select a sorting mode for specific folders.
However, the selected sorting mode is temporary: after leaving the track selection screen, the sorting mode is reset.

Duplicate folder names in "Configure Map -> Tracks"

Due to the possibility of overlapping names for subfolders and their parent folders, duplicate items may appear in the top tab menu and in the "Switch folder" dialog.
For example: for folders with relative paths "tracks/1/A/B" and "tracks/2/A/B", the top tab menu will display two tabs named "A" and two tabs named "B". In the "Switch folder" dialog, two entries will appear as "A/B".

Potential Solution:

  • In the "Switch folder" dialog, consider using the full relative path to the folder instead of only including the parent folder's name.
  • Keep the current approach in the top tab menu unchanged, as extending folder names there might cause usability issues for users.

@sonora
Copy link
Member

sonora commented Dec 7, 2024

@nazar-kutz , @Chumva , @vshcherb Thanks for the explanation and actions! But something is still not right, let me summarize once again and demonstrate with screenshots. I have highlighted the issues in yellow.

I have set "A-Z" for all folders and all subfolders on the My Tracks screen!

Case 1, actual folder structure:

A
A/X
B
B/Y
C
import
rec

results in

Case 2, actual folder structure:

import
myTracks    (contains no tracks, only subfolders)
myTracks/A
myTracks/A/X
myTracks/B
myTracks/B/Y
myTracks/C
rec

results in:

Notes:

  • (1) (The display "Last modified" in both cases apparently refers to the "Visible on map" tab selected by default when entering the screen. Apparently setting "Sort subfolder"->"A-Z" on the My Tracks screen is not applied to the "All" and "Visible" tabs, which is probably a smaller issue.)
  • (2) Not using the complete path for the overall "A-Z" sorting seems the bigger issue, because it separates subfolders from their parents and makes them lose connection of what is meant. E.g. if you have a subfolder called "old_versions" in each of your main folders. Imagine subfolders X and Y in my above screenshots were both called "X".

@nazar-kutz
Copy link
Contributor

nazar-kutz commented Dec 9, 2024

@sonora, thank you for your comments.

It appears that the first case is functioning as intended, since the “On Map” and “All” tabs on the Configure Map -> Tracks screen operate with their own sorting modes. In other words, their sort settings are independent from the sort mode selected in My Places -> Tracks.

Regarding the second case, I agree that it would be better to display the full relative path, at least in the "Switch folder" dialog. This issue is also mentioned here under the heading "Duplicate folder names in Configure Map -> Tracks."

@sonora
Copy link
Member

sonora commented Dec 9, 2024

@nazar-kutz Let's re-open this to fix

  • ... I agree that it would be better to display the full relative path, at least in the "Switch folder" dialog.

ok? I seen no reason why we would not use the full sub-path from the tracks root folder for the "A-Z" sorting, I guess everything else produces weird effects.

@sonora sonora reopened this Dec 9, 2024
@vshcherb
Copy link
Member

vshcherb commented Dec 9, 2024

@sonora please open separate issue, this was fixed in 4.9 and will be no more fixes in 4.9 related to this issue

@vshcherb vshcherb closed this as completed Dec 9, 2024
@vshcherb
Copy link
Member

vshcherb commented Dec 9, 2024

Also it's hard to follow already this issue

@Rowin63
Copy link
Author

Rowin63 commented Jan 26, 2025

When moving a track (my places > any track folder > 3dots of the track > move) the appearing folder list still is mixed up ("tracks" is the first folder in this list, "imported" and "rec" are the last ones all the way down)

Osmand +4.9.10, Android 13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment