Merge branch 'feature/develop_mvp_3' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/VDS_Button

This commit is contained in:
Sumanth Nadigadda 2022-04-29 13:53:21 +05:30
commit 779b79d27b
6 changed files with 40 additions and 14 deletions

View File

@ -20,6 +20,8 @@ open class BarsIndicatorView: CarouselIndicator {
static let width: CGFloat = 24
static let selectedHeight: CGFloat = 4
static let unselectedHeight: CGFloat = 1
static let selectedCornerRadius: CGFloat = 2
static let unselectedCornerRadius: CGFloat = 0.5
var constraint: NSLayoutConstraint?
@ -53,7 +55,7 @@ open class BarsIndicatorView: CarouselIndicator {
stackView.axis = .horizontal
stackView.alignment = .bottom
stackView.distribution = .equalSpacing
stackView.spacing = 6
stackView.spacing = 4
return stackView
}()
@ -190,6 +192,7 @@ open class BarsIndicatorView: CarouselIndicator {
let bar = IndicatorBar()
setAccessibilityLabel(view: bar, index: index)
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 heightConstraint = bar.heightAnchor.constraint(equalToConstant: barHeight)
heightConstraint.isActive = true
@ -252,6 +255,7 @@ open class BarsIndicatorView: CarouselIndicator {
barReferences.forEach {
$0.backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
$0.constraint?.constant = IndicatorBar.unselectedHeight
$0.layer.cornerRadius = IndicatorBar.unselectedCornerRadius
}
balanceBarCount(numberOfPages - barReferences.count)
@ -261,8 +265,10 @@ open class BarsIndicatorView: CarouselIndicator {
let expression = { [self] in
barReferences[previousIndex].backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
barReferences[previousIndex].constraint?.constant = IndicatorBar.unselectedHeight
barReferences[previousIndex].layer.cornerRadius = IndicatorBar.unselectedCornerRadius
barReferences[newIndex].backgroundColor = isEnabled ? currentIndicatorColor : disabledIndicatorColor
barReferences[newIndex].constraint?.constant = IndicatorBar.selectedHeight
barReferences[newIndex].layer.cornerRadius = IndicatorBar.selectedCornerRadius
layoutIfNeeded()
}

View File

@ -5,7 +5,7 @@
// Created by Kevin Christiano on 1/30/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import VDSColorTokens
open class CarouselIndicator: Control, CarouselPageControlProtocol {
//--------------------------------------------------
@ -71,13 +71,22 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
}
public var disabledIndicatorColor: UIColor {
get { carouselIndicatorModel?.disabledIndicatorColor.uiColor ?? .mvmCoolGray3 }
set { carouselIndicatorModel?.disabledIndicatorColor = Color(uiColor: newValue) }
get {
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 {
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
}
set {

View File

@ -7,7 +7,7 @@
//
import Foundation
import VDSColorTokens
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
public var accessibilityHasSlidesInsteadOfPage: Bool = false
public var enabled: Bool = true
public var disabledIndicatorColor: Color = Color(uiColor: .mvmCoolGray3)
public var indicatorColor: Color = Color(uiColor: .mvmBlack)
public var indicatorColor_inverted: Color = Color(uiColor: .mvmWhite)
public var disabledIndicatorColor: Color = Color(uiColor: VDSColor.elementsSecondaryOnlight)
public var disabledIndicatorColor_inverted: Color = Color(uiColor: VDSColor.elementsSecondaryOndark)
public var indicatorColor: Color = Color(uiColor: VDSColor.elementsPrimaryOnlight)
public var indicatorColor_inverted: Color = Color(uiColor: VDSColor.elementsPrimaryOndark)
public var position: CGFloat?
/// Allows sendActions() to trigger even if index is already at min/max index.

View File

@ -32,6 +32,8 @@ import VDSColorTokens
The style of the line:
- secondary (1 height, silver)
- primary (1 height, black)
- standard (1 height, silver) - deprecated
- thin (1 height, black) - deprecated
- medium (2 height, black)
- heavy (4 height, black)
- none (hidden)
@ -39,6 +41,8 @@ import VDSColorTokens
public enum Style: String, Codable {
case secondary
case primary
case standard
case thin
case medium
case heavy
case none
@ -59,10 +63,10 @@ import VDSColorTokens
get {
if let backgroundColor = _backgroundColor { return backgroundColor }
if inverted {
if type == .secondary { return Color(uiColor: VDSColor.paletteGray20) }
if type == .secondary || type == .standard { return Color(uiColor: VDSColor.paletteGray20) }
return Color(uiColor: VDSColor.elementsPrimaryOndark)
}
if type == .secondary { return Color(uiColor: VDSColor.paletteGray85) }
if type == .secondary || type == .standard { return Color(uiColor: VDSColor.paletteGray85) }
return Color(uiColor: VDSColor.elementsPrimaryOnlight)
}
set {

View File

@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}

View File

@ -74,6 +74,9 @@ extension NavigationController: MVMCoreViewManagerProtocol {
let model = getNavigationModel(from: viewController) {
setNavigationItem(with: model, for: topViewController)
setNavigationBarUI(with: model)
navigationBar.setNeedsLayout()
navigationBar.layoutIfNeeded()
}
manager?.newDataReceived?(in: viewController)
}
@ -84,6 +87,9 @@ extension NavigationController: MVMCoreViewManagerProtocol {
let model = getNavigationModel(from: viewController) {
setNavigationItem(with: model, for: topViewController)
setNavigationBarUI(with: model)
navigationBar.setNeedsLayout()
navigationBar.layoutIfNeeded()
}
manager?.willDisplay?(viewController)
}