Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iOSClient/Media/NCMedia+CollectionViewDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
68 changes: 36 additions & 32 deletions iOSClient/Media/NCMedia+Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand All @@ -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])
}
}

Expand Down
12 changes: 6 additions & 6 deletions iOSClient/Media/NCMedia.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="EFX-fO-Oip">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="EFX-fO-Oip">
<device id="retina5_9" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -31,7 +31,7 @@
<outlet property="delegate" destination="EFX-fO-Oip" id="s3n-CL-8X2"/>
</connections>
</collectionView>
<view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7rV-YL-aM7">
<view userInteractionEnabled="NO" alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7rV-YL-aM7">
<rect key="frame" x="0.0" y="0.0" width="375" height="150"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
Expand All @@ -52,12 +52,12 @@
<color key="color" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</activityIndicatorView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Enx-va-Bud">
<rect key="frame" x="235" y="65" width="90" height="30"/>
<rect key="frame" x="255" y="65" width="70" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="90" id="N4t-Eb-vDt"/>
<constraint firstAttribute="width" constant="70" id="N4t-Eb-vDt"/>
<constraint firstAttribute="height" constant="30" id="YfM-AZ-ws4"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Title"/>
<connections>
Expand Down
9 changes: 3 additions & 6 deletions iOSClient/Media/NCMedia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import NextcloudKit
import RealmSwift

class NCMedia: UIViewController {

@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var titleDate: UILabel!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
Expand Down Expand Up @@ -80,8 +79,6 @@ class NCMedia: UIViewController {
collectionView.contentInset = UIEdgeInsets(top: insetsTop, left: 0, bottom: 50, right: 0)
collectionView.backgroundColor = .systemBackground
collectionView.prefetchDataSource = self
// Drag & Drop
// Drag & Drop
collectionView.dragInteractionEnabled = true
collectionView.dragDelegate = self
collectionView.dropDelegate = self
Expand All @@ -100,7 +97,7 @@ class NCMedia: UIViewController {
selectOrCancelButton.layer.cornerRadius = 15
selectOrCancelButton.layer.masksToBounds = true
selectOrCancelButton.setTitle( NSLocalizedString("_select_", comment: ""), for: .normal)
selectOrCancelButton.addBlur(style: .systemThinMaterial)
selectOrCancelButton.addBlur(style: .systemUltraThinMaterial)

menuButton.backgroundColor = .clear
menuButton.layer.cornerRadius = 15
Expand All @@ -109,7 +106,7 @@ class NCMedia: UIViewController {
menuButton.configuration = UIButton.Configuration.plain()
menuButton.setImage(NCUtility().loadImage(named: "ellipsis"), for: .normal)
menuButton.changesSelectionAsPrimaryAction = false
menuButton.addBlur(style: .systemThinMaterial)
menuButton.addBlur(style: .systemUltraThinMaterial)

gradient.startPoint = CGPoint(x: 0, y: 0.1)
gradient.endPoint = CGPoint(x: 0, y: 1)
Expand Down Expand Up @@ -206,7 +203,7 @@ class NCMedia: UIViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
if self.traitCollection.userInterfaceStyle == .dark {
return .lightContent
} else if isTop {
} else if isTop {
return .darkContent
} else {
return .lightContent
Expand Down