diff --git a/iOSClient/Media/NCMedia+CollectionViewDataSource.swift b/iOSClient/Media/NCMedia+CollectionViewDataSource.swift index eb69de3ad5..c790ca55c9 100644 --- a/iOSClient/Media/NCMedia+CollectionViewDataSource.swift +++ b/iOSClient/Media/NCMedia+CollectionViewDataSource.swift @@ -47,7 +47,7 @@ extension NCMedia: UICollectionViewDataSource { if numberOfItemsInSection == 0 { selectOrCancelButton.isHidden = true menuButton.isHidden = false - gradientView.isHidden = true + gradientView.alpha = 0 activityIndicatorTrailing.constant = 50 } else if isEditMode { selectOrCancelButton.isHidden = false diff --git a/iOSClient/Media/NCMedia+Command.swift b/iOSClient/Media/NCMedia+Command.swift index baedb8b00d..0e4fbd22dc 100644 --- a/iOSClient/Media/NCMedia+Command.swift +++ b/iOSClient/Media/NCMedia+Command.swift @@ -85,23 +85,27 @@ extension NCMedia { func setColor() { if isTop { - titleDate?.textColor = NCBrandColor.shared.textColor - activityIndicator.color = NCBrandColor.shared.textColor - selectOrCancelButton.setTitleColor(NCBrandColor.shared.textColor, for: .normal) - menuButton.setImage(NCUtility().loadImage(named: "ellipsis", colors: [NCBrandColor.shared.textColor]), for: .normal) - gradientView.isHidden = true + UIView.animate(withDuration: 0.3) { [self] in + gradientView.alpha = 0 + titleDate?.textColor = NCBrandColor.shared.textColor + activityIndicator.color = NCBrandColor.shared.textColor + selectOrCancelButton.setTitleColor(NCBrandColor.shared.textColor, for: .normal) + menuButton.setImage(NCUtility().loadImage(named: "ellipsis", colors: [NCBrandColor.shared.textColor]), for: .normal) + } } else { - titleDate?.textColor = .white - activityIndicator.color = .white - selectOrCancelButton.setTitleColor(.white, for: .normal) - menuButton.setImage(NCUtility().loadImage(named: "ellipsis", colors: [.white]), for: .normal) - gradientView.isHidden = false + UIView.animate(withDuration: 0.3) { [self] in + gradientView.alpha = 1 + titleDate?.textColor = .white + activityIndicator.color = .white + selectOrCancelButton.setTitleColor(.white, for: .normal) + menuButton.setImage(NCUtility().loadImage(named: "ellipsis", colors: [.white]), for: .normal) + } } } func createMenu() { - var layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "") - var columnPhoto = layoutForView?.columnPhoto ?? 3 + let layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "") + let columnPhoto = layoutForView?.columnPhoto ?? 3 let layout = layoutForView?.layout ?? NCGlobal.shared.mediaLayoutRatio let layoutTitle = (layout == NCGlobal.shared.mediaLayoutRatio) ? NSLocalizedString("_media_square_", comment: "") : NSLocalizedString("_media_ratio_", comment: "") let layoutImage = (layout == NCGlobal.shared.mediaLayoutRatio) ? utility.loadImage(named: "square.grid.3x3") : utility.loadImage(named: "rectangle.grid.3x2") @@ -144,25 +148,7 @@ extension NCMedia { self.collectionViewReloadData() } - let zoomViewMediaFolder = UIMenu(title: "", options: .displayInline, children: [ - UIMenu(title: NSLocalizedString("_zoom_", comment: ""), children: [ - UIAction(title: NSLocalizedString("_zoom_out_", comment: ""), image: utility.loadImage(named: "minus.magnifyingglass"), attributes: self.attributesZoomOut) { _ in - UIView.animate(withDuration: 0.0, animations: { - let column = columnPhoto + 1 - NCManageDatabase.shared.setLayoutForView(account: self.appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", columnPhoto: column) - self.createMenu() - self.collectionViewReloadData() - }) - }, - UIAction(title: NSLocalizedString("_zoom_in_", comment: ""), image: utility.loadImage(named: "plus.magnifyingglass"), attributes: self.attributesZoomIn) { _ in - UIView.animate(withDuration: 0.0, animations: { - let column = columnPhoto - 1 - NCManageDatabase.shared.setLayoutForView(account: self.appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", columnPhoto: column) - self.createMenu() - self.collectionViewReloadData() - }) - } - ]), + let viewOptionsMedia = UIMenu(title: "", options: .displayInline, children: [ UIMenu(title: NSLocalizedString("_media_view_options_", comment: ""), children: [viewFilterMenu, viewLayoutMenu]), UIAction(title: NSLocalizedString("_select_media_folder_", comment: ""), image: utility.loadImage(named: "folder"), handler: { _ in guard let navigationController = UIStoryboard(name: "NCSelect", bundle: nil).instantiateInitialViewController() as? UINavigationController, @@ -174,6 +160,24 @@ extension NCMedia { }) ]) + let zoomOut = UIAction(title: NSLocalizedString("_zoom_out_", comment: ""), image: utility.loadImage(named: "minus.magnifyingglass"), attributes: self.attributesZoomOut) { _ in + UIView.animate(withDuration: 0.0, animations: { + let column = columnPhoto + 1 + NCManageDatabase.shared.setLayoutForView(account: self.appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", columnPhoto: column) + self.createMenu() + self.collectionViewReloadData() + }) + } + + let zoomIn = UIAction(title: NSLocalizedString("_zoom_in_", comment: ""), image: utility.loadImage(named: "plus.magnifyingglass"), attributes: self.attributesZoomIn) { _ in + UIView.animate(withDuration: 0.0, animations: { + let column = columnPhoto - 1 + NCManageDatabase.shared.setLayoutForView(account: self.appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", columnPhoto: column) + self.createMenu() + self.collectionViewReloadData() + }) + } + let playFile = UIAction(title: NSLocalizedString("_play_from_files_", comment: ""), image: utility.loadImage(named: "play.circle")) { _ in guard let controller = self.tabBarController as? NCMainTabBarController else { return } self.documentPickerViewController = NCDocumentPickerViewController(controller: controller, isViewerMedia: true, allowsMultipleSelection: false, viewController: self) @@ -195,7 +199,7 @@ extension NCMedia { self.present(alert, animated: true) } - menuButton.menu = UIMenu(title: "", children: [zoomViewMediaFolder, playFile, playURL]) + menuButton.menu = UIMenu(title: "", children: [zoomOut, zoomIn, viewOptionsMedia, playFile, playURL]) } } diff --git a/iOSClient/Media/NCMedia.storyboard b/iOSClient/Media/NCMedia.storyboard index f1e221f104..1b531bc1ed 100644 --- a/iOSClient/Media/NCMedia.storyboard +++ b/iOSClient/Media/NCMedia.storyboard @@ -1,9 +1,9 @@ - + - + @@ -31,7 +31,7 @@ - + @@ -52,12 +52,12 @@