From ea63ddc24d8211ca5d784f67bc167a2c442fa028 Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Wed, 5 Jul 2023 13:12:57 +0200 Subject: [PATCH] =?UTF-8?q?Modificado=20customDialog=20para=20modificar=20?= =?UTF-8?q?inputText=20din=C3=A1micamente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/component/CustomDialogInput.kt | 36 +++++++++---------- .../collection/fragment/CollectionFragment.kt | 4 +-- .../fragment/CollectionFragmentPicker.kt | 4 +-- .../fragment/CollectionFragmentPreChecker.kt | 4 +-- .../fragment/PackingHollandFragment.kt | 3 +- .../fragment/InitPreSacadorFragment.kt | 3 +- .../sacador/fragment/SacadorFragment.kt | 3 +- 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogInput.kt b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogInput.kt index 8912efdf..7d5ad0e1 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogInput.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogInput.kt @@ -7,13 +7,12 @@ import android.view.View import com.google.android.material.textfield.TextInputEditText import es.verdnatura.R import es.verdnatura.databinding.ComponentCustomEditDialogBinding -import es.verdnatura.presentation.common.showKeyboard -import es.verdnatura.presentation.view.feature.main.activity.MainActivity -class CustomDialogInput (context: Context) : Dialog(context, R.style.DialogTheme) { +class CustomDialogInput(context: Context) : Dialog(context, R.style.DialogTheme) { - private var binding: ComponentCustomEditDialogBinding = ComponentCustomEditDialogBinding.inflate(layoutInflater) + private var binding: ComponentCustomEditDialogBinding = + ComponentCustomEditDialogBinding.inflate(layoutInflater) init { @@ -22,23 +21,23 @@ class CustomDialogInput (context: Context) : Dialog(context, R.style.DialogTheme //setContentView(R.layout.component_custom_edit_dialog) } - fun getEditText() : TextInputEditText { + fun getEditText(): TextInputEditText { return binding.customDialogValue //return custom_dialog_value } - fun getValue() : String { + fun getValue(): String { return binding.customDialogValue.text.toString() //return custom_dialog_value.text.toString() } - fun setValue(value : String): CustomDialogInput{ + fun setValue(value: String): CustomDialogInput { binding.customDialogValue.setText(value) - binding.customDialogValue.visibility= View.VISIBLE + binding.customDialogValue.visibility = View.VISIBLE // custom_dialog_value.setText(value) // custom_dialog_value.visibility = View.VISIBLE @@ -47,8 +46,8 @@ class CustomDialogInput (context: Context) : Dialog(context, R.style.DialogTheme fun setTitle(title: String): CustomDialogInput { - binding.customDialogTitle.visibility=View.VISIBLE - binding.customDialogTitle.text=title + binding.customDialogTitle.visibility = View.VISIBLE + binding.customDialogTitle.text = title // custom_dialog_title.visibility = View.VISIBLE // custom_dialog_title.text = title return this @@ -67,19 +66,19 @@ class CustomDialogInput (context: Context) : Dialog(context, R.style.DialogTheme fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogInput { binding.customDialogButtonOk.visibility = View.VISIBLE - binding.customDialogButtonOk.text =text + binding.customDialogButtonOk.text = text binding.customDialogButtonOk.setOnClickListener { onButtonClicked() } - /* custom_dialog_button_ok.visibility = View.VISIBLE - custom_dialog_button_ok.text = text - custom_dialog_button_ok.setOnClickListener { onButtonClicked() }*/ + /* custom_dialog_button_ok.visibility = View.VISIBLE + custom_dialog_button_ok.text = text + custom_dialog_button_ok.setOnClickListener { onButtonClicked() }*/ return this } fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogInput { binding.customDialogButtonKo.visibility = View.VISIBLE - binding.customDialogButtonKo.text =text + binding.customDialogButtonKo.text = text binding.customDialogButtonKo.setOnClickListener { onButtonClicked() } /*custom_dialog_button_ko.visibility = View.VISIBLE @@ -89,10 +88,11 @@ class CustomDialogInput (context: Context) : Dialog(context, R.style.DialogTheme return this } - fun setInputText(){ - binding.customDialogValue.inputType= InputType.TYPE_CLASS_NUMBER + fun setInputText(typeClassNumber: Int = InputType.TYPE_CLASS_NUMBER) { + binding.customDialogValue.inputType = typeClassNumber } - fun setFocusText(){ + + fun setFocusText() { binding.customDialogValue.requestFocus() } } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt index cc6eae60..88dcb77e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt @@ -2291,7 +2291,7 @@ class CollectionFragment( showKeyboards() }.setValue("").show() - customDialogInput.setInputText() + customDialogInput.setInputText(TYPE_CLASS_NUMBER) // customDialogInput.currentFocus customDialogInput.setFocusText() showKeyboards() @@ -2351,7 +2351,7 @@ class CollectionFragment( showKeyboards() }.setValue("").show() - customDialogInput.setInputText() + customDialogInput.setInputText(TYPE_CLASS_NUMBER) customDialogInput.currentFocus customDialogInput.setFocusText() showKeyboards() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt index 315c7cd8..e5b239fe 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPicker.kt @@ -2390,7 +2390,7 @@ import org.json.JSONObject showKeyboards() }.setValue("").show() - customDialogInput.setInputText() + customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER) // customDialogInput.currentFocus customDialogInput.setFocusText() showKeyboards() @@ -2450,7 +2450,7 @@ import org.json.JSONObject showKeyboards() }.setValue("").show() - customDialogInput.setInputText() + customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER) customDialogInput.currentFocus customDialogInput.setFocusText() showKeyboards() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreChecker.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreChecker.kt index eb9e9345..70815b8e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreChecker.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPreChecker.kt @@ -2365,7 +2365,7 @@ class CollectionFragmentPreChecker( showKeyboards() }.setValue("").show() - customDialogInput.setInputText() + customDialogInput.setInputText(TYPE_CLASS_NUMBER) // customDialogInput.currentFocus customDialogInput.setFocusText() showKeyboards() @@ -2425,7 +2425,7 @@ class CollectionFragmentPreChecker( showKeyboards() }.setValue("").show() - customDialogInput.setInputText() + customDialogInput.setInputText(TYPE_CLASS_NUMBER) customDialogInput.currentFocus customDialogInput.setFocusText() showKeyboards() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/packingHolland/fragment/PackingHollandFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/packingHolland/fragment/PackingHollandFragment.kt index 7347231d..1ef258a2 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/packingHolland/fragment/PackingHollandFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/packingHolland/fragment/PackingHollandFragment.kt @@ -1,5 +1,6 @@ package es.verdnatura.presentation.view.feature.packingHolland.fragment +import android.text.InputType import android.view.View.* import android.view.inputmethod.EditorInfo import es.verdnatura.R @@ -84,7 +85,7 @@ class PackingHollandFragment(var entrypoint: String) : private fun showQuantityPacking() { - customDialogInput.setInputText() + customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER) customDialogInput.setTitle(getString(R.string.titlePackingHolland)) customDialogInput.setDescription(getString(R.string.packingQuantity) + shelvingScaned) .setValue("") diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/InitPreSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/InitPreSacadorFragment.kt index 8ffcf2d1..1ca00586 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/InitPreSacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/InitPreSacadorFragment.kt @@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.presacador.fragment import android.content.Context import android.graphics.drawable.Drawable import android.os.Build +import android.text.InputType import android.view.View import android.view.inputmethod.EditorInfo import android.widget.ImageView @@ -127,7 +128,7 @@ class InitPreSacadorFragment( private fun showPrintPrevious() { - customDialogInput.setInputText() + customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER) customDialogInput.setTitle(getString(R.string.printTicket)) customDialogInput.setDescription(getString(R.string.printPreviousGroup)) .setValue("") diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt index 98056bbb..2dafec5f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt @@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.sacador.fragment import android.content.Context import android.graphics.drawable.Drawable import android.os.Build +import android.text.InputType import android.view.View import android.view.inputmethod.EditorInfo import android.widget.ImageView @@ -139,7 +140,7 @@ class SacadorFragment( private fun showPrintPrevious() { - customDialogInput.setInputText() + customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER) customDialogInput.setTitle(getString(R.string.printTicket)) customDialogInput.setDescription(getString(R.string.printPreviousGroup)) .setValue("")