Commit 82564ad0 by Daniel Dahan

development: renamed Display properties with their respective type values as prefixes to Display

parent 0d4477a7
...@@ -71,7 +71,7 @@ open class CaptureController: ToolbarController { ...@@ -71,7 +71,7 @@ open class CaptureController: ToolbarController {
*/ */
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
display = .full toolbarDisplay = .full
view.backgroundColor = .black view.backgroundColor = .black
prepareStatusBar() prepareStatusBar()
......
...@@ -67,8 +67,10 @@ open class CollectionViewCard: Card { ...@@ -67,8 +67,10 @@ open class CollectionViewCard: Card {
open override func reload() { open override func reload() {
if 0 == collectionView.height { if 0 == collectionView.height {
var h: CGFloat = 0 var h: CGFloat = 0
var i: Int = 0
for dataSourceItem in dataSourceItems { for dataSourceItem in dataSourceItems {
h += dataSourceItem.height ?? 0 h += dataSourceItem.height ?? (dataSourceItems[i].data as? Card)?.height ?? 0
i += 1
} }
collectionView.height = h collectionView.height = h
} }
...@@ -94,13 +96,7 @@ extension CollectionViewCard { ...@@ -94,13 +96,7 @@ extension CollectionViewCard {
} }
} }
extension CollectionViewCard: CollectionViewDelegate { extension CollectionViewCard: CollectionViewDelegate {}
open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
// guard let card = dataSourceItemsIndexPaths[indexPath] as? Card else {
// return
// }
}
}
extension CollectionViewCard: CollectionViewDataSource { extension CollectionViewCard: CollectionViewDataSource {
@objc @objc
......
...@@ -54,7 +54,7 @@ open class SearchBarController: StatusBarController { ...@@ -54,7 +54,7 @@ open class SearchBarController: StatusBarController {
display the rootViewController to the full view display the rootViewController to the full view
bounds, or up to the searchBar height. bounds, or up to the searchBar height.
*/ */
open var display = Display.partial { open var searchBarDisplay = Display.partial {
didSet { didSet {
layoutSubviews() layoutSubviews()
} }
...@@ -68,15 +68,15 @@ open class SearchBarController: StatusBarController { ...@@ -68,15 +68,15 @@ open class SearchBarController: StatusBarController {
super.layoutSubviews() super.layoutSubviews()
let y = Application.shouldStatusBarBeHidden || statusBar.isHidden ? 0 : statusBar.height let y = Application.shouldStatusBarBeHidden || statusBar.isHidden ? 0 : statusBar.height
let p = y + searchBar.height
searchBar.y = y searchBar.y = y
searchBar.width = view.width searchBar.width = view.width
switch display { switch searchBarDisplay {
case .partial: case .partial:
rootViewController.view.y = p let h = y + searchBar.height
rootViewController.view.height = view.height - p rootViewController.view.y = h
rootViewController.view.height = view.height - h
case .full: case .full:
rootViewController.view.frame = view.bounds rootViewController.view.frame = view.bounds
} }
......
...@@ -49,6 +49,17 @@ extension UIViewController { ...@@ -49,6 +49,17 @@ extension UIViewController {
} }
open class StatusBarController: RootController { open class StatusBarController: RootController {
/**
A Display value to indicate whether or not to
display the rootViewController to the full view
bounds, or up to the toolbar height.
*/
open var statusBarDisplay = Display.full {
didSet {
layoutSubviews()
}
}
/// Device status bar style. /// Device status bar style.
open var statusBarStyle: UIStatusBarStyle { open var statusBarStyle: UIStatusBarStyle {
get { get {
...@@ -88,7 +99,15 @@ open class StatusBarController: RootController { ...@@ -88,7 +99,15 @@ open class StatusBarController: RootController {
} }
statusBar.width = view.width statusBar.width = view.width
rootViewController.view.frame = view.bounds
switch statusBarDisplay {
case .partial:
let h = statusBar.height
rootViewController.view.y = h
rootViewController.view.height = view.height - h
case .full:
rootViewController.view.frame = view.bounds
}
} }
/** /**
......
...@@ -70,11 +70,11 @@ public protocol ToolbarControllerDelegate { ...@@ -70,11 +70,11 @@ public protocol ToolbarControllerDelegate {
@objc(ToolbarController) @objc(ToolbarController)
open class ToolbarController: StatusBarController { open class ToolbarController: StatusBarController {
/** /**
A Display value to indicate whether or not to A Display value to indicate whether or not to
display the rootViewController to the full view display the rootViewController to the full view
bounds, or up to the toolbar height. bounds, or up to the toolbar height.
*/ */
open var display = Display.partial { open var toolbarDisplay = Display.partial {
didSet { didSet {
layoutSubviews() layoutSubviews()
} }
...@@ -182,15 +182,15 @@ open class ToolbarController: StatusBarController { ...@@ -182,15 +182,15 @@ open class ToolbarController: StatusBarController {
super.layoutSubviews() super.layoutSubviews()
let y = Application.shouldStatusBarBeHidden || statusBar.isHidden ? 0 : statusBar.height let y = Application.shouldStatusBarBeHidden || statusBar.isHidden ? 0 : statusBar.height
let p = y + toolbar.height
toolbar.y = y toolbar.y = y
toolbar.width = view.width toolbar.width = view.width
switch display { switch toolbarDisplay {
case .partial: case .partial:
rootViewController.view.y = p let h = y + toolbar.height
rootViewController.view.height = view.height - p rootViewController.view.y = h
rootViewController.view.height = view.height - h
case .full: case .full:
rootViewController.view.frame = view.bounds rootViewController.view.frame = view.bounds
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment