ProgressBar
This commit is contained in:
parent
ff823d6862
commit
6cab25d384
@ -10,34 +10,46 @@ import Foundation
|
|||||||
|
|
||||||
public class ProgressBar: UIProgressView {
|
public class ProgressBar: UIProgressView {
|
||||||
|
|
||||||
public func styleprogessbar(json: [AnyHashable: Any]?) {
|
var isRounded = Bool()
|
||||||
|
var thickness : Float {
|
||||||
var barstyle = Bool()
|
get {
|
||||||
var progresscolor = String()
|
return 10
|
||||||
var backgroundcolor = String()
|
}
|
||||||
|
set {
|
||||||
let thickness = json?.floatFromStringForKey("thickness")
|
heightAnchor.constraint(equalToConstant: CGFloat(newValue)).isActive = true
|
||||||
|
switch isRounded {
|
||||||
|
case true:
|
||||||
|
progressViewStyle = .bar
|
||||||
|
default:
|
||||||
|
layer.cornerRadius = CGFloat((newValue ?? Float(0.0))/2)
|
||||||
|
clipsToBounds = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
thickness = json?.floatFromStringForKey("thickness") ?? Float(0.0)
|
||||||
let percentage = json?.floatFromStringForKey("percent")
|
let percentage = json?.floatFromStringForKey("percent")
|
||||||
|
progress = (percentage ?? Float(0.0))/100
|
||||||
|
progressTintColor = UIColor.mfBattleshipGrey()
|
||||||
|
trackTintColor = UIColor.mfLighterGray()
|
||||||
|
|
||||||
if let backgroundcolorUnwrapped = json?.optionalStringForKey("backgroundColor") {
|
if let progresscolor = json?.optionalStringForKey("progressColor") {
|
||||||
backgroundcolor = backgroundcolorUnwrapped
|
if !progresscolor.isEmpty {
|
||||||
|
progressTintColor = UIColor.mfGet(forHex: progresscolor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if let progresscolorUnwrapped = json?.optionalStringForKey("progressColor") {
|
|
||||||
progresscolor = progresscolorUnwrapped
|
if let backgroundcolor = json?.optionalStringForKey("backgroundColor") {
|
||||||
|
if !backgroundcolor.isEmpty {
|
||||||
|
trackTintColor = UIColor.mfGet(forHex: backgroundcolor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let barStyleUnwrapped = json?["barStyle"] as? Bool {
|
if let barStyleUnwrapped = json?["barStyle"] as? Bool {
|
||||||
barstyle = barStyleUnwrapped
|
isRounded = barStyleUnwrapped
|
||||||
}
|
|
||||||
progressTintColor = UIColor.mfGet(forHex: progresscolor)
|
|
||||||
trackTintColor = UIColor.mfGet(forHex: backgroundcolor)
|
|
||||||
progress = (percentage ?? Float(PaddingThree))/100
|
|
||||||
|
|
||||||
switch barstyle {
|
|
||||||
case true:
|
|
||||||
progressViewStyle = .bar
|
|
||||||
default:
|
|
||||||
layer.cornerRadius = CGFloat((thickness ?? Float(PaddingTwo))/2)
|
|
||||||
clipsToBounds = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
53
MVMCoreUI/Molecules/ProgressBar.swift.orig
Normal file
53
MVMCoreUI/Molecules/ProgressBar.swift.orig
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
//
|
||||||
|
// ProgressBar.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Panth Patel on 5/3/19.
|
||||||
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public class ProgressBar: UIProgressView {
|
||||||
|
|
||||||
|
public func styleprogessbar(json: [AnyHashable: Any]?) {
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> 2bd55296b8719159ed079c15651de2c59a687d6f
|
||||||
|
var barstyle = Bool()
|
||||||
|
var progresscolor = String()
|
||||||
|
var backgroundcolor = String()
|
||||||
|
|
||||||
|
let thickness = json?.floatFromStringForKey("thickness")
|
||||||
|
let percentage = json?.floatFromStringForKey("percent")
|
||||||
|
|
||||||
|
if let backgroundcolorUnwrapped = json?.optionalStringForKey("backgroundColor") {
|
||||||
|
backgroundcolor = backgroundcolorUnwrapped
|
||||||
|
}
|
||||||
|
if let progresscolorUnwrapped = json?.optionalStringForKey("progressColor") {
|
||||||
|
progresscolor = progresscolorUnwrapped
|
||||||
|
}
|
||||||
|
if let barStyleUnwrapped = json?["barStyle"] as? Bool {
|
||||||
|
barstyle = barStyleUnwrapped
|
||||||
|
}
|
||||||
|
progressTintColor = UIColor.mfGet(forHex: progresscolor)
|
||||||
|
trackTintColor = UIColor.mfGet(forHex: backgroundcolor)
|
||||||
|
progress = (percentage ?? Float(PaddingThree))/100
|
||||||
|
|
||||||
|
switch barstyle {
|
||||||
|
case true:
|
||||||
|
progressViewStyle = .bar
|
||||||
|
default:
|
||||||
|
layer.cornerRadius = CGFloat((thickness ?? Float(PaddingTwo))/2)
|
||||||
|
clipsToBounds = true
|
||||||
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
}
|
||||||
|
=======
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> 2bd55296b8719159ed079c15651de2c59a687d6f
|
||||||
|
}
|
||||||
@ -8,30 +8,13 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objcMembers open class ProgressBarView: ViewConstrainingView {
|
@objcMembers public class ProgressBarView: ViewConstrainingView {
|
||||||
|
|
||||||
var progress = ProgressBar()
|
var progress = ProgressBar()
|
||||||
var topleftlabel = Label()
|
var topleftlabel = Label()
|
||||||
var toprightlabel = Label()
|
var toprightlabel = Label()
|
||||||
var bottomleftlabel = Label()
|
var bottomleftlabel = Label()
|
||||||
var bottomrightlabel = Label()
|
var bottomrightlabel = Label()
|
||||||
var thickness: Float?
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
|
||||||
super.updateView(size)
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func needsToBeConstrained() -> Bool {
|
open override func needsToBeConstrained() -> Bool {
|
||||||
return true
|
return true
|
||||||
@ -39,9 +22,8 @@ import UIKit
|
|||||||
|
|
||||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
progress.styleprogessbar(json: json)
|
progress.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
|
||||||
let thickness = json?.floatFromStringForKey("thickness")
|
|
||||||
let topleftlabeljson = json?.optionalDictionaryForKey("label")
|
let topleftlabeljson = json?.optionalDictionaryForKey("label")
|
||||||
let toprightlabeljson = json?.optionalDictionaryForKey("toprightlabel")
|
let toprightlabeljson = json?.optionalDictionaryForKey("toprightlabel")
|
||||||
let bottomleftlabeljson = json?.optionalDictionaryForKey("bottomleftlabel")
|
let bottomleftlabeljson = json?.optionalDictionaryForKey("bottomleftlabel")
|
||||||
@ -51,7 +33,6 @@ import UIKit
|
|||||||
toprightlabel.setWithJSON(toprightlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
toprightlabel.setWithJSON(toprightlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
bottomleftlabel.setWithJSON(bottomleftlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
bottomleftlabel.setWithJSON(bottomleftlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
bottomrightlabel.setWithJSON(bottomrightlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
bottomrightlabel.setWithJSON(bottomrightlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
progress.heightAnchor.constraint(equalToConstant: CGFloat(thickness ?? Float(PaddingTwo))).isActive = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
@ -66,50 +47,53 @@ import UIKit
|
|||||||
|
|
||||||
topleftlabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
topleftlabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
topleftlabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
topleftlabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||||
let topleftconstarint = NSLayoutConstraint(item: topleftlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
let topleftconstraint = NSLayoutConstraint(item: topleftlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
||||||
topleftconstarint.priority = UILayoutPriority(rawValue: 100)
|
topleftconstraint.priority = UILayoutPriority(rawValue: 100)
|
||||||
topleftconstarint.isActive = true
|
topleftconstraint.isActive = true
|
||||||
|
|
||||||
topleftlabel.setContentHuggingPriority(UILayoutPriority(801), for: .horizontal)
|
topleftlabel.setContentHuggingPriority(UILayoutPriority(801), for: .horizontal)
|
||||||
topleftlabel.setContentHuggingPriority(UILayoutPriority(801), for: .vertical)
|
topleftlabel.setContentHuggingPriority(UILayoutPriority(801), for: .vertical)
|
||||||
|
|
||||||
NSLayoutConstraint(item: toprightlabel, attribute: .leading, relatedBy: .equal, toItem: topleftlabel, attribute: .trailing, multiplier: 1.0, constant: PaddingTwo).isActive = true
|
NSLayoutConstraint(item: toprightlabel, attribute: .leading, relatedBy: .equal, toItem: topleftlabel, attribute: .trailing, multiplier: 1.0, constant: PaddingTwo).isActive = true
|
||||||
toprightlabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
toprightlabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
toprightlabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
toprightlabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||||
toprightlabel.textAlignment = .right
|
toprightlabel.textAlignment = .right
|
||||||
|
|
||||||
let toprightconstraint = NSLayoutConstraint(item: toprightlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
|
||||||
toprightconstraint.priority = UILayoutPriority(rawValue: 100)
|
|
||||||
toprightconstraint.isActive = true
|
|
||||||
toprightlabel.setContentHuggingPriority(UILayoutPriority(1000), for: .horizontal)
|
toprightlabel.setContentHuggingPriority(UILayoutPriority(1000), for: .horizontal)
|
||||||
toprightlabel.setContentHuggingPriority(UILayoutPriority(802), for: .vertical)
|
toprightlabel.setContentHuggingPriority(UILayoutPriority(802), for: .vertical)
|
||||||
|
|
||||||
let progressconstraintone = NSLayoutConstraint(item: progress, attribute: .top, relatedBy: .equal, toItem: topleftlabel, attribute: .bottom, multiplier: 1.0, constant: PaddingTwo)
|
var topconstraint = progress.topAnchor.constraint(equalTo: topleftlabel.bottomAnchor, constant: PaddingTwo)
|
||||||
progressconstraintone.priority = UILayoutPriority(rawValue: 700)
|
topconstraint.priority = UILayoutPriority(249)
|
||||||
progressconstraintone.isActive = true
|
topconstraint.isActive = true
|
||||||
|
progress.topAnchor.constraint(greaterThanOrEqualTo: topleftlabel.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||||
|
topconstraint = progress.topAnchor.constraint(equalTo: toprightlabel.bottomAnchor, constant: PaddingTwo)
|
||||||
|
topconstraint.priority = UILayoutPriority(249)
|
||||||
|
topconstraint.isActive = true
|
||||||
|
progress.topAnchor.constraint(greaterThanOrEqualTo: toprightlabel.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||||
|
|
||||||
let progressconstrainttwo = NSLayoutConstraint(item: progress, attribute: .top, relatedBy: .greaterThanOrEqual, toItem: toprightlabel, attribute: .bottom, multiplier: 1.0, constant: PaddingTwo)
|
|
||||||
progressconstrainttwo.priority = UILayoutPriority(rawValue: 1000)
|
|
||||||
progressconstrainttwo.isActive = true
|
|
||||||
progress.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
progress.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
progress.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
progress.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
|
||||||
bottomleftlabel.topAnchor.constraint(equalTo: progress.bottomAnchor, constant: PaddingTwo).isActive = true
|
bottomleftlabel.topAnchor.constraint(equalTo: progress.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||||
bottomleftlabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
bottomleftlabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
|
||||||
let bottomleftconstraint = NSLayoutConstraint(item: bottomleftlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
let bottomleftconstraint = NSLayoutConstraint(item: bottomleftlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
||||||
bottomleftconstraint.priority = UILayoutPriority(100)
|
bottomleftconstraint.priority = UILayoutPriority(100)
|
||||||
bottomleftconstraint.isActive = true
|
bottomleftconstraint.isActive = true
|
||||||
|
|
||||||
bottomleftlabel.setContentHuggingPriority(UILayoutPriority(900), for: .horizontal)
|
bottomleftlabel.setContentHuggingPriority(UILayoutPriority(900), for: .horizontal)
|
||||||
bottomleftlabel.setContentHuggingPriority(UILayoutPriority(850), for: .vertical)
|
bottomleftlabel.setContentHuggingPriority(UILayoutPriority(850), for: .vertical)
|
||||||
|
|
||||||
NSLayoutConstraint(item: bottomrightlabel, attribute: .leading, relatedBy: .equal, toItem: bottomleftlabel, attribute: .trailing, multiplier: 1.0, constant: PaddingTwo).isActive = true
|
NSLayoutConstraint(item: bottomrightlabel, attribute: .leading, relatedBy: .equal, toItem: bottomleftlabel, attribute: .trailing, multiplier: 1.0, constant: PaddingTwo).isActive = true
|
||||||
bottomrightlabel.topAnchor.constraint(equalTo: progress.bottomAnchor, constant: PaddingTwo).isActive = true
|
bottomrightlabel.topAnchor.constraint(equalTo: progress.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||||
bottomrightlabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
bottomrightlabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
|
||||||
let bottomrightconstraint = NSLayoutConstraint(item: bottomrightlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
|
||||||
bottomrightconstraint.priority = UILayoutPriority(100)
|
|
||||||
bottomrightconstraint.isActive = true
|
|
||||||
bottomrightlabel.textAlignment = .right
|
bottomrightlabel.textAlignment = .right
|
||||||
bottomrightlabel.setContentHuggingPriority(UILayoutPriority(1000), for: .horizontal)
|
bottomrightlabel.setContentHuggingPriority(UILayoutPriority(1000), for: .horizontal)
|
||||||
bottomrightlabel.setContentHuggingPriority(UILayoutPriority(851), for: .vertical)
|
bottomrightlabel.setContentHuggingPriority(UILayoutPriority(851), for: .vertical)
|
||||||
|
|
||||||
|
var bottomconstraint = bottomAnchor.constraint(equalTo: bottomleftlabel.bottomAnchor, constant: PaddingTwo)
|
||||||
|
bottomconstraint.priority = UILayoutPriority(249)
|
||||||
|
bottomconstraint.isActive = true
|
||||||
|
bottomAnchor.constraint(greaterThanOrEqualTo: bottomleftlabel.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||||
|
bottomconstraint = bottomAnchor.constraint(equalTo: bottomrightlabel.bottomAnchor, constant: PaddingTwo)
|
||||||
|
bottomconstraint.priority = UILayoutPriority(249)
|
||||||
|
bottomconstraint.isActive = true
|
||||||
|
bottomAnchor.constraint(greaterThanOrEqualTo: bottomrightlabel.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
142
MVMCoreUI/Molecules/ProgressBarView_BACKUP_31500.swift
Normal file
142
MVMCoreUI/Molecules/ProgressBarView_BACKUP_31500.swift
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
//
|
||||||
|
// ProgressBarView.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Panth Patel on 5/3/19.
|
||||||
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
@objcMembers open class ProgressBarView: ViewConstrainingView {
|
||||||
|
|
||||||
|
var progress = ProgressBar()
|
||||||
|
var topleftlabel = Label()
|
||||||
|
var toprightlabel = Label()
|
||||||
|
var bottomleftlabel = Label()
|
||||||
|
var bottomrightlabel = Label()
|
||||||
|
var thickness: Float?
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func updateView(_ size: CGFloat) {
|
||||||
|
super.updateView(size)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func needsToBeConstrained() -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
progress.styleprogessbar(json: json)
|
||||||
|
let thickness = json?.floatFromStringForKey("thickness")
|
||||||
|
<<<<<<< HEAD
|
||||||
|
let topleftlabeljson = json?.optionalDictionaryForKey("label")
|
||||||
|
let toprightlabeljson = json?.optionalDictionaryForKey("toprightlabel")
|
||||||
|
let bottomleftlabeljson = json?.optionalDictionaryForKey("bottomleftlabel")
|
||||||
|
let bottomrightlabeljson = json?.optionalDictionaryForKey("bottomrightlabel")
|
||||||
|
|
||||||
|
topleftlabel.setWithJSON(topleftlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
toprightlabel.setWithJSON(toprightlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
bottomleftlabel.setWithJSON(bottomleftlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
bottomrightlabel.setWithJSON(bottomrightlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
=======
|
||||||
|
let textlabeljson = json?.optionalDictionaryForKey("label")
|
||||||
|
|
||||||
|
descriptionLabel.setWithJSON(textlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
>>>>>>> 2bd55296b8719159ed079c15651de2c59a687d6f
|
||||||
|
progress.heightAnchor.constraint(equalToConstant: CGFloat(thickness ?? Float(PaddingTwo))).isActive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
override open func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
<<<<<<< HEAD
|
||||||
|
addSubview(topleftlabel)
|
||||||
|
addSubview(toprightlabel)
|
||||||
|
addSubview(bottomleftlabel)
|
||||||
|
addSubview(bottomrightlabel)
|
||||||
|
=======
|
||||||
|
addSubview(descriptionLabel)
|
||||||
|
>>>>>>> 2bd55296b8719159ed079c15651de2c59a687d6f
|
||||||
|
addSubview(progress)
|
||||||
|
|
||||||
|
let vericalSpacing = MFStyler.defaultVerticalPaddingForApplicationWidth()
|
||||||
|
progress.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
topleftlabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
topleftlabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||||
|
let topleftconstarint = NSLayoutConstraint(item: topleftlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
||||||
|
topleftconstarint.priority = UILayoutPriority(rawValue: 100)
|
||||||
|
topleftconstarint.isActive = true
|
||||||
|
topleftlabel.setContentHuggingPriority(UILayoutPriority(801), for: .horizontal)
|
||||||
|
topleftlabel.setContentHuggingPriority(UILayoutPriority(801), for: .vertical)
|
||||||
|
NSLayoutConstraint(item: toprightlabel, attribute: .leading, relatedBy: .equal, toItem: topleftlabel, attribute: .trailing, multiplier: 1.0, constant: PaddingTwo).isActive = true
|
||||||
|
toprightlabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
toprightlabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||||
|
toprightlabel.textAlignment = .right
|
||||||
|
let toprightconstraint = NSLayoutConstraint(item: toprightlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
||||||
|
toprightconstraint.priority = UILayoutPriority(rawValue: 100)
|
||||||
|
toprightconstraint.isActive = true
|
||||||
|
toprightlabel.setContentHuggingPriority(UILayoutPriority(1000), for: .horizontal)
|
||||||
|
toprightlabel.setContentHuggingPriority(UILayoutPriority(802), for: .vertical)
|
||||||
|
|
||||||
|
let progressconstraintone = NSLayoutConstraint(item: progress, attribute: .top, relatedBy: .equal, toItem: topleftlabel, attribute: .bottom, multiplier: 1.0, constant: PaddingTwo)
|
||||||
|
progressconstraintone.priority = UILayoutPriority(rawValue: 700)
|
||||||
|
progressconstraintone.isActive = true
|
||||||
|
let progressconstrainttwo = NSLayoutConstraint(item: progress, attribute: .top, relatedBy: .greaterThanOrEqual, toItem: toprightlabel, attribute: .bottom, multiplier: 1.0, constant: PaddingTwo)
|
||||||
|
progressconstrainttwo.priority = UILayoutPriority(rawValue: 1000)
|
||||||
|
progressconstrainttwo.isActive = true
|
||||||
|
progress.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
progress.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
|
||||||
|
bottomleftlabel.topAnchor.constraint(equalTo: progress.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||||
|
bottomleftlabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
let bottomleftconstraint = NSLayoutConstraint(item: bottomleftlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
||||||
|
bottomleftconstraint.priority = UILayoutPriority(100)
|
||||||
|
bottomleftconstraint.isActive = true
|
||||||
|
bottomleftlabel.setContentHuggingPriority(UILayoutPriority(900), for: .horizontal)
|
||||||
|
bottomleftlabel.setContentHuggingPriority(UILayoutPriority(850), for: .vertical)
|
||||||
|
NSLayoutConstraint(item: bottomrightlabel, attribute: .leading, relatedBy: .equal, toItem: bottomleftlabel, attribute: .trailing, multiplier: 1.0, constant: PaddingTwo).isActive = true
|
||||||
|
bottomrightlabel.topAnchor.constraint(equalTo: progress.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||||
|
bottomrightlabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
let bottomrightconstraint = NSLayoutConstraint(item: bottomrightlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
||||||
|
bottomrightconstraint.priority = UILayoutPriority(100)
|
||||||
|
bottomrightconstraint.isActive = true
|
||||||
|
bottomrightlabel.textAlignment = .right
|
||||||
|
bottomrightlabel.setContentHuggingPriority(UILayoutPriority(1000), for: .horizontal)
|
||||||
|
bottomrightlabel.setContentHuggingPriority(UILayoutPriority(851), for: .vertical)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=======
|
||||||
|
descriptionLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
||||||
|
descriptionLabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
descriptionLabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
descriptionLabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||||
|
progress.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
progress.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
progress.topAnchor.constraint(equalTo: descriptionLabel.bottomAnchor, constant: vericalSpacing).isActive = true
|
||||||
|
progress.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
>>>>>>> 2bd55296b8719159ed079c15651de2c59a687d6f
|
||||||
78
MVMCoreUI/Molecules/ProgressBarView_BASE_31500.swift
Normal file
78
MVMCoreUI/Molecules/ProgressBarView_BASE_31500.swift
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
//
|
||||||
|
// ProgressBarView.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Panth Patel on 5/3/19.
|
||||||
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
@objcMembers open class ProgressBarView: ViewConstrainingView {
|
||||||
|
|
||||||
|
var progress = ProgressBar()
|
||||||
|
var descriptionLabel = Label()
|
||||||
|
var thickness: Float?
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func updateView(_ size: CGFloat) {
|
||||||
|
super.updateView(size)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func needsToBeConstrained() -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
|
||||||
|
if let jsonUnwrapped = json as? Dictionary<String, Any> {
|
||||||
|
progress.styleprogessbar(json: jsonUnwrapped)
|
||||||
|
}
|
||||||
|
|
||||||
|
let textlabeljson = json!["label"] as! Dictionary<String,Any> //UILabel.init(frame: CGRect(x:0, y:0, width: 300, height: 300))
|
||||||
|
self.descriptionLabel.setWithJSON(textlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
thickness = Float(json!["thickness"] as! String)
|
||||||
|
// thickness = 20.0
|
||||||
|
}
|
||||||
|
|
||||||
|
override open func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
addSubview(descriptionLabel)
|
||||||
|
addSubview(progress)
|
||||||
|
|
||||||
|
progress.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
descriptionLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
||||||
|
let vericalSpacing = MFStyler.defaultVerticalPaddingForApplicationWidth()
|
||||||
|
|
||||||
|
descriptionLabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
descriptionLabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
descriptionLabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||||
|
descriptionLabel.numberOfLines = 0
|
||||||
|
descriptionLabel.sizeToFit()
|
||||||
|
|
||||||
|
progress.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
progress.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
progress.heightAnchor.constraint(equalToConstant: 20).isActive = true
|
||||||
|
progress.topAnchor.constraint(equalTo: descriptionLabel.bottomAnchor, constant: vericalSpacing).isActive = true
|
||||||
|
progress.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
115
MVMCoreUI/Molecules/ProgressBarView_LOCAL_31500.swift
Normal file
115
MVMCoreUI/Molecules/ProgressBarView_LOCAL_31500.swift
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
//
|
||||||
|
// ProgressBarView.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Panth Patel on 5/3/19.
|
||||||
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
@objcMembers open class ProgressBarView: ViewConstrainingView {
|
||||||
|
|
||||||
|
var progress = ProgressBar()
|
||||||
|
var topleftlabel = Label()
|
||||||
|
var toprightlabel = Label()
|
||||||
|
var bottomleftlabel = Label()
|
||||||
|
var bottomrightlabel = Label()
|
||||||
|
var thickness: Float?
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func updateView(_ size: CGFloat) {
|
||||||
|
super.updateView(size)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func needsToBeConstrained() -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
progress.styleprogessbar(json: json)
|
||||||
|
let thickness = json?.floatFromStringForKey("thickness")
|
||||||
|
let topleftlabeljson = json?.optionalDictionaryForKey("label")
|
||||||
|
let toprightlabeljson = json?.optionalDictionaryForKey("toprightlabel")
|
||||||
|
let bottomleftlabeljson = json?.optionalDictionaryForKey("bottomleftlabel")
|
||||||
|
let bottomrightlabeljson = json?.optionalDictionaryForKey("bottomrightlabel")
|
||||||
|
|
||||||
|
topleftlabel.setWithJSON(topleftlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
toprightlabel.setWithJSON(toprightlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
bottomleftlabel.setWithJSON(bottomleftlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
bottomrightlabel.setWithJSON(bottomrightlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
progress.heightAnchor.constraint(equalToConstant: CGFloat(thickness ?? Float(PaddingTwo))).isActive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
override open func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
addSubview(topleftlabel)
|
||||||
|
addSubview(toprightlabel)
|
||||||
|
addSubview(bottomleftlabel)
|
||||||
|
addSubview(bottomrightlabel)
|
||||||
|
addSubview(progress)
|
||||||
|
|
||||||
|
progress.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
||||||
|
topleftlabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
topleftlabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||||
|
let topleftconstarint = NSLayoutConstraint(item: topleftlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
||||||
|
topleftconstarint.priority = UILayoutPriority(rawValue: 100)
|
||||||
|
topleftconstarint.isActive = true
|
||||||
|
topleftlabel.setContentHuggingPriority(UILayoutPriority(801), for: .horizontal)
|
||||||
|
topleftlabel.setContentHuggingPriority(UILayoutPriority(801), for: .vertical)
|
||||||
|
NSLayoutConstraint(item: toprightlabel, attribute: .leading, relatedBy: .equal, toItem: topleftlabel, attribute: .trailing, multiplier: 1.0, constant: PaddingTwo).isActive = true
|
||||||
|
toprightlabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
toprightlabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||||
|
toprightlabel.textAlignment = .right
|
||||||
|
let toprightconstraint = NSLayoutConstraint(item: toprightlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
||||||
|
toprightconstraint.priority = UILayoutPriority(rawValue: 100)
|
||||||
|
toprightconstraint.isActive = true
|
||||||
|
toprightlabel.setContentHuggingPriority(UILayoutPriority(1000), for: .horizontal)
|
||||||
|
toprightlabel.setContentHuggingPriority(UILayoutPriority(802), for: .vertical)
|
||||||
|
|
||||||
|
let progressconstraintone = NSLayoutConstraint(item: progress, attribute: .top, relatedBy: .equal, toItem: topleftlabel, attribute: .bottom, multiplier: 1.0, constant: PaddingTwo)
|
||||||
|
progressconstraintone.priority = UILayoutPriority(rawValue: 700)
|
||||||
|
progressconstraintone.isActive = true
|
||||||
|
let progressconstrainttwo = NSLayoutConstraint(item: progress, attribute: .top, relatedBy: .greaterThanOrEqual, toItem: toprightlabel, attribute: .bottom, multiplier: 1.0, constant: PaddingTwo)
|
||||||
|
progressconstrainttwo.priority = UILayoutPriority(rawValue: 1000)
|
||||||
|
progressconstrainttwo.isActive = true
|
||||||
|
progress.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
progress.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
|
||||||
|
bottomleftlabel.topAnchor.constraint(equalTo: progress.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||||
|
bottomleftlabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
let bottomleftconstraint = NSLayoutConstraint(item: bottomleftlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
||||||
|
bottomleftconstraint.priority = UILayoutPriority(100)
|
||||||
|
bottomleftconstraint.isActive = true
|
||||||
|
bottomleftlabel.setContentHuggingPriority(UILayoutPriority(900), for: .horizontal)
|
||||||
|
bottomleftlabel.setContentHuggingPriority(UILayoutPriority(850), for: .vertical)
|
||||||
|
NSLayoutConstraint(item: bottomrightlabel, attribute: .leading, relatedBy: .equal, toItem: bottomleftlabel, attribute: .trailing, multiplier: 1.0, constant: PaddingTwo).isActive = true
|
||||||
|
bottomrightlabel.topAnchor.constraint(equalTo: progress.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||||
|
bottomrightlabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
let bottomrightconstraint = NSLayoutConstraint(item: bottomrightlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
|
||||||
|
bottomrightconstraint.priority = UILayoutPriority(100)
|
||||||
|
bottomrightconstraint.isActive = true
|
||||||
|
bottomrightlabel.textAlignment = .right
|
||||||
|
bottomrightlabel.setContentHuggingPriority(UILayoutPriority(1000), for: .horizontal)
|
||||||
|
bottomrightlabel.setContentHuggingPriority(UILayoutPriority(851), for: .vertical)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
67
MVMCoreUI/Molecules/ProgressBarView_REMOTE_31500.swift
Normal file
67
MVMCoreUI/Molecules/ProgressBarView_REMOTE_31500.swift
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
//
|
||||||
|
// ProgressBarView.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Panth Patel on 5/3/19.
|
||||||
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
@objcMembers open class ProgressBarView: ViewConstrainingView {
|
||||||
|
|
||||||
|
var progress = ProgressBar()
|
||||||
|
var descriptionLabel = Label()
|
||||||
|
var thickness: Float?
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func updateView(_ size: CGFloat) {
|
||||||
|
super.updateView(size)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func needsToBeConstrained() -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
progress.styleprogessbar(json: json)
|
||||||
|
let thickness = json?.floatFromStringForKey("thickness")
|
||||||
|
let textlabeljson = json?.optionalDictionaryForKey("label")
|
||||||
|
|
||||||
|
descriptionLabel.setWithJSON(textlabeljson, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
progress.heightAnchor.constraint(equalToConstant: CGFloat(thickness ?? Float(PaddingTwo))).isActive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
override open func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
addSubview(descriptionLabel)
|
||||||
|
addSubview(progress)
|
||||||
|
|
||||||
|
let vericalSpacing = MFStyler.defaultVerticalPaddingForApplicationWidth()
|
||||||
|
progress.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
descriptionLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
||||||
|
descriptionLabel.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
descriptionLabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
descriptionLabel.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
|
||||||
|
progress.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
|
||||||
|
progress.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
|
||||||
|
progress.topAnchor.constraint(equalTo: descriptionLabel.bottomAnchor, constant: vericalSpacing).isActive = true
|
||||||
|
progress.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user