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