Closed NotSoImportant closed 4 years ago
I also noted some weirdness with these actions, and thinking back I think your analysis would indeed explain the weirdness I saw.
One other solution would be to always have all actions in the list, but just show/hide them in different contexts. By showing all actions in the edit context menu interface, you can then even e.g. put the "Create POI" in a different place than "Edit POI".
We need to combine
Thanks :-)
Crash: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.get(ArrayList.java:411) at net.osmand.plus.settings.fragments.ConfigureMenuItemsFragment.initMainActionsIds(ConfigureMenuItemsFragment.java:171) at net.osmand.plus.settings.fragments.ConfigureMenuItemsFragment.access$1400(ConfigureMenuItemsFragment.java:61) at net.osmand.plus.settings.fragments.ConfigureMenuItemsFragment$8.onClick(ConfigureMenuItemsFragment.java:496) at androidx.appcompat.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167)
When configuring the actions "create/edit note" and "create/edit POI" to be always visible as 1 of the four actions in the context menu (for quick access), they are getting kicked out after certain workflow.
As far as I only keep adding POIs / notes everything works fine. However when I go and select an edited note / POI, the entry disappears from the main actions context menu. Instead now an item appears at last position of the additional actions menu: "edit POI" or "edit note". The main context menu now has only 3 entries. If I now move the edit action into it, it continues to work for edit, however when clicking somewhere else on the map (where no POI/note can be edited), the edit is gone again and "create ...." is added again as last item in the additional actions menu.
Root cause looks like actions are dynamically added and removed and thereby breaking the functionality of adding them consistently to the main context menu (or anywhere above last entry in additional actions menu).
Solution:
v. 3.7.4