diff --git a/app/src/main/java/io/homeassistant/companion/android/util/vehicle/GridItems.kt b/app/src/main/java/io/homeassistant/companion/android/util/vehicle/GridItems.kt index 785f24b257d..053f62770b7 100755 --- a/app/src/main/java/io/homeassistant/companion/android/util/vehicle/GridItems.kt +++ b/app/src/main/java/io/homeassistant/companion/android/util/vehicle/GridItems.kt @@ -189,6 +189,8 @@ fun getDomainList( ) } } + listBuilder.setNoItemsMessage(carContext.getString(R.string.no_supported_entities)) + return listBuilder } diff --git a/app/src/main/java/io/homeassistant/companion/android/vehicle/DomainListScreen.kt b/app/src/main/java/io/homeassistant/companion/android/vehicle/DomainListScreen.kt index 3e9ab7d8ad2..ffa1e765ba7 100755 --- a/app/src/main/java/io/homeassistant/companion/android/vehicle/DomainListScreen.kt +++ b/app/src/main/java/io/homeassistant/companion/android/vehicle/DomainListScreen.kt @@ -39,6 +39,7 @@ class DomainListScreen( } private val domains = mutableSetOf() + private var domainsAdded = false override fun onDrivingOptimizedChanged(newState: Boolean) { invalidate() @@ -52,11 +53,11 @@ class DomainListScreen( .distinct() .filter { it in SUPPORTED_DOMAINS } .toSet() - if (newDomains.size != domains.size || newDomains != domains) { - domains.clear() - domains.addAll(newDomains) - invalidate() - } + val invalidate = newDomains.size != domains.size || newDomains != domains || !domainsAdded + domains.clear() + domains.addAll(newDomains) + domainsAdded = true + if (invalidate) invalidate() } } } @@ -82,7 +83,7 @@ class DomainListScreen( setActionStrip(nativeModeActionStrip(carContext)) } val domainBuild = domainList.build() - if (domainBuild.items.isEmpty()) { + if (!domainsAdded) { setLoading(true) } else { setLoading(false) diff --git a/app/src/main/java/io/homeassistant/companion/android/vehicle/EntityGridVehicleScreen.kt b/app/src/main/java/io/homeassistant/companion/android/vehicle/EntityGridVehicleScreen.kt index 9e210fe3d3e..d87532c6ce9 100644 --- a/app/src/main/java/io/homeassistant/companion/android/vehicle/EntityGridVehicleScreen.kt +++ b/app/src/main/java/io/homeassistant/companion/android/vehicle/EntityGridVehicleScreen.kt @@ -109,18 +109,20 @@ class EntityGridVehicleScreen( allEntities ).build() ) - listBuilder.addItem( - getDomainsGridItem( - carContext, - screenManager, - serverManager, - integrationRepository, - serverId, - allEntities, - prefsRepository, - entityRegistry - ).build() - ) + if (domains.isNotEmpty()) { + listBuilder.addItem( + getDomainsGridItem( + carContext, + screenManager, + serverManager, + integrationRepository, + serverId, + allEntities, + prefsRepository, + entityRegistry + ).build() + ) + } if (shouldSwitchServers) { listBuilder.addItem( getChangeServerGridItem( diff --git a/app/src/main/java/io/homeassistant/companion/android/vehicle/MainVehicleScreen.kt b/app/src/main/java/io/homeassistant/companion/android/vehicle/MainVehicleScreen.kt index a7e9420fc93..35ff2275a22 100644 --- a/app/src/main/java/io/homeassistant/companion/android/vehicle/MainVehicleScreen.kt +++ b/app/src/main/java/io/homeassistant/companion/android/vehicle/MainVehicleScreen.kt @@ -124,7 +124,7 @@ class MainVehicleScreen( ) { onChangeServer(it) }.getEntityGridItems(favoritesEntities) } else { var builder = ItemList.Builder() - if (domains.isNotEmpty()) { + if (domains.isNotEmpty() && domainsAdded) { builder = getDomainList( domains, carContext,