Commit b31e5ffd authored by Carola Nitz's avatar Carola Nitz

MediaViewController: Replace editbutton

Since we're using the same icon as rename we also updated the rename icon
Also in editing mode we now don't show sort and just have a Done button in the right corner

(closes #569)
parent c3a86592
......@@ -44,13 +44,19 @@ class VLCMediaViewController: VLCPagingViewController<VLCLabelCell>, MediaCatego
return editButton
}()
private lazy var doneButton: UIBarButtonItem = {
return UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(customSetEditing(button:)))
}()
private var rigthBarButtons: [UIBarButtonItem]?
private var leftBarButton: UIBarButtonItem?
init(services: Services) {
self.services = services
rendererButton = services.rendererDiscovererManager.setupRendererButton()
super.init(nibName: nil, bundle: nil)
rigthBarButtons = [editButton, UIBarButtonItem(customView: rendererButton)]
leftBarButton = sortButton
}
override func viewDidLoad() {
......@@ -95,7 +101,7 @@ class VLCMediaViewController: VLCPagingViewController<VLCLabelCell>, MediaCatego
showButtons = true
}
navigationItem.rightBarButtonItems = showButtons ? rigthBarButtons : nil
navigationItem.leftBarButtonItem = showButtons ? sortButton : nil
navigationItem.leftBarButtonItem = showButtons ? leftBarButton : nil
}
override func configure(cell: VLCLabelCell, for indicatorInfo: IndicatorInfo) {
......@@ -119,13 +125,14 @@ class VLCMediaViewController: VLCPagingViewController<VLCLabelCell>, MediaCatego
extension VLCMediaViewController {
@objc private func customSetEditing(button: UIButton) {
isEditing = !isEditing
rigthBarButtons = isEditing ? [doneButton] : [editButton, UIBarButtonItem(customView: rendererButton)]
leftBarButton = isEditing ? nil : sortButton
}
override func setEditing(_ editing: Bool, animated: Bool) {
super.setEditing(editing, animated: animated)
scrollingEnabled(!editing)
navigationItem.leftBarButtonItem = editing ? nil : sortButton
viewControllers[currentIndex].setEditing(editing, animated: animated)
}
}
......
......@@ -2,17 +2,17 @@
"images" : [
{
"idiom" : "universal",
"filename" : "edit.png",
"filename" : "rename.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "edit@2x.png",
"filename" : "rename@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "edit@3x.png",
"filename" : "rename@3x.png",
"scale" : "3x"
}
],
......
......@@ -2,17 +2,17 @@
"images" : [
{
"idiom" : "universal",
"filename" : "rename.png",
"filename" : "icnEdit.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "rename@2x.png",
"filename" : "icnEdit@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "rename@3x.png",
"filename" : "icnEdit@3x.png",
"scale" : "3x"
}
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment