Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/mva_3_0
This commit is contained in:
commit
07db61f035
@ -76,7 +76,7 @@ import UIKit
|
|||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
backgroundColor = .mfSilver()
|
backgroundColor = .mfLightSilver()
|
||||||
clipsToBounds = true
|
clipsToBounds = true
|
||||||
if thicknessConstraint == nil {
|
if thicknessConstraint == nil {
|
||||||
thicknessConstraint = heightAnchor.constraint(equalToConstant: defaultHeight)
|
thicknessConstraint = heightAnchor.constraint(equalToConstant: defaultHeight)
|
||||||
@ -84,6 +84,12 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func reset() {
|
||||||
|
super.reset()
|
||||||
|
backgroundColor = .mfLightSilver()
|
||||||
|
progressList = nil
|
||||||
|
}
|
||||||
|
|
||||||
override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
thicknessConstraint?.constant = json?.optionalCGFloatForKey("thickness") ?? defaultHeight
|
thicknessConstraint?.constant = json?.optionalCGFloatForKey("thickness") ?? defaultHeight
|
||||||
|
|||||||
@ -70,7 +70,7 @@ import Foundation
|
|||||||
thickness = 8
|
thickness = 8
|
||||||
progress = 0
|
progress = 0
|
||||||
progressTintColor = UIColor.mfCerulean()
|
progressTintColor = UIColor.mfCerulean()
|
||||||
trackTintColor = UIColor.mfSilver()
|
trackTintColor = UIColor.mfLightSilver()
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
public static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
|
|||||||
@ -34,6 +34,9 @@
|
|||||||
@property (nonatomic) BOOL updateViewHorizontalDefaults;
|
@property (nonatomic) BOOL updateViewHorizontalDefaults;
|
||||||
@property (nonatomic) BOOL updateViewVerticalDefaults;
|
@property (nonatomic) BOOL updateViewVerticalDefaults;
|
||||||
|
|
||||||
|
@property (nonatomic) CGFloat topMarginPadding;
|
||||||
|
@property (nonatomic) CGFloat bottomMarginPadding;
|
||||||
|
|
||||||
/// A molecule if we constrain one.
|
/// A molecule if we constrain one.
|
||||||
@property (weak, nullable, nonatomic) UIView <MVMCoreUIMoleculeViewProtocol>*molecule;
|
@property (weak, nullable, nonatomic) UIView <MVMCoreUIMoleculeViewProtocol>*molecule;
|
||||||
|
|
||||||
|
|||||||
@ -304,18 +304,15 @@
|
|||||||
[super setupView];
|
[super setupView];
|
||||||
self.translatesAutoresizingMaskIntoConstraints = NO;
|
self.translatesAutoresizingMaskIntoConstraints = NO;
|
||||||
self.backgroundColor = [UIColor clearColor];
|
self.backgroundColor = [UIColor clearColor];
|
||||||
|
self.topMarginPadding = PaddingDefaultVerticalSpacing3;
|
||||||
|
self.bottomMarginPadding = PaddingDefaultVerticalSpacing3;
|
||||||
[MVMCoreUIUtility setMarginsForView:self leading:0 top:0 trailing:0 bottom:0];
|
[MVMCoreUIUtility setMarginsForView:self leading:0 top:0 trailing:0 bottom:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateView:(CGFloat)size {
|
- (void)updateView:(CGFloat)size {
|
||||||
[super updateView:size];
|
[super updateView:size];
|
||||||
if ([self.constrainedView respondsToSelector:@selector(updateView:)]) {
|
[self.molecule updateView:size];
|
||||||
[((id<MVMCoreViewProtocol>)self.constrainedView) updateView:size];
|
[MFStyler setMarginsForView:self size:size defaultHorizontal:self.updateViewHorizontalDefaults top:(self.updateViewVerticalDefaults ? self.topMarginPadding : 0) bottom:(self.updateViewVerticalDefaults ? self.bottomMarginPadding : 0)];
|
||||||
}
|
|
||||||
if (self.molecule != self.constrainedView) {
|
|
||||||
[self.molecule updateView:size];
|
|
||||||
}
|
|
||||||
[MFStyler setDefaultMarginsForView:self size:size horizontal:self.updateViewHorizontalDefaults vertical:self.updateViewVerticalDefaults];
|
|
||||||
UIEdgeInsets margins = [MVMCoreUIUtility getMarginsForView:self];
|
UIEdgeInsets margins = [MVMCoreUIUtility getMarginsForView:self];
|
||||||
if (self.updateViewHorizontalDefaults) {
|
if (self.updateViewHorizontalDefaults) {
|
||||||
[self setLeftPinConstant:margins.left];
|
[self setLeftPinConstant:margins.left];
|
||||||
@ -344,6 +341,8 @@
|
|||||||
[super reset];
|
[super reset];
|
||||||
self.updateViewHorizontalDefaults = NO;
|
self.updateViewHorizontalDefaults = NO;
|
||||||
self.updateViewVerticalDefaults = NO;
|
self.updateViewVerticalDefaults = NO;
|
||||||
|
self.topMarginPadding = PaddingDefaultVerticalSpacing3;
|
||||||
|
self.bottomMarginPadding = PaddingDefaultVerticalSpacing3;
|
||||||
if ([self.molecule respondsToSelector:@selector(alignment)]) {
|
if ([self.molecule respondsToSelector:@selector(alignment)]) {
|
||||||
[self alignHorizontal:[(UIView <MVMCoreUIViewConstrainingProtocol> *)self.molecule alignment]];
|
[self alignHorizontal:[(UIView <MVMCoreUIViewConstrainingProtocol> *)self.molecule alignment]];
|
||||||
}
|
}
|
||||||
@ -354,8 +353,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
|
- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
|
||||||
[super setWithJSON:json delegateObject:delegateObject additionalData:additionalData];
|
// Only treated as a container if we are constraining a molecule.
|
||||||
|
if (!self.constrainedView) {
|
||||||
|
[super setWithJSON:json delegateObject:delegateObject additionalData:additionalData];
|
||||||
|
}
|
||||||
[self.molecule setWithJSON:json delegateObject:delegateObject additionalData:additionalData];
|
[self.molecule setWithJSON:json delegateObject:delegateObject additionalData:additionalData];
|
||||||
if (self.shouldSetupMoleculeFromJSON) {
|
if (self.shouldSetupMoleculeFromJSON) {
|
||||||
NSDictionary *moleculeJSON = [json dict:KeyMolecule];
|
NSDictionary *moleculeJSON = [json dict:KeyMolecule];
|
||||||
|
|||||||
@ -19,7 +19,8 @@ import UIKit
|
|||||||
}
|
}
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
scrollView.translatesAutoresizingMaskIntoConstraints = false
|
scrollView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
addConstrainedView(scrollView)
|
addSubview(scrollView)
|
||||||
|
pinView(toSuperView: scrollView)
|
||||||
scrollView.addSubview(contentView)
|
scrollView.addSubview(contentView)
|
||||||
NSLayoutConstraint.constraintPinSubview(toSuperview: contentView)
|
NSLayoutConstraint.constraintPinSubview(toSuperview: contentView)
|
||||||
let constraint = contentView.widthAnchor.constraint(equalTo: scrollView.widthAnchor, multiplier: 1.0)
|
let constraint = contentView.widthAnchor.constraint(equalTo: scrollView.widthAnchor, multiplier: 1.0)
|
||||||
|
|||||||
@ -11,6 +11,8 @@ import UIKit
|
|||||||
open class StandardFooterView: ViewConstrainingView {
|
open class StandardFooterView: ViewConstrainingView {
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
topMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
|
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
shouldSetupMoleculeFromJSON = true
|
shouldSetupMoleculeFromJSON = true
|
||||||
updateViewVerticalDefaults = true
|
updateViewVerticalDefaults = true
|
||||||
updateViewHorizontalDefaults = true
|
updateViewHorizontalDefaults = true
|
||||||
|
|||||||
@ -22,6 +22,8 @@ public class StandardHeaderView: ViewConstrainingView {
|
|||||||
shouldSetupMoleculeFromJSON = true
|
shouldSetupMoleculeFromJSON = true
|
||||||
updateViewVerticalDefaults = true
|
updateViewVerticalDefaults = true
|
||||||
updateViewHorizontalDefaults = true
|
updateViewHorizontalDefaults = true
|
||||||
|
topMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
|
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
if separatorView == nil, let separatorView = SeparatorView.separatorAdd(to: self, position: SeparatorPositionBot, withHorizontalPadding: 0) {
|
if separatorView == nil, let separatorView = SeparatorView.separatorAdd(to: self, position: SeparatorPositionBot, withHorizontalPadding: 0) {
|
||||||
separatorView.setAsHeavy()
|
separatorView.setAsHeavy()
|
||||||
addSubview(separatorView)
|
addSubview(separatorView)
|
||||||
@ -54,6 +56,8 @@ public class StandardHeaderView: ViewConstrainingView {
|
|||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
|
topMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
|
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
separatorView?.setAsHeavy()
|
separatorView?.setAsHeavy()
|
||||||
separatorView?.show()
|
separatorView?.show()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,8 @@ open class HeadlineBody: ViewConstrainingView {
|
|||||||
stylePageHeader()
|
stylePageHeader()
|
||||||
case "item":
|
case "item":
|
||||||
styleListItem()
|
styleListItem()
|
||||||
|
case "itemHeader":
|
||||||
|
styleListItemDivider()
|
||||||
default: break
|
default: break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,6 +55,12 @@ open class HeadlineBody: ViewConstrainingView {
|
|||||||
messageLabel.styleB2(true)
|
messageLabel.styleB2(true)
|
||||||
spaceBetweenLabelsConstant = 0
|
spaceBetweenLabelsConstant = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func styleListItemDivider() {
|
||||||
|
headlineLabel.styleH3(true)
|
||||||
|
messageLabel.styleB2(true)
|
||||||
|
spaceBetweenLabelsConstant = 0
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
@ -80,10 +88,9 @@ open class HeadlineBody: ViewConstrainingView {
|
|||||||
|
|
||||||
headlineLabel.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
|
headlineLabel.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
|
||||||
messageLabel.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
|
messageLabel.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
|
||||||
setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
|
view.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
|
||||||
|
|
||||||
topPin = headlineLabel.topAnchor.constraint(equalTo: view.topAnchor, constant: 0)
|
headlineLabel.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
|
||||||
topPin?.isActive = true
|
|
||||||
|
|
||||||
spaceBetweenLabels = messageLabel.topAnchor.constraint(equalTo: headlineLabel.bottomAnchor, constant: spaceBetweenLabelsConstant)
|
spaceBetweenLabels = messageLabel.topAnchor.constraint(equalTo: headlineLabel.bottomAnchor, constant: spaceBetweenLabelsConstant)
|
||||||
spaceBetweenLabels?.isActive = true
|
spaceBetweenLabels?.isActive = true
|
||||||
@ -100,8 +107,7 @@ open class HeadlineBody: ViewConstrainingView {
|
|||||||
rightConstraintMessage = view.rightAnchor.constraint(equalTo: messageLabel.rightAnchor)
|
rightConstraintMessage = view.rightAnchor.constraint(equalTo: messageLabel.rightAnchor)
|
||||||
rightConstraintMessage?.isActive = true
|
rightConstraintMessage?.isActive = true
|
||||||
|
|
||||||
bottomPin = view.bottomAnchor.constraint(equalTo: messageLabel.bottomAnchor, constant: 0)
|
view.bottomAnchor.constraint(equalTo: messageLabel.bottomAnchor, constant: 0).isActive = true
|
||||||
bottomPin?.isActive = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Constraining
|
// MARK: - Constraining
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user