Commit 7560013c by Daniel Dahan

development: updated Motion Framework and added back button management for…

development: updated Motion Framework and added back button management for NavigationBar and NavigationItem
parent d3247fbd
Subproject commit e275fffc6eede491be187a7c11787367c3ac906f
Subproject commit 8fb973a5737a3514ff5a0ec973abfb84ad88013e
......@@ -103,6 +103,10 @@
965E81231DD4D7C800D61E4B /* BottomTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7591CB40DC500C806FE /* BottomTabBar.swift */; };
965E81261DD4D7C800D61E4B /* CharacterAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = 961276621DCD8B1800A7D920 /* CharacterAttribute.swift */; };
966C17731F0439F600D3E83C /* Material+MotionAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966C17721F0439F600D3E83C /* Material+MotionAnimation.swift */; };
9685D5AF1F0F04CB00AFEB79 /* CardCollectionViewCell.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9656895E1F002F16001C656D /* CardCollectionViewCell.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9685D5B01F0F04CB00AFEB79 /* CardCollectionViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965689601F002F4C001C656D /* CardCollectionViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9685D5B11F0F04CB00AFEB79 /* Material+MotionAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 966C17721F0439F600D3E83C /* Material+MotionAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9685D5B21F0F04CB00AFEB79 /* PanController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96DE566B1EF1B63B006DA70E /* PanController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7BF1D8F2572004741EC /* Divider.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96230AB71D6A520C00AF47DC /* Divider.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7C01D8F2572004741EC /* Material+CALayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96F1DC871D654FDF0025F925 /* Material+CALayer.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7C11D8F2572004741EC /* Material+Array.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96C1C8801D42C62800E6608F /* Material+Array.swift */; settings = {ATTRIBUTES = (Public, ); }; };
......@@ -180,7 +184,7 @@
remoteGlobalIDString = 96C98DD11E424AB000B22906;
remoteInfo = "Motion iOS";
};
966A7F1F1EEC5D5900A2DAAC /* PBXContainerItemProxy */ = {
9685D5BC1F0F078B00AFEB79 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 966A7F191EEC5D5000A2DAAC /* Motion.xcodeproj */;
proxyType = 1;
......@@ -817,15 +821,19 @@
961409B21E43D15C00E7BA99 /* FABMenuController.swift in Headers */,
96BFC16F1E63C10A0075DE1F /* SpringAnimation.swift in Headers */,
964335BA1EC9432400FA9954 /* TabsController.swift in Headers */,
9685D5AF1F0F04CB00AFEB79 /* CardCollectionViewCell.swift in Headers */,
9685D5B01F0F04CB00AFEB79 /* CardCollectionViewController.swift in Headers */,
9685D5B11F0F04CB00AFEB79 /* Material+MotionAnimation.swift in Headers */,
9685D5B21F0F04CB00AFEB79 /* PanController.swift in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
963832351B88DFD80015F710 /* Material iOS */ = {
963832351B88DFD80015F710 /* Material */ = {
isa = PBXNativeTarget;
buildConfigurationList = 9638324C1B88DFD80015F710 /* Build configuration list for PBXNativeTarget "Material iOS" */;
buildConfigurationList = 9638324C1B88DFD80015F710 /* Build configuration list for PBXNativeTarget "Material" */;
buildPhases = (
963832311B88DFD80015F710 /* Sources */,
963832331B88DFD80015F710 /* Headers */,
......@@ -834,9 +842,9 @@
buildRules = (
);
dependencies = (
966A7F201EEC5D5900A2DAAC /* PBXTargetDependency */,
9685D5BD1F0F078B00AFEB79 /* PBXTargetDependency */,
);
name = "Material iOS";
name = Material;
productName = FocusKit;
productReference = 963832361B88DFD80015F710 /* Material.framework */;
productType = "com.apple.product-type.framework";
......@@ -879,7 +887,7 @@
);
projectRoot = "";
targets = (
963832351B88DFD80015F710 /* Material iOS */,
963832351B88DFD80015F710 /* Material */,
);
};
/* End PBXProject section */
......@@ -1001,10 +1009,10 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
966A7F201EEC5D5900A2DAAC /* PBXTargetDependency */ = {
9685D5BD1F0F078B00AFEB79 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "Motion iOS";
targetProxy = 966A7F1F1EEC5D5900A2DAAC /* PBXContainerItemProxy */;
targetProxy = 9685D5BC1F0F078B00AFEB79 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
......@@ -1172,7 +1180,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
9638324C1B88DFD80015F710 /* Build configuration list for PBXNativeTarget "Material iOS" */ = {
9638324C1B88DFD80015F710 /* Build configuration list for PBXNativeTarget "Material" */ = {
isa = XCConfigurationList;
buildConfigurations = (
9638324D1B88DFD80015F710 /* Debug */,
......
......@@ -16,7 +16,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "963832351B88DFD80015F710"
BuildableName = "Material.framework"
BlueprintName = "Material iOS"
BlueprintName = "Material"
ReferencedContainer = "container:Material.xcodeproj">
</BuildableReference>
</BuildActionEntry>
......@@ -44,7 +44,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "963832351B88DFD80015F710"
BuildableName = "Material.framework"
BlueprintName = "Material iOS"
BlueprintName = "Material"
ReferencedContainer = "container:Material.xcodeproj">
</BuildableReference>
</MacroExpansion>
......@@ -66,7 +66,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "963832351B88DFD80015F710"
BuildableName = "Material.framework"
BlueprintName = "Material iOS"
BlueprintName = "Material"
ReferencedContainer = "container:Material.xcodeproj">
</BuildableReference>
</MacroExpansion>
......@@ -84,7 +84,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "963832351B88DFD80015F710"
BuildableName = "Material.framework"
BlueprintName = "Material iOS"
BlueprintName = "Material"
ReferencedContainer = "container:Material.xcodeproj">
</BuildableReference>
</MacroExpansion>
......
......@@ -42,11 +42,10 @@ public enum BorderWidthPreset: Int {
case border7
case border8
case border9
}
/// Converts the BorderWidthPreset enum to a CGFloat value.
public func BorderWidthPresetToValue(preset: BorderWidthPreset) -> CGFloat {
switch preset {
/// A CGFloat representation of the border width preset.
public var cgFloatValue: CGFloat {
switch self {
case .none:
return 0
case .border1:
......@@ -68,4 +67,5 @@ public func BorderWidthPresetToValue(preset: BorderWidthPreset) -> CGFloat {
case .border9:
return 8
}
}
}
......@@ -51,7 +51,7 @@ fileprivate class MaterialLayer {
/// A preset property to set the borderWidth.
fileprivate var borderWidthPreset = BorderWidthPreset.none {
didSet {
layer?.borderWidth = BorderWidthPresetToValue(preset: borderWidthPreset)
layer?.borderWidth = borderWidthPreset.cgFloatValue
}
}
......
......@@ -152,9 +152,16 @@ extension NavigationController: UINavigationBarDelegate {
*/
public func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool {
if let v = navigationBar as? NavigationBar {
item.backButton.addTarget(self, action: #selector(handleBackButton), for: .touchUpInside)
if nil == item.backButton.image && nil == item.backButton.title {
item.backButton.image = v.backButtonImage
}
item.backButton.addTarget(self, action: #selector(handleBackButton), for: .touchUpInside)
if !item.backButton.isHidden {
item.leftViews.insert(item.backButton, at: 0)
}
v.layoutNavigationItem(item: item)
}
return true
......
......@@ -43,16 +43,16 @@ public class NavigationItem: NSObject {
}
/// Back Button.
public private(set) lazy var backButton: IconButton = IconButton()
public fileprivate(set) lazy var backButton: IconButton = IconButton()
/// Content View.
public private(set) lazy var contentView = UIView()
public fileprivate(set) var contentView = UIView()
/// Title label.
public private(set) lazy var titleLabel = UILabel()
public fileprivate(set) var titleLabel = UILabel()
/// Detail label.
public private(set) lazy var detailLabel = UILabel()
public fileprivate(set) var detailLabel = UILabel()
/// Left items.
public var leftViews = [UIView]() {
......@@ -108,12 +108,12 @@ public class NavigationItem: NSObject {
}
/// Reloads the subviews for the NavigationBar.
internal func reload() {
fileprivate func reload() {
navigationBar?.layoutSubviews()
}
/// Prepares the titleLabel.
private func prepareTitleLabel() {
fileprivate func prepareTitleLabel() {
titleLabel.textAlignment = .center
titleLabel.contentScaleFactor = Screen.scale
titleLabel.font = RobotoFont.medium(with: 17)
......@@ -122,7 +122,7 @@ public class NavigationItem: NSObject {
}
/// Prepares the detailLabel.
private func prepareDetailLabel() {
fileprivate func prepareDetailLabel() {
detailLabel.textAlignment = .center
titleLabel.contentScaleFactor = Screen.scale
detailLabel.font = RobotoFont.regular(with: 12)
......
......@@ -147,15 +147,15 @@ public struct Pulse {
let t: TimeInterval = .center == animation ? 0.16125 : 0.325
switch animation {
case .centerWithBacking, .backing, .pointWithBacking:
bLayer.animate(.background(color: color.withAlphaComponent(opacity / 2)), .duration(t))
default:break
}
// switch animation {
// case .centerWithBacking, .backing, .pointWithBacking:
// bLayer.animate(.duration(t))
// default:break
// }
switch animation {
case .center, .centerWithBacking, .centerRadialBeyondBounds, .radialBeyondBounds, .point, .pointWithBacking:
pLayer.animate(.scale(), .duration(t))
pLayer.animate(.scale(), .background(color: color.withAlphaComponent(opacity / 2)), .duration(t))
default:break
}
......@@ -181,11 +181,11 @@ public struct Pulse {
let t: TimeInterval = 0.325
switch animation {
case .centerWithBacking, .backing, .pointWithBacking:
bLayer.animate(.background(color: color.withAlphaComponent(0)), .duration(t))
default:break
}
// switch animation {
// case .centerWithBacking, .backing, .pointWithBacking:
// bLayer.animate(.background(color: color.withAlphaComponent(0)), .duration(t))
// default:break
// }
switch animation {
case .center, .centerWithBacking, .centerRadialBeyondBounds, .radialBeyondBounds, .point, .pointWithBacking:
......
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