Skip to content

Commit

Permalink
- Little tweak in CardPresentationController for landscape on iPhone.
Browse files Browse the repository at this point in the history
- Coded the size of the item as detail label in the more header.
  • Loading branch information
Pablo Carrascal committed Aug 22, 2018
1 parent a9fd2d1 commit 6755ac5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
13 changes: 5 additions & 8 deletions ownCloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
23C56538212167BE00BD4B47 /* CardTransitionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C56536212167BE00BD4B47 /* CardTransitionDelegate.swift */; };
23D0E09E205BCF8D002D7C80 /* ownCloudUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 230B84F020597F6E00C9F828 /* ownCloudUI.framework */; };
23D0E09F205BCF8D002D7C80 /* ownCloudUI.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 230B84F020597F6E00C9F828 /* ownCloudUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
23D77FCD212BFBD100DE76F1 /* NamingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23D77FC6212BFBD100DE76F1 /* NamingViewController.swift */; };
23E22BB720C6A5C40024D11E /* UIDevice+UIUserInterfaceIdiom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23E22BB220C6A5C40024D11E /* UIDevice+UIUserInterfaceIdiom.swift */; };
23F6238120B587EF004FDE8B /* SortMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23F6238020B587EF004FDE8B /* SortMethod.swift */; };
23FA23E620BFD3D8009A6D73 /* SortBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23FA23E520BFD3D8009A6D73 /* SortBar.swift */; };
Expand Down Expand Up @@ -305,6 +306,7 @@
23BEF1172076667F00DD2E6F /* IssuesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssuesViewController.swift; sourceTree = "<group>"; };
23C5652F212167BD00BD4B47 /* CardPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardPresentationController.swift; sourceTree = "<group>"; };
23C56536212167BE00BD4B47 /* CardTransitionDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardTransitionDelegate.swift; sourceTree = "<group>"; };
23D77FC6212BFBD100DE76F1 /* NamingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamingViewController.swift; sourceTree = "<group>"; };
23E22BB220C6A5C40024D11E /* UIDevice+UIUserInterfaceIdiom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIDevice+UIUserInterfaceIdiom.swift"; sourceTree = "<group>"; };
23F6238020B587EF004FDE8B /* SortMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortMethod.swift; sourceTree = "<group>"; };
23FA23E520BFD3D8009A6D73 /* SortBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortBar.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -523,6 +525,7 @@
236735A521217C3500E5834A /* MoreViewController.swift */,
232B01F32126B0CE00366FA0 /* MoreViewHeader.swift */,
232B01F52126B10900366FA0 /* MoreStaticTableViewController.swift */,
23D77FC6212BFBD100DE76F1 /* NamingViewController.swift */,
);
path = Actions;
sourceTree = "<group>";
Expand All @@ -531,6 +534,7 @@
isa = PBXGroup;
children = (
230B84F020597F6E00C9F828 /* ownCloudUI.framework */,
6E216A632112F58700ED21BD /* NamingViewController.swift */,
);
name = "Recovered References";
sourceTree = "<group>";
Expand Down Expand Up @@ -590,14 +594,6 @@
name = Pods;
sourceTree = "<group>";
};
6E216A5C2112F55E00ED21BD /* Actions */ = {
isa = PBXGroup;
children = (
6E216A632112F58700ED21BD /* NamingViewController.swift */,
);
path = Actions;
sourceTree = "<group>";
};
DC1B26FD209CF0D2004715E1 /* Issues Animators */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1191,6 +1187,7 @@
DC3BE0DF2077CC14002A0AC0 /* ClientRootViewController.swift in Sources */,
DC1B2709209CF0D3004715E1 /* CertificateViewController.swift in Sources */,
DC136582208223F000FC0F60 /* OCBookmark+Extension.swift in Sources */,
23D77FCD212BFBD100DE76F1 /* NamingViewController.swift in Sources */,
23FA23E620BFD3D8009A6D73 /* SortBar.swift in Sources */,
6E83C78420A33C180066EC23 /* LAContext+Extension.swift in Sources */,
593BAB46209AE1BC00023634 /* PasscodeViewController.swift in Sources */,
Expand Down
8 changes: 4 additions & 4 deletions ownCloud/Client/Actions/MoreViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class MoreViewController: UIViewController {

view.addSubview(headerView)
NSLayoutConstraint.activate([
headerView.leftAnchor.constraint(equalTo: view.leftAnchor),
headerView.rightAnchor.constraint(equalTo: view.rightAnchor),
headerView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor),
headerView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor),
headerView.topAnchor.constraint(equalTo: view.topAnchor),
headerView.heightAnchor.constraint(greaterThanOrEqualToConstant: 80)
])
Expand All @@ -65,8 +65,8 @@ class MoreViewController: UIViewController {
viewController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
viewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
viewController.view.leftAnchor.constraint(equalTo: view.leftAnchor),
viewController.view.rightAnchor.constraint(equalTo: view.rightAnchor),
viewController.view.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor),
viewController.view.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor),
viewController.view.topAnchor.constraint(equalTo: headerView.bottomAnchor),
viewController.view.centerXAnchor.constraint(equalTo: view.centerXAnchor)
])
Expand Down
12 changes: 8 additions & 4 deletions ownCloud/Client/Actions/MoreViewHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class MoreViewHeader: UIView {
self.addSubview(detailLabel)
self.addSubview(iconView)

iconView.leftAnchor.constraint(equalTo: self.leftAnchor, constant: 32).isActive = true
iconView.leftAnchor.constraint(equalTo: self.safeAreaLayoutGuide.leftAnchor, constant: 32).isActive = true
iconView.rightAnchor.constraint(equalTo: titleLabel.leftAnchor, constant: -15).isActive = true
iconView.rightAnchor.constraint(equalTo: detailLabel.leftAnchor, constant: -15).isActive = true

titleLabel.rightAnchor.constraint(equalTo: self.rightAnchor, constant: -20).isActive = true
detailLabel.rightAnchor.constraint(equalTo: self.rightAnchor, constant: -20).isActive = true
titleLabel.rightAnchor.constraint(equalTo: self.safeAreaLayoutGuide.rightAnchor, constant: -20).isActive = true
detailLabel.rightAnchor.constraint(equalTo: self.safeAreaLayoutGuide.rightAnchor, constant: -20).isActive = true

iconView.widthAnchor.constraint(equalToConstant: 60).isActive = true
iconView.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
Expand All @@ -63,7 +63,11 @@ class MoreViewHeader: UIView {
detailLabel.setContentCompressionResistancePriority(UILayoutPriority.defaultHigh, for: UILayoutConstraintAxis.vertical)

titleLabel.attributedText = NSAttributedString(string: item.name, attributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 17, weight: .semibold)])
detailLabel.attributedText = NSAttributedString(string: item.name, attributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 17, weight: .semibold)])

