background color consolidation
This commit is contained in:
parent
0db0f91b3b
commit
01803e90d6
@ -108,10 +108,6 @@ open class CaretView: MFView {
|
|||||||
// Configure class properties with JSON values
|
// Configure class properties with JSON values
|
||||||
guard let dictionary = json else { return }
|
guard let dictionary = json else { return }
|
||||||
|
|
||||||
if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String {
|
|
||||||
backgroundColor = UIColor.mfGet(forHex: backgroundColorHex)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let strokeColorHex = dictionary["strokeColor"] as? String {
|
if let strokeColorHex = dictionary["strokeColor"] as? String {
|
||||||
strokeColor = UIColor.mfGet(forHex: strokeColorHex)
|
strokeColor = UIColor.mfGet(forHex: strokeColorHex)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,10 +74,6 @@ open class DashLine: MFView {
|
|||||||
// Configure class properties with JSON values
|
// Configure class properties with JSON values
|
||||||
guard let jsonDictionary = json else { return }
|
guard let jsonDictionary = json else { return }
|
||||||
|
|
||||||
if let backgroundColorHex = jsonDictionary[KeyBackgroundColor] as? String {
|
|
||||||
backgroundColor = UIColor.mfGet(forHex: backgroundColorHex)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let isHiddenValue = jsonDictionary[KeyIsHidden] as? Bool {
|
if let isHiddenValue = jsonDictionary[KeyIsHidden] as? Bool {
|
||||||
isHidden = isHiddenValue
|
isHidden = isHiddenValue
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,10 +170,6 @@ import Foundation
|
|||||||
leftTextLabel.setWithJSON(dictionary.optionalDictionaryForKey("leftText"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData)
|
leftTextLabel.setWithJSON(dictionary.optionalDictionaryForKey("leftText"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData)
|
||||||
rightTextLabel.setWithJSON(dictionary.optionalDictionaryForKey("rightText"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData)
|
rightTextLabel.setWithJSON(dictionary.optionalDictionaryForKey("rightText"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData)
|
||||||
|
|
||||||
if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String {
|
|
||||||
backgroundColor = UIColor.mfGet(forHex: backgroundColorHex)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !leftTextLabel.hasText {
|
if !leftTextLabel.hasText {
|
||||||
constrainRightLabel()
|
constrainRightLabel()
|
||||||
} else if !rightTextLabel.hasText {
|
} else if !rightTextLabel.hasText {
|
||||||
|
|||||||
@ -186,9 +186,6 @@ import UIKit
|
|||||||
|
|
||||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
if let backgroundColorString = json?.optionalStringForKey(KeyBackgroundColor) {
|
|
||||||
backgroundColor = UIColor.mfGet(forHex: backgroundColorString)
|
|
||||||
}
|
|
||||||
if let accessibilityString = json?.optionalStringForKey("accessibilityText") {
|
if let accessibilityString = json?.optionalStringForKey("accessibilityText") {
|
||||||
imageView.accessibilityLabel = accessibilityString
|
imageView.accessibilityLabel = accessibilityString
|
||||||
imageView.accessibilityTraits = .staticText
|
imageView.accessibilityTraits = .staticText
|
||||||
|
|||||||
@ -8,6 +8,9 @@
|
|||||||
|
|
||||||
#import "MFView.h"
|
#import "MFView.h"
|
||||||
@import MVMCore.Swift;
|
@import MVMCore.Swift;
|
||||||
|
@import MVMCore.NSDictionary_MFConvenience;
|
||||||
|
#import "MVMCoreUIConstants.h"
|
||||||
|
#import "UIColor+MFConvenience.h"
|
||||||
|
|
||||||
@implementation MFView
|
@implementation MFView
|
||||||
|
|
||||||
@ -46,6 +49,11 @@
|
|||||||
|
|
||||||
- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
|
- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
|
||||||
self.json = json;
|
self.json = json;
|
||||||
|
|
||||||
|
NSString *colorString = [json string:KeyBackgroundColor];
|
||||||
|
if (colorString) {
|
||||||
|
self.backgroundColor = [UIColor mfGetColorForHex:colorString];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -115,10 +115,7 @@
|
|||||||
[self setAsLight];
|
[self setAsLight];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NSString *backgroundColor = [json string:KeyBackgroundColor];
|
|
||||||
if (backgroundColor) {
|
|
||||||
self.backgroundColor = [UIColor mfGetColorForHex:backgroundColor];
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
self.hidden = YES;
|
self.hidden = YES;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -326,6 +326,9 @@
|
|||||||
if (self.molecule) {
|
if (self.molecule) {
|
||||||
[self.molecule setWithJSON:json delegateObject:delegateObject additionalData:additionalData];
|
[self.molecule setWithJSON:json delegateObject:delegateObject additionalData:additionalData];
|
||||||
}
|
}
|
||||||
|
if (self.constrainedView) {
|
||||||
|
self.backgroundColor = self.constrainedView.backgroundColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -111,7 +111,8 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
}
|
}
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
addConstrainedView(contentView)
|
addSubview(contentView)
|
||||||
|
pinView(toSuperView: contentView)
|
||||||
contentView.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
contentView.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
||||||
contentView.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
contentView.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||||
}
|
}
|
||||||
@ -164,10 +165,6 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
items = self.items
|
items = self.items
|
||||||
}
|
}
|
||||||
self.items = []
|
self.items = []
|
||||||
|
|
||||||
if let colorString = json?.optionalStringForKey(KeyBackgroundColor) {
|
|
||||||
backgroundColor = .mfGet(forHex: colorString)
|
|
||||||
}
|
|
||||||
|
|
||||||
guard let molecules = json?.arrayForKey(KeyMolecules) as? [[String: Any]] else {
|
guard let molecules = json?.arrayForKey(KeyMolecules) as? [[String: Any]] else {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -95,9 +95,6 @@ public class StandardFooterView: ViewConstrainingView {
|
|||||||
|
|
||||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
if let colorString = json?.optionalStringForKey(KeyBackgroundColor) {
|
|
||||||
backgroundColor = .mfGet(forHex: colorString)
|
|
||||||
}
|
|
||||||
twoButtonView.setWithJSON(json?.optionalDictionaryForKey("twoButtonView"), delegateObject: delegateObject, additionalData: additionalData)
|
twoButtonView.setWithJSON(json?.optionalDictionaryForKey("twoButtonView"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
textButton.setWithJSON(json?.optionalDictionaryForKey("textButton"), delegateObject: delegateObject, additionalData: additionalData)
|
textButton.setWithJSON(json?.optionalDictionaryForKey("textButton"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,9 +122,6 @@ public class StandardHeaderView: ViewConstrainingView {
|
|||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
if let colorString = json?.optionalStringForKey(KeyBackgroundColor) {
|
|
||||||
backgroundColor = .mfGet(forHex: colorString)
|
|
||||||
}
|
|
||||||
if let colorString = json?.optionalStringForKey("contentColor") {
|
if let colorString = json?.optionalStringForKey("contentColor") {
|
||||||
let color = UIColor.mfGet(forHex: colorString)
|
let color = UIColor.mfGet(forHex: colorString)
|
||||||
headlineLabel.textColor = color
|
headlineLabel.textColor = color
|
||||||
|
|||||||
@ -41,9 +41,6 @@ import UIKit
|
|||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
if let backgroundColorString = json?.optionalStringForKey(KeyBackgroundColor) {
|
|
||||||
backgroundColor = UIColor.mfGet(forHex: backgroundColorString)
|
|
||||||
}
|
|
||||||
let primaryButtonMap = json?.optionalDictionaryForKey("primaryButton")
|
let primaryButtonMap = json?.optionalDictionaryForKey("primaryButton")
|
||||||
let secondaryButtonMap = json?.optionalDictionaryForKey("secondaryButton")
|
let secondaryButtonMap = json?.optionalDictionaryForKey("secondaryButton")
|
||||||
set(primaryButtonJSON: primaryButtonMap, secondaryButtonJSON: secondaryButtonMap, delegateObject: delegateObject, additionalData: additionalData)
|
set(primaryButtonJSON: primaryButtonMap, secondaryButtonJSON: secondaryButtonMap, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
|||||||
@ -89,13 +89,13 @@
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
UIView <MVMCoreUIMoleculeViewProtocol>*molecule = [self createMoleculeForName:moleculeName];
|
UIView <MVMCoreUIMoleculeViewProtocol>*molecule = [self createMoleculeForName:moleculeName];
|
||||||
[molecule setWithJSON:json delegateObject:delegateObject additionalData:nil];
|
|
||||||
|
|
||||||
// Check if we need to constrain this view.
|
// Check if we need to constrain this view.
|
||||||
UIView <MVMCoreUIViewConstrainingProtocol> *castMolecule = [molecule conformsToProtocol:@protocol(MVMCoreUIViewConstrainingProtocol)] ? (UIView <MVMCoreUIViewConstrainingProtocol> *)molecule : nil;
|
UIView <MVMCoreUIViewConstrainingProtocol> *castMolecule = [molecule conformsToProtocol:@protocol(MVMCoreUIViewConstrainingProtocol)] ? (UIView <MVMCoreUIViewConstrainingProtocol> *)molecule : nil;
|
||||||
if (constrainIfNeeded && [castMolecule respondsToSelector:@selector(needsToBeConstrained)] && [castMolecule needsToBeConstrained]) {
|
if (constrainIfNeeded && [castMolecule respondsToSelector:@selector(needsToBeConstrained)] && [castMolecule needsToBeConstrained]) {
|
||||||
molecule = [[ViewConstrainingView alloc] initWithMolecule:molecule alignment:[castMolecule respondsToSelector:@selector(alignment)] ? [castMolecule alignment] : UIStackViewAlignmentFill];
|
molecule = [[ViewConstrainingView alloc] initWithMolecule:molecule alignment:[castMolecule respondsToSelector:@selector(alignment)] ? [castMolecule alignment] : UIStackViewAlignmentFill];
|
||||||
}
|
}
|
||||||
|
[molecule setWithJSON:json delegateObject:delegateObject additionalData:nil];
|
||||||
return molecule;
|
return molecule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user