osmandapp / OsmAnd-iOS

OsmAnd for iOS
Other
288 stars 92 forks source link

Sort Subfolders – Tracks #3415

Closed dmpr0 closed 16 hours ago

dmpr0 commented 9 months ago

Description

Add action that will allow to sort all folders and tracks in the present folder.

Android task https://github.com/osmandapp/OsmAnd/issues/17467

ToDo

Folder menu Sorting menu Toast message

 

Open folder menu

Context menu available as action on NavBar for open folder.

 

Sort by

Confirmation

tigrim commented 6 months ago

Technical Plan:

1) Work with the class TracksViewController. 2) Function setupNavBarMenuButton.

3) To display a toast, use: OAUtilities.showToast(text, details: nil, duration: 4, in: view)

4) Example of implementing a nested menu:

buttonView.isUserInteractionEnabled = true
let interaction = UIContextMenuInteraction(delegate: self)
buttonView.addInteraction(interaction)

extension ViewController: UIContextMenuInteractionDelegate {
    func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
        let configuration = UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { actions -> UIMenu? in
            // Creating Save button
            let save = UIAction(title: "Save", image: UIImage(systemName: "tray.and.arrow.down.fill")) { action in
                // Just showing some alert
                // self.showAlert(title: action.title)
            }

            // Creating Rotate button
            let rotate = UIAction(title: "Rotate", image: UIImage(systemName: "arrow.counterclockwise")) { action in
                // self.showAlert(title: action.title)
            }
            // Creating Delete button
            let delete = UIAction(title: "Delete", image: UIImage(systemName: "trash.fill")) { action in
                // self.showAlert(title: action.title)
            }
            // Creating Edit, which will open Submenu
            let edit = UIMenu(title: "Edit...", children: [rotate, delete])

            // Creating main context menu
            return UIMenu(title: "Menu", children: [save, edit])
        }
        return configuration
    }
}

Testing:

DmitrySvetlichny commented 3 months ago

https://github.com/osmandapp/OsmAnd-iOS/pull/3940

DmitrySvetlichny commented 2 months ago

I spent 8 hours building the project due to issues that arose after adding the Kotlin library.

DmitrySvetlichny commented 4 days ago

https://github.com/osmandapp/OsmAnd-iOS/pull/4125