|
@@ -71,7 +71,7 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
|
|
|
collectionView.register(UINib.init(nibName: "NCGridMediaCell", bundle: nil), forCellWithReuseIdentifier: "gridCell")
|
|
|
|
|
|
collectionView.alwaysBounceVertical = true
|
|
|
- collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 50, right: 0);
|
|
|
+ collectionView.contentInset = UIEdgeInsets(top: 75, left: 0, bottom: 50, right: 0);
|
|
|
|
|
|
gridLayout = NCGridMediaLayout()
|
|
|
gridLayout.itemPerLine = CGFloat(min(CCUtility.getMediaWidthImage(), 5))
|
|
@@ -105,9 +105,7 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
|
|
|
mediaCommandView?.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = true
|
|
|
mediaCommandView?.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = true
|
|
|
mediaCommandView?.heightAnchor.constraint(equalToConstant: 150).isActive = true
|
|
|
- if self.metadatas.count == 0 {
|
|
|
- self.mediaCommandView?.isHidden = true
|
|
|
- }
|
|
|
+ self.updateMediaControlVisibility()
|
|
|
|
|
|
changeTheming()
|
|
|
}
|
|
@@ -186,15 +184,17 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
|
|
|
var actions: [NCMenuAction] = []
|
|
|
|
|
|
if !isEditMode {
|
|
|
- actions.append(
|
|
|
- NCMenuAction(
|
|
|
- title: NSLocalizedString("_select_", comment: ""),
|
|
|
- icon: CCGraphics.changeThemingColorImage(UIImage(named: "selectFull"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
- action: { menuAction in
|
|
|
- self.isEditMode = true
|
|
|
- }
|
|
|
+ if metadatas.count > 0{
|
|
|
+ actions.append(
|
|
|
+ NCMenuAction(
|
|
|
+ title: NSLocalizedString("_select_", comment: ""),
|
|
|
+ icon: CCGraphics.changeThemingColorImage(UIImage(named: "selectFull"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
+ action: { menuAction in
|
|
|
+ self.isEditMode = true
|
|
|
+ }
|
|
|
+ )
|
|
|
)
|
|
|
- )
|
|
|
+ }
|
|
|
|
|
|
actions.append(
|
|
|
NCMenuAction(
|
|
@@ -278,11 +278,7 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
|
|
|
let metadatas = self.metadatas.filter { $0.ocId != metadata.ocId }
|
|
|
self.metadatas = metadatas
|
|
|
|
|
|
- if self.metadatas.count > 0 {
|
|
|
- self.mediaCommandView?.isHidden = false
|
|
|
- } else {
|
|
|
- self.mediaCommandView?.isHidden = true
|
|
|
- }
|
|
|
+ self.updateMediaControlVisibility()
|
|
|
|
|
|
self.reloadDataSource()
|
|
|
|
|
@@ -542,11 +538,8 @@ extension NCMedia {
|
|
|
DispatchQueue.main.sync {
|
|
|
self.metadatas = metadatas
|
|
|
|
|
|
- if self.metadatas.count > 0 {
|
|
|
- self.mediaCommandView?.isHidden = false
|
|
|
- } else {
|
|
|
- self.mediaCommandView?.isHidden = true
|
|
|
- }
|
|
|
+ self.updateMediaControlVisibility()
|
|
|
+
|
|
|
self.reloadDataThenPerform {
|
|
|
self.mediaCommandTitle()
|
|
|
}
|
|
@@ -554,6 +547,20 @@ extension NCMedia {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ func updateMediaControlVisibility() {
|
|
|
+ if self.metadatas.count == 0 {
|
|
|
+ if !self.filterTypeFileImage && !self.filterTypeFileVideo {
|
|
|
+ self.mediaCommandView?.isHidden = true
|
|
|
+ } else {
|
|
|
+ self.mediaCommandView?.toggleEmptyView(isEmpty: true)
|
|
|
+ self.mediaCommandView?.isHidden = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ self.mediaCommandView?.toggleEmptyView(isEmpty: false)
|
|
|
+ self.mediaCommandView?.isHidden = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@objc func searchNewPhotoVideo() {
|
|
|
|
|
|
if newInProgress { return }
|
|
@@ -732,6 +739,16 @@ class NCMediaCommandView: UIView {
|
|
|
title.text = ""
|
|
|
}
|
|
|
|
|
|
+ func toggleEmptyView(isEmpty: Bool) {
|
|
|
+ if isEmpty {
|
|
|
+ self.gradient.isHidden = true
|
|
|
+ self.controlButtonView.isHidden = true
|
|
|
+ } else {
|
|
|
+ self.gradient.isHidden = false
|
|
|
+ self.controlButtonView.isHidden = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@IBAction func moreButtonPressed(_ sender: UIButton) {
|
|
|
mediaView?.openMenuButtonMore(sender)
|
|
|
}
|