Skip to content

Commit

Permalink
Fix invisible buttongrid icons (#3827)
Browse files Browse the repository at this point in the history
The fallback color was black, so the icons were nearly invisible in dark
mode.

Closes #3826

Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma authored Nov 1, 2024
1 parent e6ef4d3 commit eade0e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mobile/src/main/java/org/openhab/habdroid/ui/WidgetAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ class WidgetAdapter(

// Rows and columns start with 1 in Sitemap definition, thus decrement them here
val button = buttons
.filter { it.visibility == true }
.filter { it.visibility }
.firstOrNull { (it.row ?: 0) - 1 == row && (it.column ?: 0) - 1 == column }
if (button != null && button.visibility) {
buttonView.tag = button
Expand Down Expand Up @@ -1927,9 +1927,10 @@ fun MaterialButton.setTextAndIcon(
}
val iconSize = context.resources.getDimensionPixelSize(R.dimen.section_switch_icon)
CoroutineScope(Dispatchers.IO + Job()).launch {
val fallbackColor = context.getIconFallbackColor(IconBackground.APP_THEME)
val drawable = try {
connection.httpClient.get(iconUrl, caching = HttpClient.CachingMode.DEFAULT)
.asBitmap(iconSize, 0, ImageConversionPolicy.ForceTargetSize).response
.asBitmap(iconSize, fallbackColor, ImageConversionPolicy.ForceTargetSize).response
.toDrawable(resources)
} catch (e: HttpClient.HttpException) {
Log.d(WidgetAdapter.TAG, "Error getting icon for button", e)
Expand Down

0 comments on commit eade0e6

Please sign in to comment.