From f569c45f80c74256e5c9d41784b3b6491d9c4fb5 Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Mon, 2 Sep 2024 07:50:39 +0200 Subject: [PATCH] feat: regularizar Parking #7817 --- .../java/es/verdnatura/domain/Extensions.kt | 4 ++-- .../ExpeditionPalletDetailFragment.kt | 20 ++++++++++++++----- .../parking/fragment/ParkingFragment.kt | 7 ++----- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/es/verdnatura/domain/Extensions.kt b/app/src/main/java/es/verdnatura/domain/Extensions.kt index 50f862f4..98f784dd 100644 --- a/app/src/main/java/es/verdnatura/domain/Extensions.kt +++ b/app/src/main/java/es/verdnatura/domain/Extensions.kt @@ -42,8 +42,8 @@ fun EditText.toInt(): Int { } fun String.isParking(): Boolean { - val regex = Regex("[\\S-\\S]{5}") - return regex.matches(this) + val regex = Regex("^[^ ]+-[^ ]+$") + return this.length > 4 && regex.matches(this) } fun String.isShelving(): Boolean { val regex = Regex("\\S{0,4}") diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt index 7c419be3..84abc19c 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt @@ -48,14 +48,24 @@ class ExpeditionPalletDetailFragment( override fun init() { customDialog = CustomDialog(requireContext()) binding.expeditionPalletDetailPallet.text = - getString(R.string.pallet) + " " + itemPallet!!.Pallet + buildString { + append(getString(R.string.pallet)) + append(" ") + append(itemPallet!!.Pallet) + } ma.hideBottomNavigation(View.GONE) binding.mainToolbar.toolbarTitle.text = - itemExpeditionTruckVO!!.eta.toString() + " " + if (itemExpeditionTruckVO!!.Destino.isNullOrEmpty()) { + buildString { + append(itemExpeditionTruckVO!!.eta) + append(" ") + append( + if (itemExpeditionTruckVO!!.Destino.isNullOrEmpty()) { - itemExpeditionTruckVO!!.description - } else { - itemExpeditionTruckVO!!.Destino + itemExpeditionTruckVO!!.description + } else { + itemExpeditionTruckVO!!.Destino + } + ) } setToolBar() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt index 37111cf0..69413520 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingFragment.kt @@ -6,6 +6,7 @@ import android.view.inputmethod.EditorInfo import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R import es.verdnatura.databinding.FragmentParkingBinding +import es.verdnatura.domain.isParking import es.verdnatura.domain.toast import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnBarcodeRowClickListener @@ -103,7 +104,6 @@ class ParkingFragment(var menuOrigin: String) : override fun onBarcodeRowClickListener(item: BarcodeVO) { try { val position = scanerList.indexOf(item) - println("parking $position") if (position != -1) { scanerList.removeAt(position) adapter!!.notifyItemRangeChanged(position,scanerList.size-position+1) @@ -121,11 +121,8 @@ class ParkingFragment(var menuOrigin: String) : } private fun checkScan(txtScan: String) { - println("txtScan $txtScan") var isParking = false - if (txtScan.trim().length == 4 && isLetter(txtScan.substring(txtScan.length - 1)) || txtScan.contains( - "-" - ) + if (txtScan.isParking() ) { isParking = true }