refs #5652 Botones dinámicos
This commit is contained in:
parent
d93e34e13b
commit
400aa04046
|
@ -7,73 +7,81 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.google.android.material.textfield.TextInputEditText
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ComponentCustomListDialogBinding
|
||||
|
||||
//import kotlinx.android.synthetic.main.component_custom_list_dialog.*
|
||||
|
||||
|
||||
class CustomDialogList (context: Context) : Dialog(context, R.style.DialogTheme) {
|
||||
class CustomDialogList(context: Context) : Dialog(context, R.style.DialogTheme) {
|
||||
|
||||
|
||||
private var binding: ComponentCustomListDialogBinding = ComponentCustomListDialogBinding.inflate(layoutInflater)
|
||||
private var binding: ComponentCustomListDialogBinding =
|
||||
ComponentCustomListDialogBinding.inflate(layoutInflater)
|
||||
|
||||
init {
|
||||
|
||||
setContentView(binding.root)
|
||||
//setContentView(R.layout.component_custom_list_dialog)
|
||||
}
|
||||
|
||||
fun getRecyclerView() : RecyclerView {
|
||||
fun getRecyclerView(): RecyclerView {
|
||||
|
||||
return binding.itemRecyclerview
|
||||
//return item_recyclerview
|
||||
}
|
||||
|
||||
fun getEditText() : TextInputEditText {
|
||||
fun getEditText(): TextInputEditText {
|
||||
return binding.customDialogValue
|
||||
//return custom_dialog_value
|
||||
}
|
||||
|
||||
fun getEditTextTwo() : TextInputEditText {
|
||||
fun getEditTextTwo(): TextInputEditText {
|
||||
return binding.customDialogValueTwo
|
||||
//return custom_dialog_value_two
|
||||
}
|
||||
|
||||
fun getValue() : String {
|
||||
fun getValue(): String {
|
||||
return binding.customDialogValue.text.toString()
|
||||
//return custom_dialog_value.text.toString()
|
||||
}
|
||||
|
||||
fun setValue(value : String): CustomDialogList{
|
||||
fun setValue(value: String): CustomDialogList {
|
||||
binding.customDialogValue.setText(value)
|
||||
binding.textinputlayoutUsername.visibility=View.VISIBLE
|
||||
binding.textinputlayoutUsername.visibility = View.VISIBLE
|
||||
/*custom_dialog_value.setText(value)
|
||||
textinputlayout_username.visibility = View.VISIBLE*/
|
||||
return this
|
||||
}
|
||||
|
||||
fun getValueTwo() : String {
|
||||
fun setValueVisibility(modifier: Int) {
|
||||
binding.textinputlayoutUsername.visibility = modifier
|
||||
|
||||
}
|
||||
|
||||
fun getValueTwo(): String {
|
||||
return binding.customDialogValueTwo.text.toString()
|
||||
//return custom_dialog_value_two.text.toString()
|
||||
}
|
||||
|
||||
fun setValueTwo(value : String): CustomDialogList{
|
||||
fun setValueTwo(value: String): CustomDialogList {
|
||||
binding.customDialogValueTwo.setText(value)
|
||||
binding.textinputlayoutTwo.visibility=View.VISIBLE
|
||||
binding.textinputlayoutTwo.visibility = View.VISIBLE
|
||||
|
||||
/* custom_dialog_value_two.setText(value)
|
||||
textinputlayout_two.visibility = View.VISIBLE*/
|
||||
/* custom_dialog_value_two.setText(value)
|
||||
textinputlayout_two.visibility = View.VISIBLE*/
|
||||
return this
|
||||
}
|
||||
|
||||
fun setTitle(title: String): CustomDialogList {
|
||||
binding.customDialogTitle.visibility=View.VISIBLE
|
||||
binding.customDialogTitle.text=title
|
||||
/* custom_dialog_title.visibility = View.VISIBLE
|
||||
custom_dialog_title.text = title*/
|
||||
binding.customDialogTitle.visibility = View.VISIBLE
|
||||
binding.customDialogTitle.text = title
|
||||
/* custom_dialog_title.visibility = View.VISIBLE
|
||||
custom_dialog_title.text = title*/
|
||||
return this
|
||||
}
|
||||
|
||||
fun setDescription(title: String): CustomDialogList {
|
||||
binding.customDialogDescription.visibility=View.VISIBLE
|
||||
binding.customDialogDescription.text=title
|
||||
binding.customDialogDescription.visibility = View.VISIBLE
|
||||
binding.customDialogDescription.text = title
|
||||
|
||||
/*custom_dialog_description.visibility = View.VISIBLE
|
||||
custom_dialog_description.text = title*/
|
||||
|
@ -83,8 +91,8 @@ class CustomDialogList (context: Context) : Dialog(context, R.style.DialogTheme)
|
|||
|
||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
||||
|
||||
binding.customDialogButtonOk.visibility=View.VISIBLE
|
||||
binding.customDialogButtonOk.text=text
|
||||
binding.customDialogButtonOk.visibility = View.VISIBLE
|
||||
binding.customDialogButtonOk.text = text
|
||||
|
||||
/*custom_dialog_button_ok.visibility = View.VISIBLE
|
||||
custom_dialog_button_ok.text = text
|
||||
|
@ -95,8 +103,8 @@ class CustomDialogList (context: Context) : Dialog(context, R.style.DialogTheme)
|
|||
|
||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
||||
|
||||
binding.customDialogButtonKo.visibility=View.VISIBLE
|
||||
binding.customDialogButtonKo.text=text
|
||||
binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||
binding.customDialogButtonKo.text = text
|
||||
/*custom_dialog_button_ko.visibility = View.VISIBLE
|
||||
custom_dialog_button_ko.text = text*/
|
||||
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
|
||||
|
@ -104,36 +112,37 @@ class CustomDialogList (context: Context) : Dialog(context, R.style.DialogTheme)
|
|||
return this
|
||||
}
|
||||
|
||||
fun setHintValue(text:String): CustomDialogList{
|
||||
fun setHintValue(text: String): CustomDialogList {
|
||||
|
||||
binding.customDialogValue.hint=text
|
||||
binding.customDialogValue.hint = text
|
||||
// custom_dialog_value.hint = text
|
||||
return this
|
||||
}
|
||||
|
||||
fun setHintValueTwo(text:String): CustomDialogList{
|
||||
binding.customDialogValueTwo.hint=text
|
||||
fun setHintValueTwo(text: String): CustomDialogList {
|
||||
binding.customDialogValueTwo.hint = text
|
||||
//custom_dialog_value_two.hint = text
|
||||
return this
|
||||
}
|
||||
|
||||
fun setTextTwoGone():CustomDialogList{
|
||||
fun setTextTwoGone(): CustomDialogList {
|
||||
binding.textinputlayoutTwo.visibility = View.GONE
|
||||
//textinputlayout_two.visibility = View.GONE
|
||||
return this
|
||||
}
|
||||
|
||||
fun hideDialog():CustomDialogList{
|
||||
fun hideDialog(): CustomDialogList {
|
||||
binding.customDialogValue.visibility = View.GONE
|
||||
//custom_dialog_value.visibility = View.GONE
|
||||
return this
|
||||
}
|
||||
fun hideDescription():CustomDialogList{
|
||||
fun hideDescription(): CustomDialogList {
|
||||
binding.customDialogDescription.visibility = View.GONE
|
||||
|
||||
return this
|
||||
}
|
||||
fun hideTextInput():CustomDialogList{
|
||||
|
||||
fun hideTextInput(): CustomDialogList {
|
||||
binding.textinputlayoutUsername.visibility = View.INVISIBLE
|
||||
|
||||
return this
|
||||
|
|
Loading…
Reference in New Issue