Fix #2438 - Text overlap double line charts
Some checks failed
Breezy Weather push CI / build (push) Has been cancelled

This commit is contained in:
Julien Papasian 2025-12-09 17:18:35 +01:00
parent ec0fd0e14f
commit 995d53b8dd
4 changed files with 23 additions and 2 deletions

View File

@ -12,6 +12,7 @@
**Improvements and fixes**
- Fix crash on some devices when current weather is snow (@Cactric)
- Fix overlap of texts on double line charts when the line “below” goes above the “above” line (for example, a min. night temperature higher than the max. day temperature)
**Weather sources**
- Icelandic Met Office - Fix refresh error

View File

@ -244,7 +244,11 @@ class PolylineAndHistogramView @JvmOverloads constructor(
canvas.drawText(
mHighPolylineValueStr ?: "",
getRTLCompactX((measuredWidth / 2.0).toFloat()),
mHighPolylineY[1] - mPaint.fontMetrics.bottom - mTextMargin,
if (mHighPolylineY[1] > mLowPolylineY[1]) {
mHighPolylineY[1] - mPaint.fontMetrics.top + mTextMargin
} else {
mHighPolylineY[1] - mPaint.fontMetrics.bottom - mTextMargin
},
mPaint
)
mPaint.setShadowLayer(0f, 0f, 0f, Color.TRANSPARENT)
@ -315,7 +319,11 @@ class PolylineAndHistogramView @JvmOverloads constructor(
canvas.drawText(
mLowPolylineValueStr ?: "",
getRTLCompactX((measuredWidth / 2.0).toFloat()),
mLowPolylineY[1] - mPaint.fontMetrics.top + mTextMargin,
if (mHighPolylineY[1] > mLowPolylineY[1]) {
mLowPolylineY[1] - mPaint.fontMetrics.bottom - mTextMargin
} else {
mLowPolylineY[1] - mPaint.fontMetrics.top + mTextMargin
},
mPaint
)
mPaint.setShadowLayer(0f, 0f, 0f, Color.TRANSPARENT)

View File

@ -212,8 +212,14 @@ class DailyFeelsLikeAdapter(
if (mHighestTemperature == null || it > mHighestTemperature!!) {
mHighestTemperature = it.toFloat()
}
if (mLowestTemperature == null || it < mLowestTemperature!!) {
mLowestTemperature = it.toFloat()
}
}
(daily.night?.temperature?.feelsLikeTemperature ?: daily.night?.temperature?.temperature)?.value?.let {
if (mHighestTemperature == null || it > mHighestTemperature!!) {
mHighestTemperature = it.toFloat()
}
if (mLowestTemperature == null || it < mLowestTemperature!!) {
mLowestTemperature = it.toFloat()
}

View File

@ -244,8 +244,14 @@ class DailyTemperatureAdapter(
if (mHighestTemperature == null || it > mHighestTemperature!!) {
mHighestTemperature = it.toFloat()
}
if (mLowestTemperature == null || it < mLowestTemperature!!) {
mLowestTemperature = it.toFloat()
}
}
daily.night?.temperature?.temperature?.value?.let {
if (mHighestTemperature == null || it > mHighestTemperature!!) {
mHighestTemperature = it.toFloat()
}
if (mLowestTemperature == null || it < mLowestTemperature!!) {
mLowestTemperature = it.toFloat()
}