From 914920930bf6cbf23993f39d1b272e2152a03c59 Mon Sep 17 00:00:00 2001 From: Altonss <66519591+Altonss@users.noreply.github.com> Date: Sun, 12 May 2024 15:47:52 +0200 Subject: [PATCH] Fix padding when no transport type --- app/src/main/java/de/grobox/transportr/ui/LineView.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/grobox/transportr/ui/LineView.kt b/app/src/main/java/de/grobox/transportr/ui/LineView.kt index c511c308f..998d26246 100644 --- a/app/src/main/java/de/grobox/transportr/ui/LineView.kt +++ b/app/src/main/java/de/grobox/transportr/ui/LineView.kt @@ -47,13 +47,17 @@ class LineView(context: Context, attr: AttributeSet?) : AppCompatTextView(contex @Suppress("DEPRECATION") setBackgroundDrawable(backgroundDrawable) - // correct padding that gets lost when setting background - setPadding(0, dpToPx(context, 2), dpToPx(context, 4), dpToPx(context, 2)) - // product icon if (line.product != null) { + // correct padding that gets lost when setting background + setPadding(0, dpToPx(context, 2), dpToPx(context, 4), dpToPx(context, 2)) + setDrawable(getDrawableForProduct(line.product), foregroundColor) } + else{ + // correct padding that gets lost when setting background + setPadding(dpToPx(context, 4), dpToPx(context, 2), dpToPx(context, 4), dpToPx(context, 2)) + } // set colored label text = line.label