Merge branch 'feature/develop_mvp_3' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/3.0-TitleLockup
This commit is contained in:
commit
4980874914
@ -20,6 +20,8 @@ open class BarsIndicatorView: CarouselIndicator {
|
|||||||
static let width: CGFloat = 24
|
static let width: CGFloat = 24
|
||||||
static let selectedHeight: CGFloat = 4
|
static let selectedHeight: CGFloat = 4
|
||||||
static let unselectedHeight: CGFloat = 1
|
static let unselectedHeight: CGFloat = 1
|
||||||
|
static let selectedCornerRadius: CGFloat = 2
|
||||||
|
static let unselectedCornerRadius: CGFloat = 0.5
|
||||||
|
|
||||||
var constraint: NSLayoutConstraint?
|
var constraint: NSLayoutConstraint?
|
||||||
|
|
||||||
@ -53,7 +55,7 @@ open class BarsIndicatorView: CarouselIndicator {
|
|||||||
stackView.axis = .horizontal
|
stackView.axis = .horizontal
|
||||||
stackView.alignment = .bottom
|
stackView.alignment = .bottom
|
||||||
stackView.distribution = .equalSpacing
|
stackView.distribution = .equalSpacing
|
||||||
stackView.spacing = 6
|
stackView.spacing = 4
|
||||||
return stackView
|
return stackView
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -190,6 +192,7 @@ open class BarsIndicatorView: CarouselIndicator {
|
|||||||
let bar = IndicatorBar()
|
let bar = IndicatorBar()
|
||||||
setAccessibilityLabel(view: bar, index: index)
|
setAccessibilityLabel(view: bar, index: index)
|
||||||
bar.backgroundColor = isEnabled ? (index == currentIndex ? currentIndicatorColor : indicatorColor) : disabledIndicatorColor
|
bar.backgroundColor = isEnabled ? (index == currentIndex ? currentIndicatorColor : indicatorColor) : disabledIndicatorColor
|
||||||
|
bar.layer.cornerRadius = index == currentIndex ? BarsIndicatorView.IndicatorBar.selectedCornerRadius : BarsIndicatorView.IndicatorBar.unselectedCornerRadius
|
||||||
let barHeight = index == currentIndex ? BarsIndicatorView.IndicatorBar.selectedHeight : BarsIndicatorView.IndicatorBar.unselectedHeight
|
let barHeight = index == currentIndex ? BarsIndicatorView.IndicatorBar.selectedHeight : BarsIndicatorView.IndicatorBar.unselectedHeight
|
||||||
let heightConstraint = bar.heightAnchor.constraint(equalToConstant: barHeight)
|
let heightConstraint = bar.heightAnchor.constraint(equalToConstant: barHeight)
|
||||||
heightConstraint.isActive = true
|
heightConstraint.isActive = true
|
||||||
@ -252,6 +255,7 @@ open class BarsIndicatorView: CarouselIndicator {
|
|||||||
barReferences.forEach {
|
barReferences.forEach {
|
||||||
$0.backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
|
$0.backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
|
||||||
$0.constraint?.constant = IndicatorBar.unselectedHeight
|
$0.constraint?.constant = IndicatorBar.unselectedHeight
|
||||||
|
$0.layer.cornerRadius = IndicatorBar.unselectedCornerRadius
|
||||||
}
|
}
|
||||||
|
|
||||||
balanceBarCount(numberOfPages - barReferences.count)
|
balanceBarCount(numberOfPages - barReferences.count)
|
||||||
@ -261,8 +265,10 @@ open class BarsIndicatorView: CarouselIndicator {
|
|||||||
let expression = { [self] in
|
let expression = { [self] in
|
||||||
barReferences[previousIndex].backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
|
barReferences[previousIndex].backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
|
||||||
barReferences[previousIndex].constraint?.constant = IndicatorBar.unselectedHeight
|
barReferences[previousIndex].constraint?.constant = IndicatorBar.unselectedHeight
|
||||||
|
barReferences[previousIndex].layer.cornerRadius = IndicatorBar.unselectedCornerRadius
|
||||||
barReferences[newIndex].backgroundColor = isEnabled ? currentIndicatorColor : disabledIndicatorColor
|
barReferences[newIndex].backgroundColor = isEnabled ? currentIndicatorColor : disabledIndicatorColor
|
||||||
barReferences[newIndex].constraint?.constant = IndicatorBar.selectedHeight
|
barReferences[newIndex].constraint?.constant = IndicatorBar.selectedHeight
|
||||||
|
barReferences[newIndex].layer.cornerRadius = IndicatorBar.selectedCornerRadius
|
||||||
layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
// Created by Kevin Christiano on 1/30/20.
|
// Created by Kevin Christiano on 1/30/20.
|
||||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
//
|
//
|
||||||
|
import VDSColorTokens
|
||||||
|
|
||||||
open class CarouselIndicator: Control, CarouselPageControlProtocol {
|
open class CarouselIndicator: Control, CarouselPageControlProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -71,13 +71,22 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public var disabledIndicatorColor: UIColor {
|
public var disabledIndicatorColor: UIColor {
|
||||||
get { carouselIndicatorModel?.disabledIndicatorColor.uiColor ?? .mvmCoolGray3 }
|
get {
|
||||||
set { carouselIndicatorModel?.disabledIndicatorColor = Color(uiColor: newValue) }
|
guard let model = carouselIndicatorModel else { return VDSColor.elementsSecondaryOnlight }
|
||||||
|
return model.inverted ? model.disabledIndicatorColor_inverted.uiColor : model.disabledIndicatorColor.uiColor
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if let model = carouselIndicatorModel, model.inverted {
|
||||||
|
model.disabledIndicatorColor_inverted = Color(uiColor: newValue)
|
||||||
|
} else {
|
||||||
|
carouselIndicatorModel?.disabledIndicatorColor = Color(uiColor: newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var indicatorColor: UIColor {
|
public var indicatorColor: UIColor {
|
||||||
get {
|
get {
|
||||||
guard let model = carouselIndicatorModel else { return .mvmBlack }
|
guard let model = carouselIndicatorModel else { return VDSColor.elementsPrimaryOnlight}
|
||||||
return model.inverted ? model.indicatorColor_inverted.uiColor : model.indicatorColor.uiColor
|
return model.inverted ? model.indicatorColor_inverted.uiColor : model.indicatorColor.uiColor
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import VDSColorTokens
|
||||||
|
|
||||||
open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelProtocol, EnableableModelProtocol {
|
open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelProtocol, EnableableModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -30,9 +30,10 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
/// Set true to make the accessibility value as "Slide #currentPage of #totalPage", otherwise will be "Page #currentPage of #totalPage", default is false
|
/// Set true to make the accessibility value as "Slide #currentPage of #totalPage", otherwise will be "Page #currentPage of #totalPage", default is false
|
||||||
public var accessibilityHasSlidesInsteadOfPage: Bool = false
|
public var accessibilityHasSlidesInsteadOfPage: Bool = false
|
||||||
public var enabled: Bool = true
|
public var enabled: Bool = true
|
||||||
public var disabledIndicatorColor: Color = Color(uiColor: .mvmCoolGray3)
|
public var disabledIndicatorColor: Color = Color(uiColor: VDSColor.elementsSecondaryOnlight)
|
||||||
public var indicatorColor: Color = Color(uiColor: .mvmBlack)
|
public var disabledIndicatorColor_inverted: Color = Color(uiColor: VDSColor.elementsSecondaryOndark)
|
||||||
public var indicatorColor_inverted: Color = Color(uiColor: .mvmWhite)
|
public var indicatorColor: Color = Color(uiColor: VDSColor.elementsPrimaryOnlight)
|
||||||
|
public var indicatorColor_inverted: Color = Color(uiColor: VDSColor.elementsPrimaryOndark)
|
||||||
public var position: CGFloat?
|
public var position: CGFloat?
|
||||||
|
|
||||||
/// Allows sendActions() to trigger even if index is already at min/max index.
|
/// Allows sendActions() to trigger even if index is already at min/max index.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"author" : "xcode",
|
||||||
"author" : "xcode"
|
"version" : 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,6 +74,9 @@ extension NavigationController: MVMCoreViewManagerProtocol {
|
|||||||
let model = getNavigationModel(from: viewController) {
|
let model = getNavigationModel(from: viewController) {
|
||||||
setNavigationItem(with: model, for: topViewController)
|
setNavigationItem(with: model, for: topViewController)
|
||||||
setNavigationBarUI(with: model)
|
setNavigationBarUI(with: model)
|
||||||
|
|
||||||
|
navigationBar.setNeedsLayout()
|
||||||
|
navigationBar.layoutIfNeeded()
|
||||||
}
|
}
|
||||||
manager?.newDataReceived?(in: viewController)
|
manager?.newDataReceived?(in: viewController)
|
||||||
}
|
}
|
||||||
@ -84,6 +87,9 @@ extension NavigationController: MVMCoreViewManagerProtocol {
|
|||||||
let model = getNavigationModel(from: viewController) {
|
let model = getNavigationModel(from: viewController) {
|
||||||
setNavigationItem(with: model, for: topViewController)
|
setNavigationItem(with: model, for: topViewController)
|
||||||
setNavigationBarUI(with: model)
|
setNavigationBarUI(with: model)
|
||||||
|
|
||||||
|
navigationBar.setNeedsLayout()
|
||||||
|
navigationBar.layoutIfNeeded()
|
||||||
}
|
}
|
||||||
manager?.willDisplay?(viewController)
|
manager?.willDisplay?(viewController)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user