Modificado customDialog para modificar inputText dinámicamente
This commit is contained in:
parent
ad4910948d
commit
ea63ddc24d
|
@ -7,13 +7,12 @@ import android.view.View
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.ComponentCustomEditDialogBinding
|
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 {
|
init {
|
||||||
|
@ -22,23 +21,23 @@ class CustomDialogInput (context: Context) : Dialog(context, R.style.DialogTheme
|
||||||
//setContentView(R.layout.component_custom_edit_dialog)
|
//setContentView(R.layout.component_custom_edit_dialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEditText() : TextInputEditText {
|
fun getEditText(): TextInputEditText {
|
||||||
|
|
||||||
return binding.customDialogValue
|
return binding.customDialogValue
|
||||||
//return custom_dialog_value
|
//return custom_dialog_value
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getValue() : String {
|
fun getValue(): String {
|
||||||
|
|
||||||
return binding.customDialogValue.text.toString()
|
return binding.customDialogValue.text.toString()
|
||||||
//return custom_dialog_value.text.toString()
|
//return custom_dialog_value.text.toString()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setValue(value : String): CustomDialogInput{
|
fun setValue(value: String): CustomDialogInput {
|
||||||
|
|
||||||
binding.customDialogValue.setText(value)
|
binding.customDialogValue.setText(value)
|
||||||
binding.customDialogValue.visibility= View.VISIBLE
|
binding.customDialogValue.visibility = View.VISIBLE
|
||||||
|
|
||||||
// custom_dialog_value.setText(value)
|
// custom_dialog_value.setText(value)
|
||||||
// custom_dialog_value.visibility = View.VISIBLE
|
// custom_dialog_value.visibility = View.VISIBLE
|
||||||
|
@ -47,8 +46,8 @@ class CustomDialogInput (context: Context) : Dialog(context, R.style.DialogTheme
|
||||||
|
|
||||||
fun setTitle(title: String): CustomDialogInput {
|
fun setTitle(title: String): CustomDialogInput {
|
||||||
|
|
||||||
binding.customDialogTitle.visibility=View.VISIBLE
|
binding.customDialogTitle.visibility = View.VISIBLE
|
||||||
binding.customDialogTitle.text=title
|
binding.customDialogTitle.text = title
|
||||||
// custom_dialog_title.visibility = View.VISIBLE
|
// custom_dialog_title.visibility = View.VISIBLE
|
||||||
// custom_dialog_title.text = title
|
// custom_dialog_title.text = title
|
||||||
return this
|
return this
|
||||||
|
@ -67,19 +66,19 @@ class CustomDialogInput (context: Context) : Dialog(context, R.style.DialogTheme
|
||||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogInput {
|
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogInput {
|
||||||
|
|
||||||
binding.customDialogButtonOk.visibility = View.VISIBLE
|
binding.customDialogButtonOk.visibility = View.VISIBLE
|
||||||
binding.customDialogButtonOk.text =text
|
binding.customDialogButtonOk.text = text
|
||||||
binding.customDialogButtonOk.setOnClickListener { onButtonClicked() }
|
binding.customDialogButtonOk.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
/* custom_dialog_button_ok.visibility = View.VISIBLE
|
/* custom_dialog_button_ok.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ok.text = text
|
custom_dialog_button_ok.text = text
|
||||||
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }*/
|
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogInput {
|
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogInput {
|
||||||
|
|
||||||
binding.customDialogButtonKo.visibility = View.VISIBLE
|
binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||||
binding.customDialogButtonKo.text =text
|
binding.customDialogButtonKo.text = text
|
||||||
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
|
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
/*custom_dialog_button_ko.visibility = View.VISIBLE
|
/*custom_dialog_button_ko.visibility = View.VISIBLE
|
||||||
|
@ -89,10 +88,11 @@ class CustomDialogInput (context: Context) : Dialog(context, R.style.DialogTheme
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setInputText(){
|
fun setInputText(typeClassNumber: Int = InputType.TYPE_CLASS_NUMBER) {
|
||||||
binding.customDialogValue.inputType= InputType.TYPE_CLASS_NUMBER
|
binding.customDialogValue.inputType = typeClassNumber
|
||||||
}
|
}
|
||||||
fun setFocusText(){
|
|
||||||
|
fun setFocusText() {
|
||||||
binding.customDialogValue.requestFocus()
|
binding.customDialogValue.requestFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2291,7 +2291,7 @@ class CollectionFragment(
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
}.setValue("").show()
|
}.setValue("").show()
|
||||||
|
|
||||||
customDialogInput.setInputText()
|
customDialogInput.setInputText(TYPE_CLASS_NUMBER)
|
||||||
// customDialogInput.currentFocus
|
// customDialogInput.currentFocus
|
||||||
customDialogInput.setFocusText()
|
customDialogInput.setFocusText()
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
|
@ -2351,7 +2351,7 @@ class CollectionFragment(
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
}.setValue("").show()
|
}.setValue("").show()
|
||||||
|
|
||||||
customDialogInput.setInputText()
|
customDialogInput.setInputText(TYPE_CLASS_NUMBER)
|
||||||
customDialogInput.currentFocus
|
customDialogInput.currentFocus
|
||||||
customDialogInput.setFocusText()
|
customDialogInput.setFocusText()
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
|
|
|
@ -2390,7 +2390,7 @@ import org.json.JSONObject
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
}.setValue("").show()
|
}.setValue("").show()
|
||||||
|
|
||||||
customDialogInput.setInputText()
|
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
|
||||||
// customDialogInput.currentFocus
|
// customDialogInput.currentFocus
|
||||||
customDialogInput.setFocusText()
|
customDialogInput.setFocusText()
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
|
@ -2450,7 +2450,7 @@ import org.json.JSONObject
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
}.setValue("").show()
|
}.setValue("").show()
|
||||||
|
|
||||||
customDialogInput.setInputText()
|
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
|
||||||
customDialogInput.currentFocus
|
customDialogInput.currentFocus
|
||||||
customDialogInput.setFocusText()
|
customDialogInput.setFocusText()
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
|
|
|
@ -2365,7 +2365,7 @@ class CollectionFragmentPreChecker(
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
}.setValue("").show()
|
}.setValue("").show()
|
||||||
|
|
||||||
customDialogInput.setInputText()
|
customDialogInput.setInputText(TYPE_CLASS_NUMBER)
|
||||||
// customDialogInput.currentFocus
|
// customDialogInput.currentFocus
|
||||||
customDialogInput.setFocusText()
|
customDialogInput.setFocusText()
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
|
@ -2425,7 +2425,7 @@ class CollectionFragmentPreChecker(
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
}.setValue("").show()
|
}.setValue("").show()
|
||||||
|
|
||||||
customDialogInput.setInputText()
|
customDialogInput.setInputText(TYPE_CLASS_NUMBER)
|
||||||
customDialogInput.currentFocus
|
customDialogInput.currentFocus
|
||||||
customDialogInput.setFocusText()
|
customDialogInput.setFocusText()
|
||||||
showKeyboards()
|
showKeyboards()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.packingHolland.fragment
|
package es.verdnatura.presentation.view.feature.packingHolland.fragment
|
||||||
|
|
||||||
|
import android.text.InputType
|
||||||
import android.view.View.*
|
import android.view.View.*
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
|
@ -84,7 +85,7 @@ class PackingHollandFragment(var entrypoint: String) :
|
||||||
|
|
||||||
private fun showQuantityPacking() {
|
private fun showQuantityPacking() {
|
||||||
|
|
||||||
customDialogInput.setInputText()
|
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
|
||||||
customDialogInput.setTitle(getString(R.string.titlePackingHolland))
|
customDialogInput.setTitle(getString(R.string.titlePackingHolland))
|
||||||
customDialogInput.setDescription(getString(R.string.packingQuantity) + shelvingScaned)
|
customDialogInput.setDescription(getString(R.string.packingQuantity) + shelvingScaned)
|
||||||
.setValue("")
|
.setValue("")
|
||||||
|
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.presacador.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.text.InputType
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
@ -127,7 +128,7 @@ class InitPreSacadorFragment(
|
||||||
|
|
||||||
private fun showPrintPrevious() {
|
private fun showPrintPrevious() {
|
||||||
|
|
||||||
customDialogInput.setInputText()
|
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
|
||||||
customDialogInput.setTitle(getString(R.string.printTicket))
|
customDialogInput.setTitle(getString(R.string.printTicket))
|
||||||
customDialogInput.setDescription(getString(R.string.printPreviousGroup))
|
customDialogInput.setDescription(getString(R.string.printPreviousGroup))
|
||||||
.setValue("")
|
.setValue("")
|
||||||
|
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.text.InputType
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
@ -139,7 +140,7 @@ class SacadorFragment(
|
||||||
|
|
||||||
private fun showPrintPrevious() {
|
private fun showPrintPrevious() {
|
||||||
|
|
||||||
customDialogInput.setInputText()
|
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
|
||||||
customDialogInput.setTitle(getString(R.string.printTicket))
|
customDialogInput.setTitle(getString(R.string.printTicket))
|
||||||
customDialogInput.setDescription(getString(R.string.printPreviousGroup))
|
customDialogInput.setDescription(getString(R.string.printPreviousGroup))
|
||||||
.setValue("")
|
.setValue("")
|
||||||
|
|
Loading…
Reference in New Issue