updated Code as per confluence page color changes

This commit is contained in:
Damodaram 2020-04-16 15:45:24 +05:30
parent 5e9d24f15c
commit e4dc439d1c
3 changed files with 12 additions and 4 deletions

View File

@ -69,6 +69,10 @@ open class RadioBox: Control {
subTextLabel.text = model.subText
isOutOfStock = model.strikethrough
subTextLabelHeightConstraint?.isActive = (subTextLabel.text?.count ?? 0) == 0
if let boxesModel = additionalData?["radioboxesmodel"] as? RadioBoxesModel{
backgroundColor = model.backgroundColor?.uiColor ?? (boxesModel.backgroundColor?.uiColor ?? UIColor.white)
accentColor = model.selectedAccentColor?.uiColor ?? (boxesModel.selectedAccentColor?.uiColor ?? UIColor.mvmRed)
}
}
// MARK: - State Handling
@ -134,7 +138,7 @@ open class RadioBox: Control {
let topLineLayer = CAShapeLayer()
topLineLayer.fillColor = nil
topLineLayer.strokeColor = UIColor.mvmRed.cgColor
topLineLayer.strokeColor = accentColor.cgColor
topLineLayer.lineWidth = 4
topLineLayer.path = topLinePath.cgPath
layer.addSublayer(topLineLayer)

View File

@ -11,8 +11,8 @@ import Foundation
public static var identifier: String = "radioBox"
public var text: String
public var subText: String?
public var backgroundColor: Color? = Color(uiColor: .white)
public var selectedAccentColor = Color(uiColor: .mvmRed)
public var backgroundColor: Color?
public var selectedAccentColor: Color?
public var selected: Bool = false
public var enabled: Bool = true
public var strikethrough: Bool = false

View File

@ -16,6 +16,8 @@ open class RadioBoxes: View {
private let boxHeight: CGFloat = 64.0
private let itemSpacing: CGFloat = 8.0
private var numberOfColumns: CGFloat = 2.0
private var radioBoxesmodel: RadioBoxesModel!
private var delegateObject: MVMCoreUIDelegateObject?
@ -48,6 +50,7 @@ open class RadioBoxes: View {
self.delegateObject = delegateObject
guard let radioBoxesModel = model as? RadioBoxesModel else { return }
radioBoxesmodel = radioBoxesModel
boxes = radioBoxesModel.boxes
FormValidator.setupValidation(for: radioBoxesModel, delegate: delegateObject?.formHolderDelegate)
@ -118,8 +121,9 @@ extension RadioBoxes: UICollectionViewDataSource {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "RadioBoxCollectionViewCell", for: indexPath) as? RadioBoxCollectionViewCell else {
fatalError()
}
let additionalData: [AnyHashable : RadioBoxesModel] = ["radioboxesmodel":radioBoxesmodel]
cell.radioBox.isUserInteractionEnabled = false
cell.set(with: molecule, delegateObject, nil)
cell.set(with: molecule, delegateObject, additionalData)
cell.updateView(size ?? collectionView.bounds.width)
if molecule.selected {
collectionView.selectItem(at: indexPath, animated: false, scrollPosition: .centeredVertically)