|
@@ -24,7 +24,7 @@
|
|
|
import Foundation
|
|
|
import Sheeeeeeeeet
|
|
|
|
|
|
-class NCMedia: UIViewController ,UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate {
|
|
|
+class NCMedia: UIViewController ,UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIGestureRecognizerDelegate, NCListCellDelegate, NCSectionHeaderMenuDelegate, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate {
|
|
|
|
|
|
@IBOutlet fileprivate weak var collectionView: UICollectionView!
|
|
|
|
|
@@ -60,7 +60,7 @@ class NCMedia: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
|
|
|
|
|
|
// Cell
|
|
|
collectionView.register(UINib.init(nibName: "NCListCell", bundle: nil), forCellWithReuseIdentifier: "listCell")
|
|
|
- collectionView.register(UINib.init(nibName: "NCGridCell", bundle: nil), forCellWithReuseIdentifier: "gridCell")
|
|
|
+ collectionView.register(UINib.init(nibName: "NCGridMediaCell", bundle: nil), forCellWithReuseIdentifier: "gridCell")
|
|
|
|
|
|
// Header
|
|
|
collectionView.register(UINib.init(nibName: "NCSectionHeaderMenu", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionHeaderMenu")
|
|
@@ -175,6 +175,49 @@ class NCMedia: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
|
|
|
|
|
|
func tapMoreHeader(sender: Any) {
|
|
|
|
|
|
+ var menuView: DropdownMenu?
|
|
|
+
|
|
|
+ if isEditMode {
|
|
|
+
|
|
|
+ //let item0 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "checkedNo"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_cancel_", comment: ""))
|
|
|
+ //let item1 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "restore"), multiplier: 1, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_trash_restore_selected_", comment: ""))
|
|
|
+ let item2 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_trash_delete_selected_", comment: ""))
|
|
|
+
|
|
|
+ menuView = DropdownMenu(navigationController: self.navigationController!, items: [item2], selectedRow: -1)
|
|
|
+ menuView?.token = "tapMoreHeaderMenuSelect"
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ let item0 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "select"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_select_", comment: ""))
|
|
|
+ let item1 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "folderMedia"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_select_media_folder_", comment: ""))
|
|
|
+ var item2: DropdownItem
|
|
|
+ if filterTypeFileImage {
|
|
|
+ item2 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "imageno"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_media_viewimage_show_", comment: ""))
|
|
|
+ } else {
|
|
|
+ item2 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "imageyes"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_media_viewimage_hide_", comment: ""))
|
|
|
+ }
|
|
|
+ var item3: DropdownItem
|
|
|
+ if filterTypeFileVideo {
|
|
|
+ item3 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "videono"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_media_viewvideo_show_", comment: ""))
|
|
|
+ } else {
|
|
|
+ item3 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "videoyes"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_media_viewvideo_hide_", comment: ""))
|
|
|
+ }
|
|
|
+ menuView = DropdownMenu(navigationController: self.navigationController!, items: [item0,item1,item2,item3], selectedRow: -1)
|
|
|
+ menuView?.token = "tapMoreHeaderMenu"
|
|
|
+ }
|
|
|
+
|
|
|
+ menuView?.delegate = self
|
|
|
+ menuView?.rowHeight = 45
|
|
|
+ menuView?.highlightColor = NCBrandColor.sharedInstance.brand
|
|
|
+ menuView?.tableView.alwaysBounceVertical = false
|
|
|
+ menuView?.tableViewBackgroundColor = UIColor.white
|
|
|
+
|
|
|
+ let header = (sender as? UIButton)?.superview
|
|
|
+ let headerRect = self.collectionView.convert(header!.bounds, from: self.view)
|
|
|
+ let menuOffsetY = headerRect.height - headerRect.origin.y - 2
|
|
|
+ menuView?.topOffsetY = CGFloat(menuOffsetY)
|
|
|
+
|
|
|
+ menuView?.showMenu()
|
|
|
}
|
|
|
|
|
|
func tapMoreListItem(with fileID: String, sender: Any) {
|