From 5130b93e993b121009e7c3324c975f4b00c12caa Mon Sep 17 00:00:00 2001 From: johan12345 Date: Fri, 16 Aug 2024 23:52:02 +0200 Subject: [PATCH] UI fixes for chargers with unknown power #357 --- app/src/main/java/net/vonforst/evmap/model/ChargersModel.kt | 2 +- app/src/main/res/layout/dialog_connector_details_header.xml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/net/vonforst/evmap/model/ChargersModel.kt b/app/src/main/java/net/vonforst/evmap/model/ChargersModel.kt index b54ce523d..c9af66d78 100644 --- a/app/src/main/java/net/vonforst/evmap/model/ChargersModel.kt +++ b/app/src/main/java/net/vonforst/evmap/model/ChargersModel.kt @@ -142,7 +142,7 @@ data class ChargeLocation( fun formatChargepoints(sp: StringProvider): String { return chargepointsMerged.joinToString(" · ") { - "${it.count} × ${nameForPlugType(sp, it.type)} ${it.formatPower()}" + "${it.count} × ${nameForPlugType(sp, it.type)}${it.formatPower()?.let { " $it" } ?: ""}" } } } diff --git a/app/src/main/res/layout/dialog_connector_details_header.xml b/app/src/main/res/layout/dialog_connector_details_header.xml index e92db8e9e..f989b735b 100644 --- a/app/src/main/res/layout/dialog_connector_details_header.xml +++ b/app/src/main/res/layout/dialog_connector_details_header.xml @@ -79,9 +79,8 @@ android:layout_height="wrap_content" android:layout_marginStart="36dp" android:layout_marginTop="4dp" - android:text="@{item != null ? UtilsKt.nameForPlugType(ChargepointApiKt.stringProvider(context), item.chargepoint.type) + " · " + item.chargepoint.formatPower() : null}" + android:text="@{item != null ? UtilsKt.nameForPlugType(ChargepointApiKt.stringProvider(context), item.chargepoint.type) + (item.chargepoint.hasKnownPower() ? " · " + item.chargepoint.formatPower() : "") : null}" android:textAppearance="@style/TextAppearance.Material3.BodyMedium" - app:goneUnless="@{item.chargepoint.hasKnownPower()}" app:layout_constraintBottom_toTopOf="@id/textView8" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/imageView"