From 646ea2b91aca7211c552778a03f61e6e0e8b6f8c Mon Sep 17 00:00:00 2001 From: leca Date: Sat, 12 Oct 2024 04:52:21 +0300 Subject: [PATCH] fixes --- .../activities/AddAbstractProductActivity.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/AddAbstractProductActivity.kt b/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/AddAbstractProductActivity.kt index 2aea5ed..9d7bb4d 100644 --- a/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/AddAbstractProductActivity.kt +++ b/app/src/main/java/org/foxarmy/barcodescannerforemployees/activities/AddAbstractProductActivity.kt @@ -44,6 +44,9 @@ class AddAbstractProductActivity : AppCompatActivity() { val extras = intent.extras abstractProduct = extras!!.get("abstractProduct") as AbstractProduct? + if (abstractProduct != null) { + barcode = abstractProduct!!.barcode + } picturesPath = File(filesDir, "pictures") val thumbnailsDir = File(cacheDir, "thumbnails") @@ -75,7 +78,7 @@ class AddAbstractProductActivity : AppCompatActivity() { saveButton.setOnClickListener { val productName = productNameText.text.toString() val netWeight = netWeightText.text - if (!this::pictureFile.isInitialized || !pictureFile.exists()) { + if (abstractProduct == null && (!this::pictureFile.isInitialized || !pictureFile.exists())) { Toast.makeText(this, "Please, make a picture of a product!", Toast.LENGTH_SHORT).show() return@setOnClickListener