Showing 3 variations of icons for date indicators for legend

This commit is contained in:
vasavk 2024-05-16 17:06:01 +05:30
parent ff0117dc1d
commit 9c1b128102

View File

@ -40,7 +40,9 @@ class CalendarFooterReusableView: UICollectionReusableView {
$0.backgroundColor = .clear
$0.delegate = self
$0.dataSource = self
$0.register(LegendCollectionViewCell.self, forCellWithReuseIdentifier: LegendCollectionViewCell.identifier)
$0.register(LegendCollectionViewCell.self,
forCellWithReuseIdentifier: LegendCollectionViewCell.identifier)
}
//--------------------------------------------------
@ -160,7 +162,11 @@ private class LegendCollectionViewCell: UICollectionViewCell {
func setupCell() {
addSubview(stackView)
stackView.pinToSuperView()
}
func updateView() {
stackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
legendIndicator.layer.sublayers?.forEach { $0.removeFromSuperlayer() }
legendIndicatorWrapper.addSubview(legendIndicator)
legendIndicator.pinLeading().pinTrailing().width(8).height(8).pinCenterY()
@ -169,6 +175,7 @@ private class LegendCollectionViewCell: UICollectionViewCell {
}
func updateTitle(text: String, color: UIColor, surface: Surface, clearFullcircle: Bool, drawSemiCircle: Bool) {
updateView()
title.surface = surface
title.text = text
title.textColor = textColorConfiguration.getColor(surface)