let bcf = ByteCountFormatter()
bcf.countStyle = .file
let size = bcf.string(fromByteCount: Int64(item.size))
detailLabel.attributedText = NSAttributedString(string: size, attributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 17, weight: .semibold)])

self.iconView.image = item.icon(fitInSize: CGSize(width: 40, height: 40))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,21 @@ final class CardPresentationController: UIPresentationController {
}

override var frameOfPresentedViewInContainerView: CGRect {
let presentedOrigin = CGPoint(x: 0, y: cardPosition.origin())
let presentedSize = CGSize(width: windowFrame.width, height: windowFrame.height + 40)

var originX: CGFloat = 0
var width: CGFloat = windowFrame.width

if traitCollection.horizontalSizeClass == .compact && traitCollection.verticalSizeClass == .compact {
originX = 50
width = windowFrame.width - 100
}

let presentedOrigin = CGPoint(x: originX, y: cardPosition.origin())
let presentedSize = CGSize(width: width, height: windowFrame.height + 40)
let presentedFrame = CGRect(origin: presentedOrigin, size: presentedSize)
return presentedFrame
}

// MARK: - Presentation
override func presentationTransitionWillBegin() {
if let containerView = containerView {
Expand Down

0 comments on commit 6755ac5

Please sign in to comment.