changes while establishing accessibility
This commit is contained in:
parent
39a12684a5
commit
7ba0e8ad67
@ -8,19 +8,21 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objcMembers open class ListProgressBarData: TableViewCell {
|
|
||||||
|
|
||||||
|
@objcMembers open class ListProgressBarData: TableViewCell {
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
let progressBar = MultiProgress(frame: .zero)
|
|
||||||
|
let progressBar = MultiProgress()
|
||||||
let leftLabel = Label.createLabelBoldBodySmall(true)
|
let leftLabel = Label.createLabelBoldBodySmall(true)
|
||||||
let rightLabel = Label.createLabelBoldBodySmall(true)
|
let rightLabel = Label.createLabelBoldBodySmall(true)
|
||||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
let view = MVMCoreUICommonViewsUtility.commonView()
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - MFViewProtocol
|
// MARK: - Lifecycle
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
@ -30,7 +32,7 @@ import UIKit
|
|||||||
view.addSubview(rightLabel)
|
view.addSubview(rightLabel)
|
||||||
contentView.addSubview(view)
|
contentView.addSubview(view)
|
||||||
containerHelper.constrainView(view)
|
containerHelper.constrainView(view)
|
||||||
NSLayoutConstraint.pinViews(leftView: leftLabel, rightView: rightLabel, alignTop: true, bottomAnchor: progressBar.topAnchor, constant: 8)
|
NSLayoutConstraint.pinViews(leftView: leftLabel, rightView: rightLabel, alignTop: true, bottomAnchor: progressBar.topAnchor, constant: Padding.Two)
|
||||||
progressBar.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
|
progressBar.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
|
||||||
progressBar.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
|
progressBar.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
|
||||||
view.bottomAnchor.constraint(equalTo: progressBar.bottomAnchor).isActive = true
|
view.bottomAnchor.constraint(equalTo: progressBar.bottomAnchor).isActive = true
|
||||||
@ -43,24 +45,6 @@ import UIKit
|
|||||||
rightLabel.updateView(size)
|
rightLabel.updateView(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
|
||||||
// MARK: - MoleculeViewProtocol
|
|
||||||
//-----------------------------------------------------
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
|
||||||
super.set(with: model, delegateObject, additionalData)
|
|
||||||
guard let model = model as? ListProgressBarDataModel else { return}
|
|
||||||
progressBar.set(with: model.progressBar, delegateObject, additionalData)
|
|
||||||
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
|
||||||
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
|
||||||
}
|
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
|
||||||
return 90
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------
|
|
||||||
// MARK: - MoleculeViewProtocol
|
|
||||||
//-----------------------------------------------------
|
|
||||||
override open func reset() {
|
override open func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
progressBar.reset()
|
progressBar.reset()
|
||||||
@ -69,5 +53,22 @@ import UIKit
|
|||||||
leftLabel.styleBoldBodySmall(true)
|
leftLabel.styleBoldBodySmall(true)
|
||||||
rightLabel.styleBoldBodySmall(true)
|
rightLabel.styleBoldBodySmall(true)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - MoleculeViewProtocol
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
|
guard let model = model as? ListProgressBarDataModel else { return }
|
||||||
|
|
||||||
|
progressBar.set(with: model.progressBar, delegateObject, additionalData)
|
||||||
|
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
||||||
|
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
return 90
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -8,12 +8,21 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class ListProgressBarDataModel : ListItemModel, MoleculeModelProtocol {
|
|
||||||
|
public class ListProgressBarDataModel: ListItemModel, MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "listPrgBarData"
|
public static var identifier: String = "listPrgBarData"
|
||||||
public var progressBar : MultiProgressBarModel
|
public var progressBar : MultiProgressBarModel
|
||||||
public var leftLabel: LabelModel
|
public var leftLabel: LabelModel
|
||||||
public var rightLabel: LabelModel
|
public var rightLabel: LabelModel
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init (progressBar: MultiProgressBarModel, leftLabel: LabelModel, rightLabel: LabelModel){
|
public init (progressBar: MultiProgressBarModel, leftLabel: LabelModel, rightLabel: LabelModel){
|
||||||
self.progressBar = progressBar
|
self.progressBar = progressBar
|
||||||
self.leftLabel = leftLabel
|
self.leftLabel = leftLabel
|
||||||
@ -21,6 +30,10 @@ public class ListProgressBarDataModel : ListItemModel, MoleculeModelProtocol {
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey{
|
private enum CodingKeys: String, CodingKey{
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case progressBar
|
case progressBar
|
||||||
@ -28,6 +41,10 @@ public class ListProgressBarDataModel : ListItemModel, MoleculeModelProtocol {
|
|||||||
case rightLabel
|
case rightLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
progressBar = try typeContainer.decode(MultiProgressBarModel.self, forKey: .progressBar)
|
progressBar = try typeContainer.decode(MultiProgressBarModel.self, forKey: .progressBar)
|
||||||
|
|||||||
@ -103,13 +103,13 @@ open class DoughnutChart: View {
|
|||||||
heightConstraint?.isActive = true
|
heightConstraint?.isActive = true
|
||||||
widthAnchor.constraint(equalTo: heightAnchor).isActive = true
|
widthAnchor.constraint(equalTo: heightAnchor).isActive = true
|
||||||
|
|
||||||
labelContainerLeftConstraint = labelContainer.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor, constant: lineWidth())
|
labelContainerLeftConstraint = labelContainer.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor, constant: Padding.Three)
|
||||||
labelContainerLeftConstraint?.isActive = true
|
labelContainerLeftConstraint?.isActive = true
|
||||||
labelContainerTopConstraint = labelContainer.topAnchor.constraint(greaterThanOrEqualTo: topAnchor, constant: lineWidth())
|
labelContainerTopConstraint = labelContainer.topAnchor.constraint(greaterThanOrEqualTo: topAnchor, constant: Padding.Three)
|
||||||
labelContainerTopConstraint?.isActive = true
|
labelContainerTopConstraint?.isActive = true
|
||||||
labelContainerRightConstraint = trailingAnchor.constraint(greaterThanOrEqualTo: labelContainer.trailingAnchor, constant: lineWidth())
|
labelContainerRightConstraint = trailingAnchor.constraint(greaterThanOrEqualTo: labelContainer.trailingAnchor, constant: Padding.Three)
|
||||||
labelContainerRightConstraint?.isActive = true
|
labelContainerRightConstraint?.isActive = true
|
||||||
labelContainerBottomConstraint = bottomAnchor.constraint(greaterThanOrEqualTo: labelContainer.bottomAnchor, constant: lineWidth())
|
labelContainerBottomConstraint = bottomAnchor.constraint(greaterThanOrEqualTo: labelContainer.bottomAnchor, constant: Padding.Three)
|
||||||
labelContainerBottomConstraint?.isActive = true
|
labelContainerBottomConstraint?.isActive = true
|
||||||
labelContainer.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
|
labelContainer.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
|
||||||
labelContainer.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
|
labelContainer.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
|
||||||
@ -127,7 +127,9 @@ open class DoughnutChart: View {
|
|||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
clearLayers()
|
clearLayers()
|
||||||
|
|
||||||
guard let doughnutChartModel = doughnutChartModel else { return }
|
guard let doughnutChartModel = doughnutChartModel else { return }
|
||||||
|
|
||||||
titleLabel.setOptional(with: doughnutChartModel.title, delegateObject, additionalData)
|
titleLabel.setOptional(with: doughnutChartModel.title, delegateObject, additionalData)
|
||||||
@ -143,7 +145,9 @@ open class DoughnutChart: View {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private func drawGraph() {
|
private func drawGraph() {
|
||||||
|
|
||||||
clearLayers()
|
clearLayers()
|
||||||
|
|
||||||
let widthHeight = sizeObject.getValueBasedOnApplicationWidth()
|
let widthHeight = sizeObject.getValueBasedOnApplicationWidth()
|
||||||
doughnutLayer.frame = CGRect(x: 0, y: 0, width: widthHeight, height: widthHeight)
|
doughnutLayer.frame = CGRect(x: 0, y: 0, width: widthHeight, height: widthHeight)
|
||||||
|
|
||||||
@ -178,11 +182,12 @@ open class DoughnutChart: View {
|
|||||||
|
|
||||||
shapeLayer.path = circlePath.cgPath
|
shapeLayer.path = circlePath.cgPath
|
||||||
doughnutLayer.addSublayer(shapeLayer)
|
doughnutLayer.addSublayer(shapeLayer)
|
||||||
|
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
private func clearLayers() {
|
private func clearLayers() {
|
||||||
doughnutLayer.sublayers?.forEach{ $0.removeFromSuperlayer() }
|
doughnutLayer.sublayers?.forEach { $0.removeFromSuperlayer() }
|
||||||
}
|
}
|
||||||
|
|
||||||
public func updateContainer() {
|
public func updateContainer() {
|
||||||
@ -197,7 +202,7 @@ open class DoughnutChart: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func lineGap() -> CGFloat {
|
public func lineGap() -> CGFloat {
|
||||||
//If array is having the single item then no space required
|
// If array is having the single item then no space required
|
||||||
return doughnutChartModel?.sections.count == 1 ? 0.0 : 0.05
|
return doughnutChartModel?.sections.count == 1 ? 0.0 : 0.05
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user