From b1030ac8c16a72cb2b4df4233768aa35a11a29e1 Mon Sep 17 00:00:00 2001 From: leca Date: Tue, 15 Oct 2024 13:47:31 +0300 Subject: [PATCH] unneeded coloring --- .../barcodescannerforemployees/views/ProductView.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/foxarmy/barcodescannerforemployees/views/ProductView.kt b/app/src/main/java/org/foxarmy/barcodescannerforemployees/views/ProductView.kt index a73e914..c48a246 100644 --- a/app/src/main/java/org/foxarmy/barcodescannerforemployees/views/ProductView.kt +++ b/app/src/main/java/org/foxarmy/barcodescannerforemployees/views/ProductView.kt @@ -6,7 +6,6 @@ import android.graphics.Color import android.graphics.drawable.GradientDrawable import android.os.Build import android.util.AttributeSet -import android.util.Log import android.view.LayoutInflater import android.widget.ImageView import android.widget.LinearLayout @@ -93,9 +92,14 @@ class ProductView: LinearLayout { if (isProductSelected) { this.background = ContextCompat.getDrawable(context, R.drawable.outline_selected) } else { - this.background = ContextCompat.getDrawable(context, R.drawable.outline) - val color = evaluateColor() - (this.background.current as GradientDrawable).setStroke(3, color) + if (product.id != 0) { + val color = evaluateColor() + val outline = GradientDrawable() + this.background = outline + (this.background.current as GradientDrawable).setStroke(3, color) + } else { + this.background = ContextCompat.getDrawable(context, R.drawable.outline) + } } }