Merge branch 'feature/molecule_progressbar' into 'develop'

ProgressBar molecule

See merge request BPHV_MIPS/mvm_core_ui!66
This commit is contained in:
Suresh, Kamlesh 2019-06-07 11:47:24 -04:00
commit 3671843ecf
4 changed files with 160 additions and 0 deletions

View File

@ -18,6 +18,8 @@
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, ); }; };
B8200E152280C4CF007245F4 /* ProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E142280C4CF007245F4 /* ProgressBar.swift */; };
B8200E192281DC1A007245F4 /* ProgressBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E182281DC1A007245F4 /* ProgressBarView.swift */; };
D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */; settings = {ATTRIBUTES = (Public, ); }; };
D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationController.m */; };
D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */; };
@ -183,6 +185,8 @@
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>"; };
B8200E142280C4CF007245F4 /* ProgressBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBar.swift; sourceTree = "<group>"; };
B8200E182281DC1A007245F4 /* ProgressBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarView.swift; sourceTree = "<group>"; };
D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUINavigationController.h; sourceTree = "<group>"; };
D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUINavigationController.m; sourceTree = "<group>"; };
D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonView.swift; sourceTree = "<group>"; };
@ -463,6 +467,8 @@
D2A5145E2211DDC100345BFB /* MoleculeStackView.swift */,
D274CA322236A78900B01B62 /* StandardFooterView.swift */,
D2E1FADC2268B25E00AEFD8C /* MoleculeTableViewCell.swift */,
B8200E142280C4CF007245F4 /* ProgressBar.swift */,
B8200E182281DC1A007245F4 /* ProgressBarView.swift */,
);
path = Molecules;
sourceTree = "<group>";
@ -915,6 +921,7 @@
D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */,
D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */,
D29DF25421E6A177003B2FB9 /* MFMdnTextField.m in Sources */,
B8200E152280C4CF007245F4 /* ProgressBar.swift in Sources */,
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
D2A514672213885800345BFB /* StandardHeaderView.swift in Sources */,
DBEFFA04225A829700230692 /* Label.swift in Sources */,
@ -968,6 +975,7 @@
D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */,
D29DF32421ED0DA2003B2FB9 /* TextButtonView.m in Sources */,
D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */,
B8200E192281DC1A007245F4 /* ProgressBarView.swift in Sources */,
D2A514592211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m in Sources */,
0105618D224BBE7700E1557D /* FormValidator.swift in Sources */,
D22D1F1B220341F60077CEC0 /* MVMCoreUICheckBox.m in Sources */,

View File

@ -0,0 +1,49 @@
//
// ProgressBar.swift
// MVMCoreUI
//
// Created by Panth Patel on 5/3/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import Foundation
public class ProgressBar: UIProgressView {
var isRounded = Bool()
var thickness : Float = 0.0 {
willSet(newValue) {
heightAnchor.constraint(equalToConstant: CGFloat(newValue)).isActive = true
switch isRounded {
case true:
layer.cornerRadius = CGFloat(newValue/2)
clipsToBounds = true
default:
progressViewStyle = .bar
}
}
}
public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
isRounded = json?.optionalBoolForKey("roundedRect") ?? false
thickness = json?.floatFromStringForKey("thickness") ?? Float(0.0)
let percentage = json?.floatFromStringForKey("percent")
progress = (percentage ?? Float(0.0))/100
progressTintColor = UIColor.mfBattleshipGrey()
trackTintColor = UIColor.mfLighterGray()
if let progresscolor = json?.optionalStringForKey("progressColor") {
if !progresscolor.isEmpty {
progressTintColor = UIColor.mfGet(forHex: progresscolor)
}
}
if let backgroundcolor = json?.optionalStringForKey("backgroundColor") {
if !backgroundcolor.isEmpty {
trackTintColor = UIColor.mfGet(forHex: backgroundcolor)
}
}
}
}

View File

@ -0,0 +1,99 @@
//
// ProgressBarView.swift
// MVMCoreUI
//
// Created by Panth Patel on 5/3/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
@objcMembers public class ProgressBarView: ViewConstrainingView {
var progress = ProgressBar()
var topleftlabel = Label()
var toprightlabel = Label()
var bottomleftlabel = Label()
var bottomrightlabel = Label()
open override func needsToBeConstrained() -> Bool {
return true
}
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
progress.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
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)
}
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 topleftwidthconstraint = NSLayoutConstraint(item: topleftlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
topleftwidthconstraint.priority = UILayoutPriority(100)
topleftwidthconstraint.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
toprightlabel.setContentHuggingPriority(UILayoutPriority(802), for: .horizontal)
toprightlabel.setContentHuggingPriority(UILayoutPriority(802), for: .vertical)
var topconstraint = progress.topAnchor.constraint(equalTo: topleftlabel.bottomAnchor, constant: PaddingTwo)
topconstraint.priority = UILayoutPriority(249)
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
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 bottomleftwidthconstraint = NSLayoutConstraint(item: bottomleftlabel, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
bottomleftwidthconstraint.priority = UILayoutPriority(100)
bottomleftwidthconstraint.isActive = true
bottomleftlabel.setContentHuggingPriority(UILayoutPriority(801), for: .horizontal)
bottomleftlabel.setContentHuggingPriority(UILayoutPriority(801), 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
bottomrightlabel.textAlignment = .right
bottomrightlabel.setContentHuggingPriority(UILayoutPriority(802), for: .horizontal)
bottomrightlabel.setContentHuggingPriority(UILayoutPriority(802), 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
}
}

View File

@ -34,6 +34,10 @@
@"footer": StandardFooterView.class,
@"caretView": CaretView.class,
@"caretButton": CaretButton.class,
@"textField" : MFTextField.class,
@"checkbox" : MVMCoreUICheckBox.class,
@"progressBarView" : ProgressBarView.class,
@"progressBar": ProgressBar.class,
@"textField": MFTextField.class,
@"checkbox": MVMCoreUICheckBox.class,
@"listItem": MoleculeTableViewCell.class,