Commit 8c60d126 by Demid Merzlyakov

IOS-22: better layout for the smart text label.

parent 8cb57fc3
...@@ -14,7 +14,7 @@ class TodayForecastCell: UITableViewCell { ...@@ -14,7 +14,7 @@ class TodayForecastCell: UITableViewCell {
private let cityImageView = UIImageView() private let cityImageView = UIImageView()
private let temperatureLabel = UILabel() private let temperatureLabel = UILabel()
private let forecastDescriptionLabel = UILabel() private let forecastDescriptionLabel = UILabel()
private let feelsLikeLabel = UILabel() private let smartTextLabel = UILabel()
private let forecastImageView = UIImageView() private let forecastImageView = UIImageView()
private let smartTextProvider = SmartTextProvider() private let smartTextProvider = SmartTextProvider()
...@@ -46,9 +46,8 @@ class TodayForecastCell: UITableViewCell { ...@@ -46,9 +46,8 @@ class TodayForecastCell: UITableViewCell {
temperatureLabel.text = location.today?.temp?.settingsConverted.shortString temperatureLabel.text = location.today?.temp?.settingsConverted.shortString
let maxTemp = location.today?.maxTemp?.settingsConverted.shortString ?? "--" let maxTemp = location.today?.maxTemp?.settingsConverted.shortString ?? "--"
let minTemp = location.today?.minTemp?.settingsConverted.shortString ?? "--" let minTemp = location.today?.minTemp?.settingsConverted.shortString ?? "--"
let feelstemp = location.today?.apparentTemp?.settingsConverted.shortString ?? "--"
forecastDescriptionLabel.text = "\(location.today?.type.localized(isDay: location.today?.isDay ?? true) ?? "") | \(maxTemp)/\(minTemp)" forecastDescriptionLabel.text = "\(location.today?.type.localized(isDay: location.today?.isDay ?? true) ?? "") | \(maxTemp)/\(minTemp)"
feelsLikeLabel.text = smartTextProvider.smartText(for: location) smartTextLabel.text = smartTextProvider.smartText(for: location)
forecastImageView.image = location.today?.type.image(isDay: location.today?.isDay ?? true) forecastImageView.image = location.today?.type.image(isDay: location.today?.isDay ?? true)
} }
...@@ -56,7 +55,7 @@ class TodayForecastCell: UITableViewCell { ...@@ -56,7 +55,7 @@ class TodayForecastCell: UITableViewCell {
private func updateUI() { private func updateUI() {
temperatureLabel.textColor = ThemeManager.currentTheme.primaryTextColor temperatureLabel.textColor = ThemeManager.currentTheme.primaryTextColor
forecastDescriptionLabel.textColor = ThemeManager.currentTheme.primaryTextColor forecastDescriptionLabel.textColor = ThemeManager.currentTheme.primaryTextColor
feelsLikeLabel.textColor = ThemeManager.currentTheme.secondaryTextColor smartTextLabel.textColor = ThemeManager.currentTheme.secondaryTextColor
contentView.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor contentView.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
container.backgroundColor = ThemeManager.currentTheme.containerBackgroundColor container.backgroundColor = ThemeManager.currentTheme.containerBackgroundColor
...@@ -129,13 +128,15 @@ private extension TodayForecastCell { ...@@ -129,13 +128,15 @@ private extension TodayForecastCell {
} }
func prepareFeelsLikeLabel() { func prepareFeelsLikeLabel() {
feelsLikeLabel.font = AppFont.SFPro.regular(size: 12) smartTextLabel.font = AppFont.SFPro.regular(size: 12)
container.addSubview(feelsLikeLabel) smartTextLabel.numberOfLines = 0
container.addSubview(smartTextLabel)
feelsLikeLabel.snp.makeConstraints { (make) in smartTextLabel.snp.makeConstraints { (make) in
make.left.equalToSuperview().inset(18) make.left.equalToSuperview().inset(18)
make.top.equalTo(forecastDescriptionLabel.snp.bottom).offset(5) make.top.equalTo(forecastDescriptionLabel.snp.bottom).offset(5)
make.bottom.equalToSuperview().inset(25) make.bottom.equalToSuperview().inset(25)
make.right.equalToSuperview().inset(18)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment