Renamed to comply with MFAtom design doc.
This commit is contained in:
parent
ada34f6f13
commit
ce1a8c3598
@ -18,7 +18,7 @@
|
||||
01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */; };
|
||||
01DF567021FA5AB300CC099B /* TextFieldListFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */; };
|
||||
01E569D3223FFFA500327251 /* ThreeLayerViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
0A1214A022C11A18007C7030 /* StandardListItemWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */; };
|
||||
0A1214A022C11A18007C7030 /* ListItemWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A12149F22C11A17007C7030 /* ListItemWithImage.swift */; };
|
||||
B8200E152280C4CF007245F4 /* ProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E142280C4CF007245F4 /* ProgressBar.swift */; };
|
||||
B8200E192281DC1A007245F4 /* ProgressBarWithLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E182281DC1A007245F4 /* ProgressBarWithLabel.swift */; };
|
||||
D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@ -187,7 +187,7 @@
|
||||
01CA51B4229716F60071A6EE /* Switch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Switch.swift; sourceTree = "<group>"; };
|
||||
01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MFTextFieldListView.swift; sourceTree = "<group>"; };
|
||||
01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldListFormViewController.swift; sourceTree = "<group>"; };
|
||||
0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StandardListItemWithImage.swift; sourceTree = "<group>"; };
|
||||
0A12149F22C11A17007C7030 /* ListItemWithImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListItemWithImage.swift; sourceTree = "<group>"; };
|
||||
B8200E142280C4CF007245F4 /* ProgressBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBar.swift; sourceTree = "<group>"; };
|
||||
B8200E182281DC1A007245F4 /* ProgressBarWithLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarWithLabel.swift; sourceTree = "<group>"; };
|
||||
D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUINavigationController.h; sourceTree = "<group>"; };
|
||||
@ -623,7 +623,7 @@
|
||||
D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */,
|
||||
DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */,
|
||||
DB891E822253FA8500022516 /* Label.swift */,
|
||||
0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */,
|
||||
0A12149F22C11A17007C7030 /* ListItemWithImage.swift */,
|
||||
0198F7A02256A80A0066C936 /* MFRadioButton.h */,
|
||||
0198F7A22256A80A0066C936 /* MFRadioButton.m */,
|
||||
);
|
||||
@ -978,7 +978,7 @@
|
||||
D29DF13221E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.m in Sources */,
|
||||
D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */,
|
||||
0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */,
|
||||
0A1214A022C11A18007C7030 /* StandardListItemWithImage.swift in Sources */,
|
||||
0A1214A022C11A18007C7030 /* ListItemWithImage.swift in Sources */,
|
||||
D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */,
|
||||
D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */,
|
||||
D29DF32421ED0DA2003B2FB9 /* TextButtonView.m in Sources */,
|
||||
|
||||
152
MVMCoreUI/Atoms/Views/ListItemWithImage.swift
Normal file
152
MVMCoreUI/Atoms/Views/ListItemWithImage.swift
Normal file
@ -0,0 +1,152 @@
|
||||
//
|
||||
// StandardListItemWithImage.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Christiano, Kevin on 6/20/19.
|
||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
|
||||
@objcMembers open class ListItemWithImage: ViewConstrainingView {
|
||||
//------------------------------------------------------
|
||||
// MARK: - Outlets
|
||||
//------------------------------------------------------
|
||||
|
||||
let title = Label.commonLabelH3(true)
|
||||
let message = Label.commonLabelB3(true)
|
||||
let button = PrimaryButton.primaryTinyButton(false)!
|
||||
let imageloader = MFLoadImageView()
|
||||
let leftContainer = ViewConstrainingView.empty()
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - Constraints
|
||||
//------------------------------------------------------
|
||||
|
||||
var imageWidthConstraint: NSLayoutConstraint?
|
||||
var imageHeightConstraint: NSLayoutConstraint?
|
||||
var buttonTopConstraint: NSLayoutConstraint?
|
||||
var messageTopConstraint: NSLayoutConstraint?
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - Initialization
|
||||
//------------------------------------------------------
|
||||
|
||||
public init() {
|
||||
super.init(frame: .zero)
|
||||
}
|
||||
|
||||
public override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
}
|
||||
|
||||
public convenience init(json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
self.init()
|
||||
setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - View Lifecycle
|
||||
//------------------------------------------------------
|
||||
|
||||
override open func setupView() {
|
||||
super.setupView()
|
||||
|
||||
guard subviews.isEmpty else { return }
|
||||
|
||||
button.setAsSecondaryCustom()
|
||||
|
||||
imageloader.imageView.contentMode = .scaleAspectFit
|
||||
|
||||
addSubview(leftContainer)
|
||||
addSubview(imageloader)
|
||||
leftContainer.addSubview(title)
|
||||
leftContainer.addSubview(message)
|
||||
leftContainer.addSubview(button)
|
||||
|
||||
leftContainer.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
||||
leftContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true
|
||||
|
||||
bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true
|
||||
let leftContainerBottom = leftContainer.bottomAnchor.constraint(equalTo: bottomAnchor)
|
||||
leftContainerBottom.priority = UILayoutPriority(249)
|
||||
leftContainerBottom.isActive = true
|
||||
|
||||
title.topAnchor.constraint(equalTo: leftContainer.topAnchor).isActive = true
|
||||
title.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true
|
||||
title.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true
|
||||
|
||||
messageTopConstraint = message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: PaddingOne)
|
||||
messageTopConstraint?.isActive = true
|
||||
|
||||
message.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true
|
||||
message.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true
|
||||
|
||||
buttonTopConstraint = button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: PaddingTwo)
|
||||
buttonTopConstraint?.isActive = true
|
||||
|
||||
button.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true
|
||||
button.bottomAnchor.constraint(equalTo: leftContainer.bottomAnchor).isActive = true
|
||||
leftContainer.trailingAnchor.constraint(greaterThanOrEqualTo: button.trailingAnchor).isActive = true
|
||||
|
||||
imageloader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
|
||||
layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageloader.trailingAnchor).isActive = true
|
||||
imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true
|
||||
imageloader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true
|
||||
|
||||
imageHeightConstraint = imageloader.heightAnchor.constraint(equalToConstant: 0)
|
||||
imageHeightConstraint?.isActive = true
|
||||
|
||||
imageWidthConstraint = imageloader.widthAnchor.constraint(equalToConstant: 0)
|
||||
imageWidthConstraint?.isActive = true
|
||||
|
||||
bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true
|
||||
let imageloaderBottom = imageloader.bottomAnchor.constraint(equalTo: bottomAnchor)
|
||||
imageloaderBottom.priority = UILayoutPriority(249)
|
||||
imageloaderBottom.isActive = true
|
||||
}
|
||||
|
||||
override open func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
|
||||
title.updateView(size)
|
||||
message.updateView(size)
|
||||
button.updateView(size)
|
||||
imageloader.updateView(size)
|
||||
leftContainer.updateView(size)
|
||||
|
||||
messageTopConstraint?.constant = title.hasText ? PaddingOne : 0
|
||||
buttonTopConstraint?.constant = message.hasText ? PaddingTwo : (title.hasText ? PaddingOne : 0)
|
||||
}
|
||||
|
||||
override open func reset() {
|
||||
super.reset()
|
||||
|
||||
title.text = ""
|
||||
message.text = ""
|
||||
imageloader.imageView.image = nil
|
||||
imageWidthConstraint?.constant = 0
|
||||
backgroundColor = nil
|
||||
}
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
guard let dictionary = json else { return }
|
||||
|
||||
title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
imageloader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
if let imageJSON = dictionary.optionalDictionaryForKey("image") {
|
||||
imageWidthConstraint?.constant = CGFloat(imageJSON.floatForKey("width"))
|
||||
imageHeightConstraint?.constant = CGFloat(imageJSON.floatForKey("height"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -46,7 +46,7 @@
|
||||
@"switchLineItem": SwitchLineItem.class,
|
||||
@"switch": Switch.class,
|
||||
@"leftRightLabelView": LeftRightLabelView.class,
|
||||
@"standardListItemWithImage": StandardListItemWithImage.class,
|
||||
@"listItemWithImage": ListItemWithImage.class,
|
||||
@"image": MFLoadImageView.class,
|
||||
@"moduleMolecule": ModuleMolecule.class
|
||||
} mutableCopy];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user