Modificar synthetic por databinding/viewbinding
This commit is contained in:
parent
af1b0541d5
commit
42023e7f61
|
@ -76,10 +76,14 @@
|
||||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_login.xml" value="0.134375" />
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_login.xml" value="0.134375" />
|
||||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_main.xml" value="0.17916666666666667" />
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_main.xml" value="0.17916666666666667" />
|
||||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/buyers_fragment.xml" value="0.18333333333333332" />
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/buyers_fragment.xml" value="0.18333333333333332" />
|
||||||
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_dialog.xml" value="0.1490036231884058" />
|
||||||
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_list_dialog.xml" value="0.1490036231884058" />
|
||||||
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_three_dialog.xml" value="0.12817028985507245" />
|
||||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_ajustes.xml" value="0.3333333333333333" />
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_ajustes.xml" value="0.3333333333333333" />
|
||||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_automatic_add_item.xml" value="0.20625" />
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_automatic_add_item.xml" value="0.20625" />
|
||||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buffer.xml" value="0.1408514492753623" />
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buffer.xml" value="0.1408514492753623" />
|
||||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buffer_load.xml" value="0.20923913043478262" />
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buffer_load.xml" value="0.20923913043478262" />
|
||||||
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buffer_loadexpedition.xml" value="0.1398176291793313" />
|
||||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buscar_item.xml" value="0.21014492753623187" />
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buscar_item.xml" value="0.21014492753623187" />
|
||||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_collection.xml" value="0.23007246376811594" />
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_collection.xml" value="0.23007246376811594" />
|
||||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_controlador.xml" value="0.20153985507246377" />
|
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_controlador.xml" value="0.20153985507246377" />
|
||||||
|
|
|
@ -40,7 +40,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding = false
|
viewBinding = true
|
||||||
}
|
}
|
||||||
dataBinding {
|
dataBinding {
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
Binary file not shown.
|
@ -110,10 +110,11 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
||||||
requestRecordAudioPermissionNew()
|
requestRecordAudioPermissionNew()
|
||||||
init()
|
init()
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
||||||
{
|
{
|
||||||
super.onViewCreated(view,savedInstanceState)
|
super.onViewCreated(view,savedInstanceState)
|
||||||
|
initDataBinding()
|
||||||
getBundleArguments()
|
getBundleArguments()
|
||||||
observeViewModel()
|
observeViewModel()
|
||||||
runSound()
|
runSound()
|
||||||
|
|
|
@ -27,6 +27,10 @@ interface OnPasillerosItemClickListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
interface hideBottomNavigation{
|
||||||
|
fun hideBottomNavigation(entryPoint:String)
|
||||||
|
}
|
||||||
|
|
||||||
interface OnAjustesItemClickListener {
|
interface OnAjustesItemClickListener {
|
||||||
fun onAjustesItemClickListener(item: AjustesItemVO)
|
fun onAjustesItemClickListener(item: AjustesItemVO)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,58 +4,61 @@ import android.app.Dialog
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import kotlinx.android.synthetic.main.component_custom_dialog.*
|
import es.verdnatura.databinding.ComponentCustomDialogBinding
|
||||||
|
//import kotlinx.android.synthetic.main.component_custom_dialog.*
|
||||||
|
|
||||||
|
//import kotlinx.android.synthetic.main.component_custom_dialog.*
|
||||||
//import es.verdnatura.databinding.ComponentCustomDialogBinding
|
//import es.verdnatura.databinding.ComponentCustomDialogBinding
|
||||||
|
|
||||||
//private lateinit var binding: ComponentCustomDialogBinding
|
private lateinit var binding: ComponentCustomDialogBinding
|
||||||
|
|
||||||
class CustomDialog(context: Context) : Dialog(context, R.style.DialogTheme) {
|
class CustomDialog(context: Context) : Dialog(context, R.style.DialogTheme) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
||||||
setContentView(R.layout.component_custom_dialog)
|
//setContentView(R.layout.component_custom_dialog)
|
||||||
//sergio: lo nuevo para quitar synthetic de kotlin
|
//sergio: lo nuevo para quitar synthetic de kotlin
|
||||||
/* binding = ComponentCustomDialogBinding.inflate(layoutInflater)
|
|
||||||
val view = binding.root
|
binding = ComponentCustomDialogBinding.inflate(layoutInflater)
|
||||||
setContentView(view)*/
|
setContentView(binding.root)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setTitle(title: String): CustomDialog {
|
fun setTitle(title: String): CustomDialog {
|
||||||
custom_dialog_title.visibility = View.VISIBLE
|
/*custom_dialog_title.visibility = View.VISIBLE
|
||||||
custom_dialog_title.text = title
|
custom_dialog_title.text = title*/
|
||||||
/* binding.customDialogTitle.visibility = View.VISIBLE
|
binding.customDialogTitle.visibility = View.VISIBLE
|
||||||
binding.customDialogTitle.text = title*/
|
binding.customDialogTitle.text = title
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDescription(description: String): CustomDialog {
|
fun setDescription(description: String): CustomDialog {
|
||||||
custom_dialog_description.visibility = View.VISIBLE
|
/*custom_dialog_description.visibility = View.VISIBLE
|
||||||
custom_dialog_description.text = description
|
custom_dialog_description.text = description*/
|
||||||
/*binding.customDialogDescription.visibility = View.VISIBLE
|
binding.customDialogDescription.visibility = View.VISIBLE
|
||||||
binding.customDialogDescription.text = description*/
|
binding.customDialogDescription.text = description
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialog {
|
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialog {
|
||||||
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() }*/
|
||||||
/*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() }
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialog {
|
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialog {
|
||||||
custom_dialog_button_ko.visibility = View.VISIBLE
|
/* custom_dialog_button_ko.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ko.text = text
|
custom_dialog_button_ko.text = text
|
||||||
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }*/
|
||||||
/* 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() }
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,49 +6,73 @@ import android.content.Context
|
||||||
import android.view.View
|
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 kotlinx.android.synthetic.main.component_custom_hour.*
|
import es.verdnatura.databinding.ComponentCustomHourBinding
|
||||||
|
//import kotlinx.android.synthetic.main.component_custom_hour.*
|
||||||
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
class CustomDialogHour(context: Context) : Dialog(context, R.style.DialogTheme) {
|
class CustomDialogHour(context: Context) : Dialog(context, R.style.DialogTheme) {
|
||||||
|
|
||||||
|
private var binding: ComponentCustomHourBinding = ComponentCustomHourBinding.inflate(layoutInflater)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setContentView(R.layout.component_custom_hour)
|
|
||||||
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
//setContentView(R.layout.component_custom_hour)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDestinoEditText(): TextInputEditText {
|
fun getDestinoEditText(): TextInputEditText {
|
||||||
return custom_dialog_destino_value
|
|
||||||
|
//return custom_dialog_destino_value
|
||||||
|
return binding.customDialogDestinoValue
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDestinoValue(): String {
|
fun getDestinoValue(): String {
|
||||||
return custom_dialog_destino_value.text.toString()
|
// return custom_dialog_destino_value.text.toString()
|
||||||
|
return binding.customDialogDestinoValue.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDestinoValue(value: String): CustomDialogHour {
|
fun setDestinoValue(value: String): CustomDialogHour {
|
||||||
custom_dialog_destino_value.setText(value)
|
|
||||||
custom_dialog_destino_value.visibility = View.VISIBLE
|
binding.customDialogDestinoValue.setText(value)
|
||||||
|
binding.customDialogDestinoValue.visibility=View.VISIBLE
|
||||||
return this
|
return this
|
||||||
|
/*custom_dialog_destino_value.setText(value)
|
||||||
|
custom_dialog_destino_value.visibility = View.VISIBLE
|
||||||
|
return this*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun getHoraEditText(): TextInputEditText {
|
fun getHoraEditText(): TextInputEditText {
|
||||||
return custom_dialog_hour_value
|
return binding.customDialogHourValue
|
||||||
|
//return custom_dialog_hour_value
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getHoraValue(): String {
|
fun getHoraValue(): String {
|
||||||
return custom_dialog_hour_value.text.toString()
|
return binding.customDialogHourValue.text.toString()
|
||||||
|
//return custom_dialog_hour_value.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setHoraValue(value: String): CustomDialogHour {
|
fun setHoraValue(value: String): CustomDialogHour {
|
||||||
custom_dialog_hour_value.setText(value)
|
|
||||||
custom_dialog_hour_value.visibility = View.VISIBLE
|
binding.customDialogHourValue.setText(value)
|
||||||
ib_obtener_hora.setOnClickListener {
|
binding.customDialogHourValue.visibility=View.VISIBLE
|
||||||
val cal = Calendar.getInstance()
|
binding.ibObtenerHora.setOnClickListener{
|
||||||
|
|
||||||
|
}
|
||||||
|
//custom_dialog_hour_value.setText(value)
|
||||||
|
//custom_dialog_hour_value.visibility = View.VISIBLE
|
||||||
|
// ib_obtener_hora.setOnClickListener {
|
||||||
|
binding.ibObtenerHora.setOnClickListener{
|
||||||
|
val cal = Calendar.getInstance()
|
||||||
val timeSetListener = TimePickerDialog.OnTimeSetListener { timePicker, hour, minute ->
|
val timeSetListener = TimePickerDialog.OnTimeSetListener { timePicker, hour, minute ->
|
||||||
cal.set(Calendar.HOUR_OF_DAY, hour)
|
cal.set(Calendar.HOUR_OF_DAY, hour)
|
||||||
cal.set(Calendar.MINUTE, minute)
|
cal.set(Calendar.MINUTE, minute)
|
||||||
custom_dialog_hour_value.setText(SimpleDateFormat("HH:mm").format(cal.time))
|
binding.customDialogHourValue.setText(SimpleDateFormat("HH:mm").format(cal.time))
|
||||||
|
//custom_dialog_hour_value.setText(SimpleDateFormat("HH:mm").format(cal.time))
|
||||||
}
|
}
|
||||||
TimePickerDialog(context, timeSetListener, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), true).show()
|
TimePickerDialog(context, timeSetListener, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), true).show()
|
||||||
}
|
}
|
||||||
|
@ -56,28 +80,41 @@ class CustomDialogHour(context: Context) : Dialog(context, R.style.DialogTheme)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setTitle(title: String): CustomDialogHour {
|
fun setTitle(title: String): CustomDialogHour {
|
||||||
custom_dialog_title.visibility = View.VISIBLE
|
binding.customDialogTitle.visibility=View.VISIBLE
|
||||||
custom_dialog_title.text = title
|
binding.customDialogTitle.text=title
|
||||||
|
// custom_dialog_title.visibility = View.VISIBLE
|
||||||
|
//custom_dialog_title.text = title
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDescription(description: String): CustomDialogHour {
|
fun setDescription(description: String): CustomDialogHour {
|
||||||
custom_dialog_description.visibility = View.VISIBLE
|
binding.customDialogDescription.visibility=View.VISIBLE
|
||||||
custom_dialog_description.text = description
|
binding.customDialogDescription.text = description
|
||||||
|
|
||||||
|
//custom_dialog_description.visibility = View.VISIBLE
|
||||||
|
//custom_dialog_description.text = description
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogHour {
|
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogHour {
|
||||||
custom_dialog_button_ok.visibility = View.VISIBLE
|
binding.customDialogButtonOk.visibility=View.VISIBLE
|
||||||
custom_dialog_button_ok.text = text
|
binding.customDialogButtonOk.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() }
|
||||||
|
binding.customDialogButtonOk.setOnClickListener{ onButtonClicked() }
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogHour {
|
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogHour {
|
||||||
custom_dialog_button_ko.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonKo.text = text
|
||||||
|
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
|
||||||
|
/*custom_dialog_button_ko.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ko.text = text
|
custom_dialog_button_ko.text = text
|
||||||
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,55 +5,84 @@ import android.content.Context
|
||||||
import android.view.View
|
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 kotlinx.android.synthetic.main.component_custom_dialog.custom_dialog_button_ko
|
import es.verdnatura.databinding.ComponentCustomEditDialogBinding
|
||||||
import kotlinx.android.synthetic.main.component_custom_dialog.custom_dialog_button_ok
|
|
||||||
import kotlinx.android.synthetic.main.component_custom_dialog.custom_dialog_description
|
|
||||||
import kotlinx.android.synthetic.main.component_custom_dialog.custom_dialog_title
|
|
||||||
import kotlinx.android.synthetic.main.component_custom_edit_dialog.*
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setContentView(R.layout.component_custom_edit_dialog)
|
|
||||||
|
setContentView(binding.root)
|
||||||
|
//setContentView(R.layout.component_custom_edit_dialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEditText() : TextInputEditText {
|
fun getEditText() : TextInputEditText {
|
||||||
return custom_dialog_value
|
|
||||||
|
return binding.customDialogValue
|
||||||
|
//return custom_dialog_value
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getValue() : String {
|
fun getValue() : String {
|
||||||
return custom_dialog_value.text.toString()
|
|
||||||
|
return binding.customDialogValue.text.toString()
|
||||||
|
//return custom_dialog_value.text.toString()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setValue(value : String): CustomDialogInput{
|
fun setValue(value : String): CustomDialogInput{
|
||||||
custom_dialog_value.setText(value)
|
|
||||||
custom_dialog_value.visibility = View.VISIBLE
|
binding.customDialogValue.setText(value)
|
||||||
|
binding.customDialogValue.visibility= View.VISIBLE
|
||||||
|
|
||||||
|
// custom_dialog_value.setText(value)
|
||||||
|
// custom_dialog_value.visibility = View.VISIBLE
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setTitle(title: String): CustomDialogInput {
|
fun setTitle(title: String): CustomDialogInput {
|
||||||
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
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDescription(description: String): CustomDialogInput {
|
fun setDescription(description: String): CustomDialogInput {
|
||||||
custom_dialog_description.visibility = View.VISIBLE
|
|
||||||
custom_dialog_description.text = description
|
binding.customDialogDescription.visibility = View.VISIBLE
|
||||||
|
binding.customDialogDescription.text = description
|
||||||
|
|
||||||
|
/*custom_dialog_description.visibility = View.VISIBLE
|
||||||
|
custom_dialog_description.text = description*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogInput {
|
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogInput {
|
||||||
custom_dialog_button_ok.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonOk.visibility = View.VISIBLE
|
||||||
|
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.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 {
|
||||||
custom_dialog_button_ko.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonKo.text =text
|
||||||
|
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
|
/*custom_dialog_button_ko.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ko.text = text
|
custom_dialog_button_ko.text = text
|
||||||
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }*/
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,91 +6,126 @@ import android.view.View
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import kotlinx.android.synthetic.main.component_custom_list_dialog.*
|
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)
|
||||||
init {
|
init {
|
||||||
setContentView(R.layout.component_custom_list_dialog)
|
|
||||||
|
setContentView(binding.root)
|
||||||
|
//setContentView(R.layout.component_custom_list_dialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getRecyclerView() : RecyclerView {
|
fun getRecyclerView() : RecyclerView {
|
||||||
return item_recyclerview
|
|
||||||
|
return binding.itemRecyclerview
|
||||||
|
//return item_recyclerview
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEditText() : TextInputEditText {
|
fun getEditText() : TextInputEditText {
|
||||||
return custom_dialog_value
|
return binding.customDialogValue
|
||||||
|
//return custom_dialog_value
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEditTextTwo() : TextInputEditText {
|
fun getEditTextTwo() : TextInputEditText {
|
||||||
return custom_dialog_value_two
|
return binding.customDialogValueTwo
|
||||||
|
//return custom_dialog_value_two
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getValue() : String {
|
fun getValue() : String {
|
||||||
return custom_dialog_value.text.toString()
|
return binding.customDialogValue.text.toString()
|
||||||
|
//return custom_dialog_value.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setValue(value : String): CustomDialogList{
|
fun setValue(value : String): CustomDialogList{
|
||||||
custom_dialog_value.setText(value)
|
binding.customDialogValue.setText(value)
|
||||||
textinputlayout_username.visibility = View.VISIBLE
|
binding.textinputlayoutUsername.visibility=View.VISIBLE
|
||||||
|
/*custom_dialog_value.setText(value)
|
||||||
|
textinputlayout_username.visibility = View.VISIBLE*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getValueTwo() : String {
|
fun getValueTwo() : String {
|
||||||
return custom_dialog_value_two.text.toString()
|
return binding.customDialogValueTwo.text.toString()
|
||||||
|
//return custom_dialog_value_two.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setValueTwo(value : String): CustomDialogList{
|
fun setValueTwo(value : String): CustomDialogList{
|
||||||
custom_dialog_value_two.setText(value)
|
binding.customDialogValueTwo.setText(value)
|
||||||
textinputlayout_two.visibility = View.VISIBLE
|
binding.textinputlayoutTwo.visibility=View.VISIBLE
|
||||||
|
|
||||||
|
/* custom_dialog_value_two.setText(value)
|
||||||
|
textinputlayout_two.visibility = View.VISIBLE*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setTitle(title: String): CustomDialogList {
|
fun setTitle(title: String): CustomDialogList {
|
||||||
custom_dialog_title.visibility = View.VISIBLE
|
binding.customDialogTitle.visibility=View.VISIBLE
|
||||||
custom_dialog_title.text = title
|
binding.customDialogTitle.text=title
|
||||||
|
/* custom_dialog_title.visibility = View.VISIBLE
|
||||||
|
custom_dialog_title.text = title*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDescription(title: String): CustomDialogList {
|
fun setDescription(title: String): CustomDialogList {
|
||||||
custom_dialog_description.visibility = View.VISIBLE
|
binding.customDialogDescription.visibility=View.VISIBLE
|
||||||
custom_dialog_description.text = title
|
binding.customDialogDescription.text=title
|
||||||
|
|
||||||
|
/*custom_dialog_description.visibility = View.VISIBLE
|
||||||
|
custom_dialog_description.text = title*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
||||||
custom_dialog_button_ok.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonOk.visibility=View.VISIBLE
|
||||||
|
binding.customDialogButtonOk.text=text
|
||||||
|
|
||||||
|
/*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() }*/
|
||||||
|
binding.customDialogButtonOk.setOnClickListener { onButtonClicked() }
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
||||||
custom_dialog_button_ko.visibility = View.VISIBLE
|
|
||||||
custom_dialog_button_ko.text = text
|
binding.customDialogButtonKo.visibility=View.VISIBLE
|
||||||
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
|
binding.customDialogButtonKo.text=text
|
||||||
|
/*custom_dialog_button_ko.visibility = View.VISIBLE
|
||||||
|
custom_dialog_button_ko.text = text*/
|
||||||
|
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
|
||||||
|
// custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setHintValue(text:String): CustomDialogList{
|
fun setHintValue(text:String): CustomDialogList{
|
||||||
custom_dialog_value.hint = text
|
|
||||||
|
binding.customDialogValue.hint=text
|
||||||
|
// custom_dialog_value.hint = text
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setHintValueTwo(text:String): CustomDialogList{
|
fun setHintValueTwo(text:String): CustomDialogList{
|
||||||
custom_dialog_value_two.hint = text
|
binding.customDialogValueTwo.hint=text
|
||||||
|
//custom_dialog_value_two.hint = text
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setTextTwoGone():CustomDialogList{
|
fun setTextTwoGone():CustomDialogList{
|
||||||
textinputlayout_two.visibility = View.GONE
|
binding.textinputlayoutTwo.visibility = View.GONE
|
||||||
|
//textinputlayout_two.visibility = View.GONE
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hideDialog():CustomDialogList{
|
fun hideDialog():CustomDialogList{
|
||||||
custom_dialog_value.visibility = View.GONE
|
binding.customDialogValue.visibility = View.GONE
|
||||||
|
//custom_dialog_value.visibility = View.GONE
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package es.verdnatura.presentation.view.component
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.View
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.databinding.ComponentCustomDialogBinding
|
||||||
|
import kotlinx.android.synthetic.main.component_custom_dialog.*
|
||||||
|
|
||||||
|
private lateinit var binding: ComponentCustomDialogBinding
|
||||||
|
|
||||||
|
class CustomDialogMainActivity(context: Context) : Dialog(context, R.style.DialogTheme) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
//sergio: de momento se deja el componentDialogMainActivity porque no acaba de funciona bien
|
||||||
|
// con el viewbinding del customDialog
|
||||||
|
|
||||||
|
setContentView(R.layout.component_custom_dialog)
|
||||||
|
|
||||||
|
/* binding = ComponentCustomDialogBinding.inflate(layoutInflater)
|
||||||
|
setContentView(binding.root)*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setTitle(title: String): CustomDialogMainActivity {
|
||||||
|
custom_dialog_title.visibility = View.VISIBLE
|
||||||
|
custom_dialog_title.text = title
|
||||||
|
/* binding.customDialogTitle.visibility = View.VISIBLE
|
||||||
|
binding.customDialogTitle.text = title*/
|
||||||
|
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setDescription(description: String): CustomDialogMainActivity {
|
||||||
|
custom_dialog_description.visibility = View.VISIBLE
|
||||||
|
custom_dialog_description.text = description
|
||||||
|
/*binding.customDialogDescription.visibility = View.VISIBLE
|
||||||
|
binding.customDialogDescription.text = description*/
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogMainActivity {
|
||||||
|
custom_dialog_button_ok.visibility = View.VISIBLE
|
||||||
|
custom_dialog_button_ok.text = text
|
||||||
|
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }
|
||||||
|
/* binding.customDialogButtonOk.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonOk.text = text
|
||||||
|
binding.customDialogButtonOk.setOnClickListener { onButtonClicked() }*/
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogMainActivity {
|
||||||
|
custom_dialog_button_ko.visibility = View.VISIBLE
|
||||||
|
custom_dialog_button_ko.text = text
|
||||||
|
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
|
||||||
|
/* binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonKo.text = text
|
||||||
|
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }*/
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,86 +5,129 @@ import android.content.Context
|
||||||
import android.view.View
|
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 kotlinx.android.synthetic.main.component_custom_three_dialog.*
|
import es.verdnatura.databinding.ComponentCustomThreeDialogBinding
|
||||||
import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_button_ko
|
|
||||||
import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_button_ok
|
|
||||||
import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_button_ok_two
|
|
||||||
import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_description
|
|
||||||
import kotlinx.android.synthetic.main.component_custom_two_dialog.custom_dialog_title
|
|
||||||
|
|
||||||
class CustomDialogThreeButtons (context: Context) : Dialog(context, R.style.DialogTheme) {
|
class CustomDialogThreeButtons (context: Context) : Dialog(context, R.style.DialogTheme) {
|
||||||
|
|
||||||
|
private var binding: ComponentCustomThreeDialogBinding = ComponentCustomThreeDialogBinding.inflate(layoutInflater)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setContentView(R.layout.component_custom_three_dialog)
|
|
||||||
|
setContentView(binding.root)
|
||||||
|
//setContentView(R.layout.component_custom_three_dialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setTitle(title: String): CustomDialogThreeButtons {
|
fun setTitle(title: String): CustomDialogThreeButtons {
|
||||||
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
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDescription(description: String): CustomDialogThreeButtons {
|
fun setDescription(description: String): CustomDialogThreeButtons {
|
||||||
custom_dialog_description.visibility = View.VISIBLE
|
binding.customDialogDescription.visibility= View.VISIBLE
|
||||||
custom_dialog_description.text = description
|
binding.customDialogDescription.text=description
|
||||||
|
|
||||||
|
/* custom_dialog_description.visibility = View.VISIBLE
|
||||||
|
custom_dialog_description.text = description*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
||||||
custom_dialog_button_ok.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonOk.visibility = View.VISIBLE
|
||||||
|
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.text = text
|
||||||
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun getValue() : String {
|
fun getValue() : String {
|
||||||
return custom_dialog_value.text.toString()
|
return binding.customDialogValue.text.toString()
|
||||||
|
//return custom_dialog_value.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEditText() : TextInputEditText {
|
fun getEditText() : TextInputEditText {
|
||||||
return custom_dialog_value
|
return binding.customDialogValue
|
||||||
|
//return custom_dialog_value
|
||||||
}
|
}
|
||||||
fun setValue(value : String): CustomDialogThreeButtons{
|
fun setValue(value : String): CustomDialogThreeButtons{
|
||||||
custom_dialog_value.setText(value)
|
|
||||||
textinputlayout.visibility = View.VISIBLE
|
binding.customDialogValue.setText(value)
|
||||||
|
binding.textinputlayout.visibility = View.VISIBLE
|
||||||
|
/* custom_dialog_value.setText(value)
|
||||||
|
textinputlayout.visibility = View.VISIBLE*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkButtonTwo(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
fun setOkButtonTwo(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
||||||
custom_dialog_button_ok_two.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonOkTwo.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonOkTwo.text = text
|
||||||
|
binding.customDialogButtonOkTwo.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
|
/* custom_dialog_button_ok_two.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ok_two.text = text
|
custom_dialog_button_ok_two.text = text
|
||||||
custom_dialog_button_ok_two.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ok_two.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkButtonThree(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
fun setOkButtonThree(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
||||||
custom_dialog_button_ok_three.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonOkThree.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonOkThree.text = text
|
||||||
|
binding.customDialogButtonOkThree.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
|
/* custom_dialog_button_ok_three.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ok_three.text = text
|
custom_dialog_button_ok_three.text = text
|
||||||
custom_dialog_button_ok_three.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ok_three.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkButtonFour(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
fun setOkButtonFour(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
||||||
custom_dialog_button_ok_four.visibility = View.VISIBLE
|
binding.customDialogButtonOkFour.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonOkFour.text = text
|
||||||
|
binding.customDialogButtonOkFour.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
|
/* custom_dialog_button_ok_four.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ok_four.text = text
|
custom_dialog_button_ok_four.text = text
|
||||||
custom_dialog_button_ok_four.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ok_four.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkButtonAdd(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
fun setOkButtonAdd(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
||||||
custom_dialog_button_add.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonAdd.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonAdd.text = text
|
||||||
|
binding.customDialogButtonAdd.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
|
/* custom_dialog_button_add.visibility = View.VISIBLE
|
||||||
custom_dialog_button_add.text = text
|
custom_dialog_button_add.text = text
|
||||||
custom_dialog_button_add.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_add.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
|
||||||
custom_dialog_button_ko.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonKo.text = text
|
||||||
|
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
|
/* custom_dialog_button_ko.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ko.text = text
|
custom_dialog_button_ko.text = text
|
||||||
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setCustomDialogValue(visibility:Int){
|
||||||
|
binding.customDialogValue.visibility=visibility
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,45 +4,72 @@ import android.app.Dialog
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import kotlinx.android.synthetic.main.component_custom_two_dialog.*
|
import es.verdnatura.databinding.ComponentCustomTwoDialogBinding
|
||||||
|
//import kotlinx.android.synthetic.main.component_custom_two_dialog.*
|
||||||
|
|
||||||
class CustomDialogTwoButtons (context: Context) : Dialog(context, R.style.DialogTheme) {
|
class CustomDialogTwoButtons (context: Context) : Dialog(context, R.style.DialogTheme) {
|
||||||
|
|
||||||
|
private var binding: ComponentCustomTwoDialogBinding= ComponentCustomTwoDialogBinding.inflate(layoutInflater)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setContentView(R.layout.component_custom_two_dialog)
|
|
||||||
|
setContentView(binding.root)
|
||||||
|
//setContentView(R.layout.component_custom_two_dialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setTitle(title: String): CustomDialogTwoButtons {
|
fun setTitle(title: String): CustomDialogTwoButtons {
|
||||||
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
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDescription(description: String): CustomDialogTwoButtons {
|
fun setDescription(description: String): CustomDialogTwoButtons {
|
||||||
custom_dialog_description.visibility = View.VISIBLE
|
|
||||||
custom_dialog_description.text = description
|
binding.customDialogDescription.visibility= View.VISIBLE
|
||||||
|
binding.customDialogDescription.text=description
|
||||||
|
/* custom_dialog_description.visibility = View.VISIBLE
|
||||||
|
custom_dialog_description.text = description*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {
|
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {
|
||||||
custom_dialog_button_ok.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonOk.visibility = View.VISIBLE
|
||||||
|
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.text = text
|
||||||
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkButtonTwo(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {
|
fun setOkButtonTwo(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {
|
||||||
custom_dialog_button_ok_two.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonOkTwo.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonOkTwo.text = text
|
||||||
|
binding.customDialogButtonOkTwo.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
|
/* custom_dialog_button_ok_two.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ok_two.text = text
|
custom_dialog_button_ok_two.text = text
|
||||||
custom_dialog_button_ok_two.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ok_two.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {
|
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {
|
||||||
custom_dialog_button_ko.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonKo.text =text
|
||||||
|
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
|
/*custom_dialog_button_ko.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ko.text = text
|
custom_dialog_button_ko.text = text
|
||||||
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,101 +5,150 @@ import android.content.Context
|
||||||
import android.view.View
|
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 kotlinx.android.synthetic.main.component_custom_ubicador_dialog.*
|
import es.verdnatura.databinding.ComponentCustomUbicadorDialogBinding
|
||||||
|
|
||||||
|
//import kotlinx.android.synthetic.main.component_custom_ubicador_dialog.*
|
||||||
|
|
||||||
class CustomDialogUbicador (context: Context) : Dialog(context, R.style.DialogTheme) {
|
class CustomDialogUbicador (context: Context) : Dialog(context, R.style.DialogTheme) {
|
||||||
|
|
||||||
|
private var binding: ComponentCustomUbicadorDialogBinding = ComponentCustomUbicadorDialogBinding.inflate(layoutInflater)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setContentView(R.layout.component_custom_ubicador_dialog)
|
|
||||||
|
setContentView(binding.root)
|
||||||
|
//setContentView(R.layout.component_custom_ubicador_dialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setTitle(title: String): CustomDialogUbicador {
|
fun setTitle(title: String): CustomDialogUbicador {
|
||||||
custom_dialog_title.visibility = View.VISIBLE
|
binding.customDialogTitle.visibility= View.VISIBLE
|
||||||
custom_dialog_title.text = title
|
binding.customDialogTitle.text=title
|
||||||
|
/*custom_dialog_title.visibility = View.VISIBLE
|
||||||
|
custom_dialog_title.text = title*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setItemValue(value : String) : CustomDialogUbicador{
|
fun setItemValue(value : String) : CustomDialogUbicador{
|
||||||
custom_dialog_item.setText(value)
|
binding.customDialogItem.setText(value)
|
||||||
custom_dialog_item.visibility = View.VISIBLE
|
binding.customDialogItem.visibility=View.VISIBLE
|
||||||
|
|
||||||
|
/*custom_dialog_item.setText(value)
|
||||||
|
custom_dialog_item.visibility = View.VISIBLE*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getItemValue() : String{
|
fun getItemValue() : String{
|
||||||
return custom_dialog_item.text.toString()
|
|
||||||
|
return binding.customDialogItem.text.toString()
|
||||||
|
|
||||||
|
// return custom_dialog_item.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEditItem() : TextInputEditText {
|
fun getEditItem() : TextInputEditText {
|
||||||
return custom_dialog_item
|
|
||||||
|
return binding.customDialogItem
|
||||||
|
//return custom_dialog_item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setEtiquetaValue(value : String) : CustomDialogUbicador{
|
fun setEtiquetaValue(value : String) : CustomDialogUbicador{
|
||||||
custom_dialog_etiquetas.setText(value)
|
|
||||||
custom_dialog_etiquetas.visibility = View.VISIBLE
|
binding.customDialogEtiquetas.setText(value)
|
||||||
|
binding.customDialogEtiquetas.visibility = View.VISIBLE
|
||||||
|
/* custom_dialog_etiquetas.setText(value)
|
||||||
|
custom_dialog_etiquetas.visibility = View.VISIBLE*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEtiquetaValue() : String{
|
fun getEtiquetaValue() : String{
|
||||||
return custom_dialog_etiquetas.text.toString()
|
return binding.customDialogEtiquetas.text.toString()
|
||||||
|
//return custom_dialog_etiquetas.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEtiquetaItem() : TextInputEditText {
|
fun getEtiquetaItem() : TextInputEditText {
|
||||||
return custom_dialog_etiquetas
|
|
||||||
|
return binding.customDialogEtiquetas
|
||||||
|
//return custom_dialog_etiquetas
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setPackingValue(value : String) : CustomDialogUbicador{
|
fun setPackingValue(value : String) : CustomDialogUbicador{
|
||||||
custom_dialog_packing.setText(value)
|
|
||||||
custom_dialog_packing.visibility = View.VISIBLE
|
binding.customDialogPacking.setText(value)
|
||||||
|
binding.customDialogPacking.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
/* custom_dialog_packing.setText(value)
|
||||||
|
custom_dialog_packing.visibility = View.VISIBLE*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setGroupingValue(value:String):CustomDialogUbicador{
|
fun setGroupingValue(value:String):CustomDialogUbicador{
|
||||||
custom_dialog_grouping.setText(value)
|
binding.customDialogGrouping.setText(value)
|
||||||
custom_dialog_grouping.visibility = View.VISIBLE
|
binding.customDialogGrouping.visibility = View.VISIBLE
|
||||||
|
/*custom_dialog_grouping.setText(value)
|
||||||
|
custom_dialog_grouping.visibility = View.VISIBLE*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
fun getGroupingValue() : String{
|
fun getGroupingValue() : String{
|
||||||
return custom_dialog_grouping.text.toString()
|
return binding.customDialogGrouping.text.toString()
|
||||||
|
//return custom_dialog_grouping.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPackingValue() : String{
|
fun getPackingValue() : String{
|
||||||
return custom_dialog_packing.text.toString()
|
return binding.customDialogPacking.text.toString()
|
||||||
|
// return custom_dialog_packing.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPackingItem() : TextInputEditText {
|
fun getPackingItem() : TextInputEditText {
|
||||||
return custom_dialog_packing
|
return binding.customDialogPacking
|
||||||
|
//return custom_dialog_packing
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setVisibleValue(value : String) : CustomDialogUbicador{
|
fun setVisibleValue(value : String) : CustomDialogUbicador{
|
||||||
custom_dialog_visible.setText(value)
|
|
||||||
custom_dialog_visible.visibility = View.VISIBLE
|
binding.customDialogVisible.setText(value)
|
||||||
|
binding.customDialogVisible.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
/* custom_dialog_visible.setText(value)
|
||||||
|
custom_dialog_visible.visibility = View.VISIBLE*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getVisibleValue() : String{
|
fun getVisibleValue() : String{
|
||||||
return custom_dialog_visible.text.toString()
|
|
||||||
|
return binding.customDialogVisible.text.toString()
|
||||||
|
//return custom_dialog_visible.text.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getVisibleItem() : TextInputEditText {
|
fun getVisibleItem() : TextInputEditText {
|
||||||
return custom_dialog_visible
|
return binding.customDialogVisible
|
||||||
|
|
||||||
|
//return custom_dialog_visible
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogUbicador {
|
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogUbicador {
|
||||||
custom_dialog_button_ok.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonOk.visibility = View.VISIBLE
|
||||||
|
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.text = text
|
||||||
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogUbicador {
|
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogUbicador {
|
||||||
custom_dialog_button_ko.visibility = View.VISIBLE
|
|
||||||
|
binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonKo.text = text
|
||||||
|
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
|
||||||
|
|
||||||
|
/* custom_dialog_button_ko.visibility = View.VISIBLE
|
||||||
custom_dialog_button_ko.text = text
|
custom_dialog_button_ko.text = text
|
||||||
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
|
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }*/
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||||
|
|
||||||
|
//import android.preference.PreferenceManager
|
||||||
|
//import kotlinx.android.synthetic.main.activity_main.*
|
||||||
|
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
|
@ -7,12 +10,10 @@ import android.content.Context
|
||||||
import android.content.Context.CLIPBOARD_SERVICE
|
import android.content.Context.CLIPBOARD_SERVICE
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
//import android.preference.PreferenceManager
|
|
||||||
import androidx.preference.PreferenceManager
|
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.lifecycle.Observer
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentAjustesBinding
|
import es.verdnatura.databinding.FragmentAjustesBinding
|
||||||
|
@ -26,11 +27,9 @@ import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.view.*
|
||||||
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_ajustes.splash_progress
|
//import kotlinx.android.synthetic.main.fragment_login.*
|
||||||
import kotlinx.android.synthetic.main.fragment_login.*
|
|
||||||
import timber.log.Timber
|
|
||||||
|
|
||||||
class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(AjustesViewModel::class) {
|
class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(AjustesViewModel::class) {
|
||||||
|
|
||||||
|
@ -51,34 +50,56 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
||||||
}
|
}
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_ajustes
|
override fun getLayoutId(): Int = R.layout.fragment_ajustes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
|
// binding=FragmentAjustesBinding.inflate(inflater,container,false)
|
||||||
|
//val view=binding.root
|
||||||
|
//return view
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState)
|
||||||
|
}*/
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
prefs = requireActivity().getSharedPreferences(PREFS_USER,0)
|
prefs = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
|
// binding = DataBindingUtil.setContentView(requireActivity(), R.layout.activity_main)
|
||||||
|
|
||||||
|
|
||||||
//modificat el InitilializeAjusts
|
//modificat el InitilializeAjusts
|
||||||
viewModel.inititializeDefaultAjusts(prefs!!.getString(SECTORDESCRIP,getString(R.string.Sinsector)).toString(),prefs!!.getInt(SECTORFK,0),prefs!!.getInt(WAREHOUSEFK,0),prefs!!.getString(VOZ,"NO").toString(),prefs!!.getInt(WAGON,2).toString(),prefs!!.getString(TAGSTYPE,"Stickers").toString())
|
viewModel.inititializeDefaultAjusts(prefs!!.getString(SECTORDESCRIP,getString(R.string.Sinsector)).toString(),prefs!!.getInt(SECTORFK,0),prefs!!.getInt(WAREHOUSEFK,0),prefs!!.getString(VOZ,"NO").toString(),prefs!!.getInt(WAGON,2).toString(),prefs!!.getString(TAGSTYPE,"Stickers").toString())
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
requireActivity().main_bottom_navigation.visibility = View.VISIBLE
|
//ActivityMainBinding.bind(main_bottom_navigation).mainBottomNavigation.visibility=View.VISIBLE
|
||||||
user_text.setText(prefs!!.getString(USERFK,""))
|
(activity as MainActivity).hideBottomNavigation(View.VISIBLE)
|
||||||
|
//requireActivity().main_bottom_navigation.visibility = View.VISIBLE
|
||||||
|
binding.userText.setText(prefs!!.getString(USERFK,""))
|
||||||
|
//user_text.setText(prefs!!.getString(USERFK,""))
|
||||||
val versionName = requireActivity().packageManager.getPackageInfo(requireActivity().packageName,0).versionName!!
|
val versionName = requireActivity().packageManager.getPackageInfo(requireActivity().packageName,0).versionName!!
|
||||||
item_version.setText(versionName)
|
binding.itemVersion.setText(versionName)
|
||||||
|
//item_version.setText(versionName)
|
||||||
user = prefs!!.getString(USER,"")
|
user = prefs!!.getString(USER,"")
|
||||||
userFk =prefs!!.getString(USERFK,"")
|
userFk =prefs!!.getString(USERFK,"")
|
||||||
password = prefs!!.getString(PASSWORD,"")
|
password = prefs!!.getString(PASSWORD,"")
|
||||||
androidid_text.setText(Settings.Secure.getString(context?.contentResolver, Settings.Secure.ANDROID_ID))
|
binding.androididText.setText(Settings.Secure.getString(context?.contentResolver, Settings.Secure.ANDROID_ID))
|
||||||
|
//androidid_text.setText(Settings.Secure.getString(context?.contentResolver, Settings.Secure.ANDROID_ID))
|
||||||
|
|
||||||
|
binding.txtserver.setText(this.getDefaults("base_url",this.requireContext()))
|
||||||
txtserver.setText(this.getDefaults("base_url",this.requireContext()))
|
//txtserver.setText(this.getDefaults("base_url",this.requireContext()))
|
||||||
txtserver.setOnKeyListener(View.OnKeyListener { v, keyCode, event ->
|
binding.txtserver.setOnKeyListener(View.OnKeyListener { v, keyCode, event ->
|
||||||
|
//binding.txtserver.setOnKeyListener((View.OnKeyListener { v, keyCode, event ->
|
||||||
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
|
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
|
||||||
this.setDefaults("base_url",txtserver.text.toString(),this.requireContext())
|
//this.setDefaults("base_url",txtserver.text.toString(),this.requireContext())
|
||||||
|
this.setDefaults("base_url",binding.txtserver.toString(),this.requireContext())
|
||||||
// sergio: se comenta línea de abajo porque da fallo en la app//
|
// sergio: se comenta línea de abajo porque da fallo en la app//
|
||||||
// this.setDefaults("base_url", edittext_server.text.toString(), this.requireContext())
|
// this.setDefaults("base_url", edittext_server.text.toString(), this.requireContext())
|
||||||
this.hideKeyboard()
|
this.hideKeyboard()
|
||||||
|
@ -99,8 +120,11 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setEvents() {
|
fun setEvents() {
|
||||||
androidid_text.setOnClickListener { copyanddrag(androidid_text.text.toString()) }
|
binding.androididText.setOnClickListener{copyanddrag(binding.androididText.text.toString()) }
|
||||||
androidid_text.setOnLongClickListener { copyanddrag(androidid_text.text.toString()) }
|
binding.androididText.setOnLongClickListener{copyanddrag(binding.androididText.text.toString()) }
|
||||||
|
|
||||||
|
/*androidid_text.setOnClickListener { copyanddrag(androidid_text.text.toString()) }
|
||||||
|
androidid_text.setOnLongClickListener { copyanddrag(androidid_text.text.toString()) }*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +133,8 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
||||||
ajustesAdapter = AjustesAdapter(ajustesitem,object: OnAjustesItemClickListener{
|
ajustesAdapter = AjustesAdapter(ajustesitem,object: OnAjustesItemClickListener{
|
||||||
override fun onAjustesItemClickListener(item: AjustesItemVO) {
|
override fun onAjustesItemClickListener(item: AjustesItemVO) {
|
||||||
if (item.id == 0){
|
if (item.id == 0){
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
|
//splash_progress.visibility = View.VISIBLE
|
||||||
viewModel.getSectors(user!!,password!!)
|
viewModel.getSectors(user!!,password!!)
|
||||||
} else if (item.id == 5){
|
} else if (item.id == 5){
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
|
@ -150,12 +175,15 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
ajustess_items.adapter = ajustesAdapter
|
binding.ajustessItems.adapter=ajustesAdapter
|
||||||
ajustess_items.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
binding.ajustessItems.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
//austess_items.adapter = ajustesAdapter
|
||||||
|
//ajustess_items.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
loadSectorList.observe(viewLifecycleOwner, { event ->
|
loadSectorList.observe(viewLifecycleOwner, { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
splash_progress.visibility = View.INVISIBLE
|
binding.splashProgress.visibility = View.INVISIBLE
|
||||||
|
//splash_progress.visibility = View.INVISIBLE
|
||||||
if (it.list.isNotEmpty() && it.list.get(0).isError){
|
if (it.list.isNotEmpty() && it.list.get(0).isError){
|
||||||
customDialog.setTitle("Error").setDescription(it.list.get(0).errorMessage).setOkButton(getString(R.string.Close)){
|
customDialog.setTitle("Error").setDescription(it.list.get(0).errorMessage).setOkButton(getString(R.string.Close)){
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
|
|
|
@ -35,11 +35,11 @@ import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActiv
|
||||||
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
/*import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.buyers_fragment.*
|
import kotlinx.android.synthetic.main.buyers_fragment.*
|
||||||
import kotlinx.android.synthetic.main.fragment_item_card.*
|
import kotlinx.android.synthetic.main.fragment_item_card.*
|
||||||
import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
|
import kotlinx.android.synthetic.main.fragment_item_card.binding.splashProgress
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
import kotlinx.android.synthetic.main.toolbar.**/
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
class ItemCardFragment(
|
class ItemCardFragment(
|
||||||
|
@ -69,18 +69,19 @@ class ItemCardFragment(
|
||||||
private lateinit var customDialogList: CustomDialogList
|
private lateinit var customDialogList: CustomDialogList
|
||||||
private lateinit var customDialogTwo: CustomDialogTwoButtons
|
private lateinit var customDialogTwo: CustomDialogTwoButtons
|
||||||
|
|
||||||
/*private val _buyersList by lazy { MutableLiveData<BuyerListVO>() }
|
|
||||||
val buyersList: LiveData<BuyerListVO>
|
|
||||||
get() = _buyersList*/
|
|
||||||
|
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_item_card
|
override fun getLayoutId(): Int = R.layout.fragment_item_card
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
itemcard_layout.visibility = View.GONE
|
//binding.itemcardLayout.visibility = View.GONE
|
||||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
binding.itemcardLayout.visibility=View.GONE
|
||||||
|
//requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||||
|
(activity as MainActivity).hideBottomNavigation(View.GONE)
|
||||||
|
|
||||||
setEvents()
|
setEvents()
|
||||||
toolbar_title.text = getString(R.string.ConsultarArticulo)
|
//toolbar_title.text = getString(R.string.ConsultarArticulo)
|
||||||
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.ConsultarArticulo)
|
||||||
|
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
customDialogList = CustomDialogList(requireContext())
|
customDialogList = CustomDialogList(requireContext())
|
||||||
|
@ -104,10 +105,13 @@ class ItemCardFragment(
|
||||||
val iconHistory : Drawable = resources.getDrawable(R.drawable.ic_history_black_24dp,resources.newTheme())
|
val iconHistory : Drawable = resources.getDrawable(R.drawable.ic_history_black_24dp,resources.newTheme())
|
||||||
listIcons.add(iconReload)
|
listIcons.add(iconReload)
|
||||||
listIcons.add(iconHistory)
|
listIcons.add(iconHistory)
|
||||||
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
//toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||||
|
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
if (item == iconReload){
|
if (item == iconReload){
|
||||||
splash_progress.visibility = View.VISIBLE
|
// binding.splashProgress.visibility = View.VISIBLE
|
||||||
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
getItemCard(itemFk)
|
getItemCard(itemFk)
|
||||||
}
|
}
|
||||||
if (item == iconHistory){
|
if (item == iconHistory){
|
||||||
|
@ -124,28 +128,35 @@ class ItemCardFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
//toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
|
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEvents(){
|
private fun setEvents(){
|
||||||
edit_itemFk.requestFocus()
|
//edit_itemFk.requestFocus()
|
||||||
edit_itemFk.setOnEditorActionListener { v, actionId, event ->
|
binding.editItemFk.requestFocus()
|
||||||
|
//edit_itemFk.setOnEditorActionListener { v, actionId, event ->
|
||||||
|
binding.editItemFk.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
if (!edit_itemFk.text.toString().isNullOrEmpty())
|
//if (!edit_itemFk.text.toString().isNullOrEmpty())
|
||||||
getItemCard(edit_itemFk.text.toString())
|
if (!binding.editItemFk.text.toString().isNullOrEmpty())
|
||||||
edit_itemFk.setText("")
|
getItemCard(binding.editItemFk.text.toString())
|
||||||
(activity as MainActivity).hideKeyboard(edit_itemFk)
|
binding.editItemFk.setText("")
|
||||||
|
(activity as MainActivity).hideKeyboard(binding.editItemFk)
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//backButton.setOnClickListener {
|
||||||
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
|
|
||||||
backButton.setOnClickListener {
|
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
itemcard_image.setOnClickListener {
|
//itemcard_image.setOnClickListener {
|
||||||
|
binding.itemcardImage.setOnClickListener{
|
||||||
|
|
||||||
val i:Intent = Intent(activity,ImageViewActivity::class.java)
|
val i:Intent = Intent(activity,ImageViewActivity::class.java)
|
||||||
i.putExtra("url",urlLarge)
|
i.putExtra("url",urlLarge)
|
||||||
i.putExtra("title",titleImage)
|
i.putExtra("title",titleImage)
|
||||||
|
@ -159,7 +170,7 @@ class ItemCardFragment(
|
||||||
password = prefs.getString(PASSWORD,"").toString()
|
password = prefs.getString(PASSWORD,"").toString()
|
||||||
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||||
this.itemFk = itemFk
|
this.itemFk = itemFk
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.getItemCard(itemFk,warehouseFk,user,password,"item_card")
|
viewModel.getItemCard(itemFk,warehouseFk,user,password,"item_card")
|
||||||
viewModel.getItemPackingType(user,password,"get_ItemPackingType")
|
viewModel.getItemPackingType(user,password,"get_ItemPackingType")
|
||||||
}
|
}
|
||||||
|
@ -167,20 +178,20 @@ class ItemCardFragment(
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel){
|
with(viewModel){
|
||||||
itemcard.observe(viewLifecycleOwner, Observer {
|
itemcard.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
if (it.isError){
|
if (it.isError){
|
||||||
itemcard_layout.visibility = View.GONE
|
binding.itemcardLayout.visibility = View.GONE
|
||||||
toolbar_title.text = "ItemCard"
|
binding.mainToolbar.toolbarTitle.text = "ItemCard"
|
||||||
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
}else{
|
}else{
|
||||||
if (it.id != "0"){
|
if (it.id != "0"){
|
||||||
itemcard_layout.visibility = View.VISIBLE
|
binding.itemcardLayout.visibility = View.VISIBLE
|
||||||
setItemCard(it)
|
setItemCard(it)
|
||||||
}else{
|
}else{
|
||||||
itemcard_layout.visibility = View.GONE
|
binding.itemcardLayout.visibility = View.GONE
|
||||||
toolbar_title.text = "ItemCard"
|
binding.mainToolbar.toolbarTitle.text = "ItemCard"
|
||||||
customDialog.setTitle("Sin resultados").setDescription("No hemos podido encontrar el articulo. Revisa el sector.").setOkButton("Cerrar"){
|
customDialog.setTitle("Sin resultados").setDescription("No hemos podido encontrar el articulo. Revisa el sector.").setOkButton("Cerrar"){
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
|
@ -190,14 +201,14 @@ class ItemCardFragment(
|
||||||
})
|
})
|
||||||
|
|
||||||
itemspackinglist.observe(viewLifecycleOwner, Observer {
|
itemspackinglist.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
// //Log.i("VERDNATURA:","el code es $it.code")
|
// //Log.i("VERDNATURA:","el code es $it.code")
|
||||||
// //Log.i("VERDNATURA:","la descrip es $it.description")
|
// //Log.i("VERDNATURA:","la descrip es $it.description")
|
||||||
createItemTypeTypeList(it.list)
|
createItemTypeTypeList(it.list)
|
||||||
})
|
})
|
||||||
|
|
||||||
response.observe(viewLifecycleOwner, Observer {
|
response.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
if (it.isError){
|
if (it.isError){
|
||||||
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
|
@ -226,15 +237,15 @@ class ItemCardFragment(
|
||||||
|
|
||||||
private fun setItemCard(itemInfo:ItemCardVO){
|
private fun setItemCard(itemInfo:ItemCardVO){
|
||||||
itemInfoG = itemInfo
|
itemInfoG = itemInfo
|
||||||
toolbar_title.text = itemInfo.id+"-"+itemInfo.longName
|
binding.mainToolbar.toolbarTitle.text = itemInfo.id+"-"+itemInfo.longName
|
||||||
titleImage = itemInfo.id+"-"+itemInfo.longName
|
titleImage = itemInfo.id+"-"+itemInfo.longName
|
||||||
itemcard_image.setImageDrawable(resources.getDrawable(R.drawable.loadphoto,resources.newTheme()))
|
// binding.itemcardImage.setImageDrawable(resources.getDrawable(R.drawable.loadphoto,resources.newTheme()))
|
||||||
itemcard_image.loadUrl(itemInfo.urlImage200)
|
binding.itemcardImage.loadUrl(itemInfo.urlImage200)
|
||||||
urlLarge = itemInfo.urlImage
|
urlLarge = itemInfo.urlImage
|
||||||
itemcard_tag1.text = itemInfo.size
|
binding.itemcardTag1.text = itemInfo.size
|
||||||
itemcard_tag2.text = itemInfo.value5
|
binding.itemcardTag2.text = itemInfo.value5
|
||||||
itemcard_tag3.text = itemInfo.value6
|
binding.itemcardTag3.text = itemInfo.value6
|
||||||
itemcard_tag4.text = itemInfo.value7 + " " + itemInfo.origin
|
binding.itemcardTag4.text = itemInfo.value7 + " " + itemInfo.origin
|
||||||
listItemsRow = ArrayList()
|
listItemsRow = ArrayList()
|
||||||
listItemsRow.add(ItemCardRowVO(title = getString(R.string.total),value = itemInfo.total,isEditable = false))
|
listItemsRow.add(ItemCardRowVO(title = getString(R.string.total),value = itemInfo.total,isEditable = false))
|
||||||
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Disponible),value = itemInfo.available,isEditable = false))
|
listItemsRow.add(ItemCardRowVO(title = getString(R.string.Disponible),value = itemInfo.available,isEditable = false))
|
||||||
|
@ -367,14 +378,15 @@ class ItemCardFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
itemcard_recyclerview.adapter = adapter
|
//itemcard_recyclerview.adapter = adapter
|
||||||
itemcard_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
binding.itemcardRecyclerview.adapter = adapter
|
||||||
|
//itemcard_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
scroll_view.post({
|
binding.itemcardRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
binding.scrollView.post({
|
||||||
val position = IntArray(2)
|
val position = IntArray(2)
|
||||||
if (itemcard_image != null){
|
if (binding.itemcardImage != null){
|
||||||
itemcard_image.getLocationInWindow(position)
|
binding.itemcardImage.getLocationInWindow(position)
|
||||||
scroll_view.scrollTo(0, position[1])
|
binding.scrollView.scrollTo(0, position[1])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -389,7 +401,7 @@ class ItemCardFragment(
|
||||||
"itemStockUpdateRemove" -> prepareItemStockUpdate2(item,value)
|
"itemStockUpdateRemove" -> prepareItemStockUpdate2(item,value)
|
||||||
"itemPlacementSave" -> viewModel.itemPlacementSave(itemFk = itemFk, warehouseFk = warehouseFk, user = user, password = password, value = value,"itemPlacementSave")
|
"itemPlacementSave" -> viewModel.itemPlacementSave(itemFk = itemFk, warehouseFk = warehouseFk, user = user, password = password, value = value,"itemPlacementSave")
|
||||||
"updateGrouping" -> viewModel.updateGrouping(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk,"buy_updateGrouping")
|
"updateGrouping" -> viewModel.updateGrouping(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk,"buy_updateGrouping")
|
||||||
"updatePacking" -> viewModel.updatePacking(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk,"buy_updateGrouping")
|
"updatePacking" -> viewModel.updatePacking(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk,"buy_updatePacking")
|
||||||
"itemSaveMin" -> viewModel.itemSaveMin(itemFk = itemFk, user = user, password = password, value = value,"itemSaveMin")
|
"itemSaveMin" -> viewModel.itemSaveMin(itemFk = itemFk, user = user, password = password, value = value,"itemSaveMin")
|
||||||
"item_saveReference"->viewModel.item_saveReference(itemFk = itemFk, user = user, password = password, value = value,"item_saveReference")
|
"item_saveReference"->viewModel.item_saveReference(itemFk = itemFk, user = user, password = password, value = value,"item_saveReference")
|
||||||
|
|
||||||
|
@ -403,12 +415,12 @@ class ItemCardFragment(
|
||||||
//sergio: changeOffLineValue solo hace visible el progress
|
//sergio: changeOffLineValue solo hace visible el progress
|
||||||
|
|
||||||
private fun showProgress(){
|
private fun showProgress(){
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private fun changeOfflineValue(item:ItemCardRowVO,newValue:String, barcodes:List<BarcodeVO>){
|
/* private fun changeOfflineValue(item:ItemCardRowVO,newValue:String, barcodes:List<BarcodeVO>){
|
||||||
|
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
|
|
||||||
//sergio: esta parte ya estaba comentada
|
//sergio: esta parte ya estaba comentada
|
||||||
/*var i = 0
|
/*var i = 0
|
||||||
|
@ -449,7 +461,7 @@ class ItemCardFragment(
|
||||||
viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
|
viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
|
||||||
}
|
}
|
||||||
}catch (e:Exception){
|
}catch (e:Exception){
|
||||||
itemcard_layout.visibility = View.GONE
|
binding.itemcardLayout.visibility = View.GONE
|
||||||
customDialog.setTitle("Error").setDescription("El elemento introducido no es un número").setKoButton("Cancelar"){
|
customDialog.setTitle("Error").setDescription("El elemento introducido no es un número").setKoButton("Cancelar"){
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
|
@ -483,7 +495,7 @@ class ItemCardFragment(
|
||||||
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = (value.toInt() * -1).toString(),isTrash = "0","itemTrash")
|
viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = (value.toInt() * -1).toString(),isTrash = "0","itemTrash")
|
||||||
}
|
}
|
||||||
}catch (e:Exception){
|
}catch (e:Exception){
|
||||||
itemcard_layout.visibility = View.GONE
|
binding.itemcardLayout.visibility = View.GONE
|
||||||
customDialog.setTitle("Error").setDescription("El elemento introducido no es un número").setKoButton("Cancelar"){
|
customDialog.setTitle("Error").setDescription("El elemento introducido no es un número").setKoButton("Cancelar"){
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
|
@ -564,7 +576,7 @@ class ItemCardFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateItemPackingType(itemPackingType:String) {
|
private fun updateItemPackingType(itemPackingType:String) {
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.updatePackingType(this.itemFk,user,password,itemPackingType,"item_updatePackingType")
|
viewModel.updatePackingType(this.itemFk,user,password,itemPackingType,"item_updatePackingType")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package es.verdnatura.presentation.view.feature.buffer.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
|
@ -14,9 +13,9 @@ import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
|
||||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
//import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
//import kotlinx.android.synthetic.main.toolbar.*
|
||||||
|
|
||||||
class BufferFragment(
|
class BufferFragment(
|
||||||
var entryPoint: String = ""
|
var entryPoint: String = ""
|
||||||
|
@ -28,7 +27,6 @@ class BufferFragment(
|
||||||
private var sectorFk = ""
|
private var sectorFk = ""
|
||||||
private var warehouseFk = ""
|
private var warehouseFk = ""
|
||||||
private var goBack: Boolean = false
|
private var goBack: Boolean = false
|
||||||
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_buffer
|
override fun getLayoutId(): Int = R.layout.fragment_buffer
|
||||||
private lateinit var customDialog: CustomDialog
|
private lateinit var customDialog: CustomDialog
|
||||||
private var type = ""
|
private var type = ""
|
||||||
|
@ -37,20 +35,11 @@ class BufferFragment(
|
||||||
fun newInstance(entryPoint: String) = BufferFragment(entryPoint)
|
fun newInstance(entryPoint: String) = BufferFragment(entryPoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
|
||||||
super.onAttach(context)
|
|
||||||
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
|
binding.splashProgress.visibility = View.GONE
|
||||||
// Log.i("VERDNATURA:", "entrypoint es : ${entryPoint}")
|
|
||||||
|
|
||||||
splash_progress.visibility = View.GONE
|
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
//toolbar_title.text = getString(R.string.verticket)
|
|
||||||
setToolbar()
|
setToolbar()
|
||||||
setEvents()
|
setEvents()
|
||||||
super.init()
|
super.init()
|
||||||
|
@ -58,7 +47,7 @@ class BufferFragment(
|
||||||
|
|
||||||
private fun setToolbar() {
|
private fun setToolbar() {
|
||||||
|
|
||||||
toolbar_title.text = entryPoint
|
binding.mainToolbar.toolbarTitle.text = entryPoint
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
@ -78,33 +67,33 @@ class BufferFragment(
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
|
|
||||||
backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
scan_input.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
scan_input.setOnEditorActionListener { _, actionId, _ ->
|
binding.scanInput.setOnEditorActionListener { _, actionId, _ ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
goBack = false
|
goBack = false
|
||||||
if (!scan_input.text.isNullOrEmpty()) {
|
if (! binding.scanInput.text.isNullOrEmpty()) {
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
|
|
||||||
if (entryPoint.equals("Vaciado buffer")){
|
if (entryPoint.equals("Vaciado buffer")){
|
||||||
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"UNLOADING","buffer_setTypeByName")
|
viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"UNLOADING","buffer_setTypeByName")
|
||||||
}
|
}
|
||||||
if (entryPoint.equals("Llenado buffer")){
|
if (entryPoint.equals("Llenado buffer")){
|
||||||
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"LOADING","buffer_setTypeByName")
|
viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"LOADING","buffer_setTypeByName")
|
||||||
}
|
}
|
||||||
if (entryPoint.equals("Acumulación buffer")){
|
if (entryPoint.equals("Acumulación buffer")){
|
||||||
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"ACCUMULATION","buffer_setTypeByName")
|
viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"ACCUMULATION","buffer_setTypeByName")
|
||||||
}
|
}
|
||||||
if (entryPoint.equals("Desactivado buffer")){
|
if (entryPoint.equals("Desactivado buffer")){
|
||||||
viewModel.buffer_setTypeByName(user,password,scan_input.text.toString(),"DISABLED","buffer_setTypeByName")
|
viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"DISABLED","buffer_setTypeByName")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
scan_input.setText("")
|
binding.scanInput.setText("")
|
||||||
(activity as MainActivity).hideKeyboard(scan_input)
|
(activity as MainActivity).hideKeyboard( binding.scanInput)
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
|
@ -115,7 +104,7 @@ class BufferFragment(
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
itembuffertype.observe(viewLifecycleOwner, Observer {
|
itembuffertype.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||||
.setOkButton("Aceptar") {
|
.setOkButton("Aceptar") {
|
||||||
|
@ -127,7 +116,7 @@ class BufferFragment(
|
||||||
customDialog.setTitle("Mensaje").setDescription("Operación "+entryPoint.lowercase() + " realizada correctamente")
|
customDialog.setTitle("Mensaje").setDescription("Operación "+entryPoint.lowercase() + " realizada correctamente")
|
||||||
.setOkButton("Aceptar") {
|
.setOkButton("Aceptar") {
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
backButton.performClick()
|
binding.mainToolbar.backButton.performClick()
|
||||||
}.show()
|
}.show()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,9 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
|
||||||
get() = _itembuffertype
|
get() = _itembuffertype
|
||||||
|
|
||||||
|
|
||||||
private val _bufferresponse by lazy { MutableLiveData<Boolean>() }
|
/*private val _bufferresponse by lazy { MutableLiveData<Boolean>() }
|
||||||
val bufferresponse: LiveData<Boolean>
|
val bufferresponse: LiveData<Boolean>
|
||||||
get() = _bufferresponse
|
get() = _bufferresponse*/
|
||||||
|
|
||||||
private val _bufferloadresponse by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _bufferloadresponse by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val bufferloadresponse: LiveData<ResponseItemVO>
|
val bufferloadresponse: LiveData<ResponseItemVO>
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
package es.verdnatura.presentation.view.feature.buffer.fragment
|
package es.verdnatura.presentation.view.feature.buffer.fragment
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import android.view.View.*
|
import android.view.View.*
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.activity.OnBackPressedCallback
|
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentBufferBinding
|
import es.verdnatura.databinding.FragmentBufferLoadexpeditionBinding
|
||||||
import es.verdnatura.databinding.FragmentBufferLoadBinding
|
|
||||||
import es.verdnatura.databinding.FragmentSacadorAssociatesmarttagBinding
|
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.*
|
import es.verdnatura.presentation.common.*
|
||||||
|
@ -25,20 +20,10 @@ import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter
|
import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter
|
||||||
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
|
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
|
||||||
import kotlinx.android.synthetic.main.component_custom_three_dialog.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_collection.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_controlador.scan_input
|
|
||||||
import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
|
|
||||||
import kotlinx.android.synthetic.main.fragment_expedition_scan.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_login.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_sacador.*
|
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
|
||||||
|
|
||||||
class BufferLoadFragment(
|
class BufferLoadFragment(
|
||||||
var entryPoint: String = ""
|
var entryPoint: String = ""
|
||||||
) : BaseFragment<FragmentBufferLoadBinding, BufferFragmentViewModel>(
|
) : BaseFragment<FragmentBufferLoadexpeditionBinding, BufferFragmentViewModel>(
|
||||||
BufferFragmentViewModel::class
|
BufferFragmentViewModel::class
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -49,7 +34,7 @@ class BufferLoadFragment(
|
||||||
private var sectorFk = ""
|
private var sectorFk = ""
|
||||||
private var warehouseFk = ""
|
private var warehouseFk = ""
|
||||||
private var goBack: Boolean = false
|
private var goBack: Boolean = false
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_sacador_associatesmarttag
|
override fun getLayoutId(): Int = R.layout.fragment_buffer_loadexpedition
|
||||||
private lateinit var customDialog: CustomDialog
|
private lateinit var customDialog: CustomDialog
|
||||||
private lateinit var customDialogList: CustomDialogList
|
private lateinit var customDialogList: CustomDialogList
|
||||||
private lateinit var customDialogInput: CustomDialogInput
|
private lateinit var customDialogInput: CustomDialogInput
|
||||||
|
@ -65,26 +50,6 @@ class BufferLoadFragment(
|
||||||
fun newInstance(entryPoint: String) = BufferLoadFragment(entryPoint)
|
fun newInstance(entryPoint: String) = BufferLoadFragment(entryPoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
|
||||||
super.onAttach(context)
|
|
||||||
// sergio: en test: Log.i("VERDNATURA:","attached")
|
|
||||||
val callback: OnBackPressedCallback =
|
|
||||||
object : OnBackPressedCallback(true)
|
|
||||||
{
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
// Leave empty do disable back press or
|
|
||||||
// write your code which you want
|
|
||||||
// Log.i("VERDNATURA:","PULSADO")
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
requireActivity().onBackPressedDispatcher.addCallback(
|
|
||||||
this,
|
|
||||||
callback
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
|
@ -93,8 +58,8 @@ class BufferLoadFragment(
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
||||||
goBack = false
|
goBack = false
|
||||||
requireActivity().main_bottom_navigation.visibility = GONE
|
(activity as MainActivity).hideBottomNavigation(GONE)
|
||||||
splash_progress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
|
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
|
||||||
mpok= MediaPlayer.create((activity as MainActivity),R.raw.ok)
|
mpok= MediaPlayer.create((activity as MainActivity),R.raw.ok)
|
||||||
|
|
||||||
|
@ -112,24 +77,21 @@ class BufferLoadFragment(
|
||||||
|
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
|
|
||||||
toolbar_title.text = entryPoint
|
binding.mainToolbar.toolbarTitle.text = entryPoint
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun checkLoadExpedition(ExpeditionOrBuffer: String) {
|
private fun checkLoadExpedition(ExpeditionOrBuffer: String) {
|
||||||
|
|
||||||
|
listTags.add(SmartTag(ExpeditionOrBuffer, getTextScaned(listTags.size + 1) + ExpeditionOrBuffer))
|
||||||
// if (listTags.isNullOrEmpty()){
|
customDialogList.setTitle(getTextToPosition(listTags.size + 1))
|
||||||
listTags.add(SmartTag(ExpeditionOrBuffer, getTextScaned(listTags.size + 1) + ExpeditionOrBuffer))
|
|
||||||
customDialogList.setTitle(getTextToPosition(listTags.size + 1))
|
|
||||||
|
|
||||||
tagsAdapter!!.notifyDataSetChanged()
|
tagsAdapter!!.notifyDataSetChanged()
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (listTags.size==2) {
|
if (listTags.size==2) {
|
||||||
splash_progress.visibility = VISIBLE
|
binding.splashProgress.visibility = VISIBLE
|
||||||
viewModel.expeditionLoading_add(
|
viewModel.expeditionLoading_add(
|
||||||
usuario = user,
|
usuario = user,
|
||||||
password=password,
|
password=password,
|
||||||
|
@ -143,20 +105,6 @@ class BufferLoadFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun scanRequest() {
|
|
||||||
if (scan_input != null) {
|
|
||||||
scan_input.requestFocus()
|
|
||||||
}
|
|
||||||
hideKeyboards()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun hideKeyboards() {
|
|
||||||
try {
|
|
||||||
requireActivity().hideKeyboard()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||||
user = prefs.getString(USER, "").toString()
|
user = prefs.getString(USER, "").toString()
|
||||||
|
@ -170,10 +118,9 @@ class BufferLoadFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
|
|
||||||
backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +131,7 @@ class BufferLoadFragment(
|
||||||
|
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
splash_progress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
bufferloadresponse.observe(viewLifecycleOwner, Observer {
|
bufferloadresponse.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
|
@ -219,7 +166,7 @@ class BufferLoadFragment(
|
||||||
customDialogList.setValue("")*/
|
customDialogList.setValue("")*/
|
||||||
|
|
||||||
}
|
}
|
||||||
splash_progress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.View.GONE
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -14,9 +15,7 @@ import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter
|
import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_buscar_item.*
|
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
|
||||||
|
|
||||||
class BuscarItemFragment(
|
class BuscarItemFragment(
|
||||||
var itemFk:String = ""
|
var itemFk:String = ""
|
||||||
|
@ -40,8 +39,9 @@ class BuscarItemFragment(
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_buscar_item
|
override fun getLayoutId(): Int = R.layout.fragment_buscar_item
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
//requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||||
toolbar_title.text = getString(R.string.getubicaition)
|
(activity as MainActivity).hideBottomNavigation(GONE)
|
||||||
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition)
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
setEvents()
|
setEvents()
|
||||||
if (!itemFk.isNullOrEmpty()){
|
if (!itemFk.isNullOrEmpty()){
|
||||||
|
@ -52,20 +52,20 @@ class BuscarItemFragment(
|
||||||
|
|
||||||
|
|
||||||
private fun setEvents(){
|
private fun setEvents(){
|
||||||
edit_itemFk.requestFocus()
|
binding.editItemFk.requestFocus()
|
||||||
edit_itemFk.setOnEditorActionListener { v, actionId, event ->
|
binding.editItemFk.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
if (!edit_itemFk.text.toString().isNullOrEmpty())
|
if (!binding.editItemFk.text.toString().isNullOrEmpty())
|
||||||
getLocations(edit_itemFk.text.toString())
|
getLocations(binding.editItemFk.text.toString())
|
||||||
edit_itemFk.setText("")
|
binding.editItemFk.setText("")
|
||||||
(activity as MainActivity).hideKeyboard(edit_itemFk)
|
(activity as MainActivity).hideKeyboard(binding.editItemFk)
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class BuscarItemFragment(
|
||||||
password = prefs.getString(PASSWORD,"").toString()
|
password = prefs.getString(PASSWORD,"").toString()
|
||||||
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||||
this.itemFk = itemFk
|
this.itemFk = itemFk
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.getLocations(user,password,itemFk,"getItemUbication")
|
viewModel.getLocations(user,password,itemFk,"getItemUbication")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,18 +86,18 @@ class BuscarItemFragment(
|
||||||
loadLocationList.observe(viewLifecycleOwner, Observer { event ->
|
loadLocationList.observe(viewLifecycleOwner, Observer { event ->
|
||||||
|
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
adapter = LocationAdapter(it.list,pasillerosItemClickListener!!)
|
adapter = LocationAdapter(it.list,pasillerosItemClickListener!!)
|
||||||
|
|
||||||
location_recyclerview.adapter = adapter
|
binding.locationRecyclerview.adapter = adapter
|
||||||
location_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
binding.locationRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
var totalVisible:Int = 0
|
var totalVisible:Int = 0
|
||||||
it.list.forEach {
|
it.list.forEach {
|
||||||
if (!it.visible.isNullOrEmpty())
|
if (!it.visible.isNullOrEmpty())
|
||||||
totalVisible += it.visible.toInt()
|
totalVisible += it.visible.toInt()
|
||||||
}
|
}
|
||||||
toolbar_title.text = "Item: "+itemFk+ " Total visible: "+totalVisible
|
binding.mainToolbar.toolbarTitle.text = "Item: "+itemFk+ " Total visible: "+totalVisible
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,22 +9,22 @@ import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.BuyersFragmentBinding
|
import es.verdnatura.databinding.BuyersFragmentBinding
|
||||||
import es.verdnatura.domain.toast
|
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnAjustesItemClickListener
|
import es.verdnatura.presentation.common.OnAjustesItemClickListener
|
||||||
import es.verdnatura.presentation.common.OnBuyerSelectedListener
|
import es.verdnatura.presentation.common.OnBuyerSelectedListener
|
||||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter
|
import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||||
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
|
|
||||||
|
/*import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.buyers_fragment.*
|
import kotlinx.android.synthetic.main.buyers_fragment.*
|
||||||
import kotlinx.android.synthetic.main.buyers_fragment.splash_progress
|
import kotlinx.android.synthetic.main.buyers_fragment.splash_progress
|
||||||
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
import kotlinx.android.synthetic.main.toolbar.**/
|
||||||
|
|
||||||
class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(BuyersViewModel::class) {
|
class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(BuyersViewModel::class) {
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
||||||
super.onAttach(context)
|
super.onAttach(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
|
||||||
user = prefs.getString(USER,"").toString()
|
user = prefs.getString(USER,"").toString()
|
||||||
|
@ -60,9 +62,11 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
//requireActivity().main_bottom_navigation.visibility = View.GONE
|
||||||
splash_progress.visibility = View.VISIBLE
|
(activity as MainActivity).hideBottomNavigation(View.GONE)
|
||||||
toolbar_title.text = getString(R.string.quality)
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.quality)
|
||||||
|
|
||||||
setToolBar()
|
setToolBar()
|
||||||
setEvents()
|
setEvents()
|
||||||
super.init()
|
super.init()
|
||||||
|
@ -72,20 +76,20 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
||||||
val listIcons:ArrayList<Drawable> = ArrayList()
|
val listIcons:ArrayList<Drawable> = ArrayList()
|
||||||
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
|
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
|
||||||
listIcons.add(iconReload)
|
listIcons.add(iconReload)
|
||||||
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
if (item == iconReload){
|
if (item == iconReload){
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility= View.VISIBLE
|
||||||
viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelving_BuyerGet")
|
viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelving_BuyerGet")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEvents(){
|
private fun setEvents(){
|
||||||
backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +97,7 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
buyersList.observe(viewLifecycleOwner, Observer {
|
buyersList.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
createBuyerList(it.list)
|
createBuyerList(it.list)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -120,8 +124,8 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
|
||||||
onBuyerSelectedListener?.onBuyerSelected(item.id.toString())
|
onBuyerSelectedListener?.onBuyerSelected(item.id.toString())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
buyers_items.adapter = buyersAdapter
|
binding.buyersItems.adapter = buyersAdapter
|
||||||
buyers_items.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
binding.buyersItems.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,10 +3,7 @@ package es.verdnatura.presentation.view.feature.controlador.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
|
@ -17,9 +14,12 @@ import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
|
|
||||||
|
/*
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
import kotlinx.android.synthetic.main.toolbar.*
|
||||||
|
*/
|
||||||
|
|
||||||
class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorViewModel>(ControladorViewModel::class) {
|
class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorViewModel>(ControladorViewModel::class) {
|
||||||
|
|
||||||
|
@ -44,11 +44,12 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
toolbar_title.text = getString(R.string.controlticket)
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.controlticket)
|
||||||
setEvents()
|
setEvents()
|
||||||
requireActivity().main_bottom_navigation.visibility = View.VISIBLE
|
//requireActivity().main_bottom_navigation.visibility = View.VISIBLE
|
||||||
|
(activity as MainActivity).hideBottomNavigation(View.VISIBLE)
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,28 +73,28 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
||||||
|
|
||||||
private fun setEvents(){
|
private fun setEvents(){
|
||||||
|
|
||||||
backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
scan_input.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
scan_input.setOnEditorActionListener { v, actionId, event ->
|
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
goBack=false
|
goBack=false
|
||||||
if (!scan_input.text.isNullOrEmpty()) {
|
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
|
|
||||||
viewModel.collectionTicketGet(
|
viewModel.collectionTicketGet(
|
||||||
usuario = user,
|
usuario = user,
|
||||||
password = password,
|
password = password,
|
||||||
sectorFk = sectorFk,
|
sectorFk = sectorFk,
|
||||||
collectionFk = scan_input.text.toString(),
|
collectionFk = binding.scanInput.text.toString(),
|
||||||
type = type
|
type = type
|
||||||
,callFunction = "collection_getTickets")
|
,callFunction = "collection_getTickets")
|
||||||
// viewModel.ticket_checkControlled(user,password,scan_input.text.toString())
|
// viewModel.ticket_checkControlled(user,password,scan_input.text.toString())
|
||||||
}
|
}
|
||||||
scan_input.setText("")
|
binding.scanInput.setText("")
|
||||||
(activity as MainActivity).hideKeyboard(scan_input)
|
(activity as MainActivity).hideKeyboard(binding.scanInput)
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
|
@ -103,7 +104,7 @@ class ControladorFragment : BaseFragment<FragmentControladorBinding,ControladorV
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel){
|
with(viewModel){
|
||||||
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
if (it.isError){
|
if (it.isError){
|
||||||
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){
|
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
|
|
|
@ -1,33 +1,26 @@
|
||||||
package es.verdnatura.presentation.view.feature.controlador.fragment
|
package es.verdnatura.presentation.view.feature.controlador.fragment
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import es.verdnatura.presentation.view.feature.qr.QrFragmentViewModel
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
|
||||||
import android.view.inputmethod.EditorInfo
|
|
||||||
import android.webkit.WebChromeClient
|
import android.webkit.WebChromeClient
|
||||||
import android.webkit.WebSettings
|
|
||||||
import android.webkit.WebView
|
|
||||||
import android.webkit.WebViewClient
|
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentQrBinding
|
import es.verdnatura.databinding.FragmentWebBinding
|
||||||
import es.verdnatura.domain.ConstAndValues
|
import es.verdnatura.domain.ConstAndValues
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
|
||||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
/*import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
import kotlinx.android.synthetic.main.toolbar.*
|
||||||
import kotlinx.android.synthetic.main.fragment_web.*
|
import kotlinx.android.synthetic.main.fragment_web.**/
|
||||||
|
|
||||||
|
|
||||||
class WebFragment(
|
class WebFragment(
|
||||||
var entryPoint: String = ""
|
var entryPoint: String = ""
|
||||||
) : BaseFragment<FragmentQrBinding, QrFragmentViewModel>(QrFragmentViewModel::class) {
|
) : BaseFragment<FragmentWebBinding, ControladorViewModel>(ControladorViewModel::class) {
|
||||||
|
|
||||||
private var user = ""
|
private var user = ""
|
||||||
private var password = ""
|
private var password = ""
|
||||||
|
@ -58,12 +51,12 @@ class WebFragment(
|
||||||
// webView = WebViewClient()
|
// webView = WebViewClient()
|
||||||
|
|
||||||
|
|
||||||
webView.setWebChromeClient (WebChromeClient())
|
binding.webView.setWebChromeClient (WebChromeClient())
|
||||||
// webView.setWebViewClient (wvClient);
|
// webView.setWebViewClient (wvClient);
|
||||||
webView.getSettings (). setJavaScriptEnabled (true)
|
binding.webView.getSettings (). setJavaScriptEnabled (true)
|
||||||
// sergio:deprecated
|
// sergio:deprecated
|
||||||
//webView.getSettings (). setPluginState (WebSettings.PluginState.ON)
|
//webView.getSettings (). setPluginState (WebSettings.PluginState.ON)
|
||||||
val webSettings = webView.settings
|
val webSettings = binding.webView.settings
|
||||||
webSettings.javaScriptEnabled = true
|
webSettings.javaScriptEnabled = true
|
||||||
webSettings.domStorageEnabled = true
|
webSettings.domStorageEnabled = true
|
||||||
webSettings.loadWithOverviewMode = true
|
webSettings.loadWithOverviewMode = true
|
||||||
|
@ -74,7 +67,7 @@ class WebFragment(
|
||||||
webSettings.defaultTextEncodingName = "utf-8"
|
webSettings.defaultTextEncodingName = "utf-8"
|
||||||
|
|
||||||
|
|
||||||
webView.loadUrl ("https://salix.verdnatura.es/#!/item/index")
|
binding.webView.loadUrl ("https://salix.verdnatura.es/#!/item/index")
|
||||||
|
|
||||||
val openURL = Intent(Intent.ACTION_VIEW)
|
val openURL = Intent(Intent.ACTION_VIEW)
|
||||||
// openURL.data = Uri.parse("https://salix.verdnatura.es/#!/ticket/3271614/tracking/index")
|
// openURL.data = Uri.parse("https://salix.verdnatura.es/#!/ticket/3271614/tracking/index")
|
||||||
|
@ -91,7 +84,7 @@ class WebFragment(
|
||||||
|
|
||||||
private fun setToolbar() {
|
private fun setToolbar() {
|
||||||
|
|
||||||
toolbar_title.text = entryPoint
|
binding.mainToolbar.toolbarTitle.text = entryPoint
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
@ -133,11 +126,11 @@ class WebFragment(
|
||||||
false
|
false
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
/*
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
qrresponse.observe(viewLifecycleOwner, Observer {
|
response.observe(viewLifecycleOwner, Observer {
|
||||||
//splash_progress.visibility = View.GONE
|
//splash_progress.visibility = View.GONE
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
|
|
||||||
|
@ -152,7 +145,7 @@ class WebFragment(
|
||||||
.setDescription("Operación " + itemscaned + ". " + it.response)
|
.setDescription("Operación " + itemscaned + ". " + it.response)
|
||||||
.setOkButton("Aceptar") {
|
.setOkButton("Aceptar") {
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
backButton.performClick()
|
binding.mainToolbar.backButton.performClick()
|
||||||
}.show()
|
}.show()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -162,6 +155,6 @@ class WebFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,17 @@
|
||||||
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
|
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.media.MediaPlayer
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.View
|
|
||||||
import android.view.View.*
|
import android.view.View.*
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.fragment.app.FragmentManager
|
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
|
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
|
||||||
import es.verdnatura.domain.ConstAndValues
|
|
||||||
import es.verdnatura.domain.ConstAndValues.MAINACTIVITY
|
|
||||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.*
|
import es.verdnatura.presentation.common.*
|
||||||
|
@ -31,16 +24,14 @@ import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
|
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
/*import kotlinx.android.synthetic.main.component_custom_three_dialog.*
|
||||||
import kotlinx.android.synthetic.main.component_custom_three_dialog.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_collection.*
|
import kotlinx.android.synthetic.main.fragment_collection.*
|
||||||
import kotlinx.android.synthetic.main.fragment_controlador.*
|
import kotlinx.android.synthetic.main.fragment_controlador.*
|
||||||
import kotlinx.android.synthetic.main.fragment_controlador.scan_input
|
import kotlinx.android.synthetic.main.fragment_controlador.binding.scanInput
|
||||||
import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
|
import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
|
||||||
import kotlinx.android.synthetic.main.fragment_login.*
|
import kotlinx.android.synthetic.main.fragment_login.*
|
||||||
import kotlinx.android.synthetic.main.fragment_sacador.*
|
import kotlinx.android.synthetic.main.fragment_sacador.*
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
import kotlinx.android.synthetic.main.toolbar.**/
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
|
@ -82,7 +73,7 @@ class ControlVehiculoFragment(
|
||||||
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
||||||
goBack = false
|
goBack = false
|
||||||
|
|
||||||
splash_progress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
|
|
||||||
/* if (getWagons() < 2 && !tagName.equals(SacadorFragment.TAG))
|
/* if (getWagons() < 2 && !tagName.equals(SacadorFragment.TAG))
|
||||||
{
|
{
|
||||||
|
@ -109,8 +100,8 @@ class ControlVehiculoFragment(
|
||||||
|
|
||||||
private fun setToolBar(direction: String) {
|
private fun setToolBar(direction: String) {
|
||||||
|
|
||||||
toolbar_title.text = getString(R.string.vehiclecontrol)
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontrol)
|
||||||
toolbar_title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
|
binding.mainToolbar.toolbarTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
|
||||||
|
|
||||||
val listIcons: ArrayList<Drawable> = ArrayList()
|
val listIcons: ArrayList<Drawable> = ArrayList()
|
||||||
val iconHistory: Drawable =
|
val iconHistory: Drawable =
|
||||||
|
@ -138,7 +129,7 @@ class ControlVehiculoFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
toolbar_icons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
|
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
|
||||||
if (item == iconHistory) {
|
if (item == iconHistory) {
|
||||||
|
@ -154,7 +145,7 @@ class ControlVehiculoFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
toolbar_icons.layoutManager =
|
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +191,7 @@ class ControlVehiculoFragment(
|
||||||
private fun checkControlTimeVehicle() {
|
private fun checkControlTimeVehicle() {
|
||||||
|
|
||||||
if (!goBack) {
|
if (!goBack) {
|
||||||
splash_progress.visibility = VISIBLE
|
binding.splashProgress.visibility = VISIBLE
|
||||||
viewModel.workerMachinery_isRegistered(user, password,"workerMachinery_isRegistered")
|
viewModel.workerMachinery_isRegistered(user, password,"workerMachinery_isRegistered")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +204,7 @@ class ControlVehiculoFragment(
|
||||||
plateNumber
|
plateNumber
|
||||||
)
|
)
|
||||||
} else if (direction.equals("IN")) {
|
} else if (direction.equals("IN")) {
|
||||||
splash_progress.visibility = VISIBLE
|
binding.splashProgress.visibility = VISIBLE
|
||||||
viewModel.machineWorker_add(user, password, plateNumber,"machineWorker_add")
|
viewModel.machineWorker_add(user, password, plateNumber,"machineWorker_add")
|
||||||
|
|
||||||
} else if (direction.equals("OUT")) {
|
} else if (direction.equals("OUT")) {
|
||||||
|
@ -226,8 +217,8 @@ class ControlVehiculoFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun scanRequest() {
|
private fun scanRequest() {
|
||||||
if (scan_input != null) {
|
if (binding.scanInput != null) {
|
||||||
scan_input.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
}
|
}
|
||||||
hideKeyboards()
|
hideKeyboards()
|
||||||
}
|
}
|
||||||
|
@ -251,23 +242,23 @@ class ControlVehiculoFragment(
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
|
|
||||||
backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
scan_input.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
scan_input.setOnEditorActionListener { v, actionId, event ->
|
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
if (!scan_input.text.isNullOrEmpty()) {
|
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||||
|
|
||||||
if (tagName.equals(HistoricoVehiculoFragment.TAG)) {
|
if (tagName.equals(HistoricoVehiculoFragment.TAG)) {
|
||||||
showOptionsHistorical(scan_input.text.toString())
|
showOptionsHistorical(binding.scanInput.text.toString())
|
||||||
} else {
|
} else {
|
||||||
showOptionsVehicleControl(scan_input.text.toString())
|
showOptionsVehicleControl(binding.scanInput.text.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scan_input.setText("")
|
binding.scanInput.setText("")
|
||||||
(activity as MainActivity).hideKeyboard(scan_input)
|
(activity as MainActivity).hideKeyboard(binding.scanInput)
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
|
@ -276,7 +267,7 @@ class ControlVehiculoFragment(
|
||||||
|
|
||||||
private fun showOptionsVehicleControl(plate: String) {
|
private fun showOptionsVehicleControl(plate: String) {
|
||||||
|
|
||||||
customDialogThreeButtons.custom_dialog_value.visibility = GONE
|
customDialogThreeButtons.setCustomDialogValue(GONE)
|
||||||
|
|
||||||
customDialogThreeButtons.setDescription("¿Qué desea hacer con el vehículo de matrícula $plate")
|
customDialogThreeButtons.setDescription("¿Qué desea hacer con el vehículo de matrícula $plate")
|
||||||
.setValue(plate)
|
.setValue(plate)
|
||||||
|
@ -285,7 +276,7 @@ class ControlVehiculoFragment(
|
||||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||||
"Vuelva a escanear".toast(requireContext())
|
"Vuelva a escanear".toast(requireContext())
|
||||||
} else {
|
} else {
|
||||||
splash_progress.visibility = VISIBLE
|
binding.splashProgress.visibility = VISIBLE
|
||||||
customDialogThreeButtons.dismiss()
|
customDialogThreeButtons.dismiss()
|
||||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "IN")
|
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "IN")
|
||||||
}
|
}
|
||||||
|
@ -296,7 +287,7 @@ class ControlVehiculoFragment(
|
||||||
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
|
||||||
"Vuelva a escanear".toast(requireContext())
|
"Vuelva a escanear".toast(requireContext())
|
||||||
} else {
|
} else {
|
||||||
splash_progress.visibility = VISIBLE
|
binding.splashProgress.visibility = VISIBLE
|
||||||
customDialogThreeButtons.dismiss()
|
customDialogThreeButtons.dismiss()
|
||||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "OUT")
|
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "OUT")
|
||||||
}
|
}
|
||||||
|
@ -318,7 +309,7 @@ class ControlVehiculoFragment(
|
||||||
|
|
||||||
private fun showOptionsHistorical(plate: String) {
|
private fun showOptionsHistorical(plate: String) {
|
||||||
|
|
||||||
customDialogThreeButtons.custom_dialog_value.visibility = GONE
|
customDialogThreeButtons.setCustomDialogValue(GONE)
|
||||||
|
|
||||||
customDialogThreeButtons.setDescription("¿Qué desea hacer con el vehículo de matrícula $plate")
|
customDialogThreeButtons.setDescription("¿Qué desea hacer con el vehículo de matrícula $plate")
|
||||||
.setValue(plate)
|
.setValue(plate)
|
||||||
|
@ -341,7 +332,7 @@ class ControlVehiculoFragment(
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
splash_progress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
responseinsert.observe(viewLifecycleOwner, Observer {
|
responseinsert.observe(viewLifecycleOwner, Observer {
|
||||||
Log.i(
|
Log.i(
|
||||||
"VERDNATURA",
|
"VERDNATURA",
|
||||||
|
@ -379,11 +370,11 @@ class ControlVehiculoFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
splash_progress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
})
|
})
|
||||||
|
|
||||||
responsecontrol.observe(viewLifecycleOwner, Observer {
|
responsecontrol.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
// Log.i("VERDNATURA:","${it.response}")
|
// Log.i("VERDNATURA:","${it.response}")
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||||
|
|
|
@ -6,16 +6,19 @@ import android.view.View.*
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
|
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
|
||||||
|
import es.verdnatura.databinding.FragmentVehiclecontrolUserBinding
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.loadUrl
|
import es.verdnatura.presentation.common.loadUrl
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
|
|
||||||
import kotlinx.android.synthetic.main.fragment_vehiclecontrol_user.*
|
import kotlinx.android.synthetic.main.fragment_vehiclecontrol_user.*
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
|
||||||
|
/*import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
|
||||||
|
import kotlinx.android.synthetic.main.fragment_vehiclecontrol_user.*
|
||||||
|
import kotlinx.android.synthetic.main.toolbar.**/
|
||||||
|
|
||||||
class ControlVehiculoUsuarioFragment(
|
class ControlVehiculoUsuarioFragment(
|
||||||
var vUserFK: String = ""
|
var vUserFK: String = ""
|
||||||
) : BaseFragment<FragmentVehiclecontrolBinding, ControlVehiculoViewModel>(
|
) : BaseFragment<FragmentVehiclecontrolUserBinding, ControlVehiculoViewModel>(
|
||||||
ControlVehiculoViewModel::class
|
ControlVehiculoViewModel::class
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -27,7 +30,6 @@ class ControlVehiculoUsuarioFragment(
|
||||||
private var token = ""
|
private var token = ""
|
||||||
private var goBack: Boolean = false
|
private var goBack: Boolean = false
|
||||||
private var android_id: String = ""
|
private var android_id: String = ""
|
||||||
// private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol_user
|
override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol_user
|
||||||
private lateinit var customDialog: CustomDialog
|
private lateinit var customDialog: CustomDialog
|
||||||
|
|
||||||
|
@ -36,17 +38,12 @@ class ControlVehiculoUsuarioFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
toolbar_title.text = getString(R.string.vehiclecontroluser)
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontroluser)
|
||||||
|
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
|
|
||||||
goBack = false
|
goBack = false
|
||||||
|
binding.splashProgress.visibility = GONE
|
||||||
splash_progress.visibility = GONE
|
|
||||||
setEvents()
|
setEvents()
|
||||||
setControlVehicleUser()
|
setControlVehicleUser()
|
||||||
//sergio:se queda pendiente de revisar con javi
|
|
||||||
// setDialog()
|
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
@ -66,7 +63,7 @@ class ControlVehiculoUsuarioFragment(
|
||||||
|
|
||||||
if (userFk.equals(vUserFK)) {
|
if (userFk.equals(vUserFK)) {
|
||||||
|
|
||||||
splash_progress.visibility = VISIBLE
|
binding.splashProgress.visibility = VISIBLE
|
||||||
viewModel.machine_getWorkerPlate(user, password,"machine_getWorkerPlate")
|
viewModel.machine_getWorkerPlate(user, password,"machine_getWorkerPlate")
|
||||||
viewModel.deviceProduction_getnameDevice(user, password, android_id,"deviceProduction_getnameDevice")
|
viewModel.deviceProduction_getnameDevice(user, password, android_id,"deviceProduction_getnameDevice")
|
||||||
viewModel.deviceProductionUser_getWorker(user, password, android_id,"deviceProductionUser_getWorker")
|
viewModel.deviceProductionUser_getWorker(user, password, android_id,"deviceProductionUser_getWorker")
|
||||||
|
@ -74,17 +71,17 @@ class ControlVehiculoUsuarioFragment(
|
||||||
} else {
|
} else {
|
||||||
userFk = vUserFK
|
userFk = vUserFK
|
||||||
|
|
||||||
user_information.visibility = INVISIBLE
|
binding.userInformation.visibility = INVISIBLE
|
||||||
name_vehiclecontrol.visibility = INVISIBLE
|
binding.nameVehiclecontrol.visibility = INVISIBLE
|
||||||
user_image.setOnClickListener({backButton.performClick()})
|
binding.userInformation.setOnClickListener({binding.mainToolbar.backButton.performClick()})
|
||||||
|
|
||||||
}
|
}
|
||||||
user_image.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=$token")
|
binding.userImage.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=$token")
|
||||||
viewModel.machine_getWorkerPlate(user, password,"machine_getWorkerPlate")
|
viewModel.machine_getWorkerPlate(user, password,"machine_getWorkerPlate")
|
||||||
name_vehiclecontrol.text = user
|
binding.nameVehiclecontrol.text = user
|
||||||
registered_vehiclecontrol.text = ""
|
binding.registeredVehiclecontrol.text = ""
|
||||||
deviceName.text = ""
|
binding.deviceName.text = ""
|
||||||
assigned_devicename.text = ""
|
binding.assignedDevicename.text = ""
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +97,7 @@ class ControlVehiculoUsuarioFragment(
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
|
|
||||||
backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,11 +141,11 @@ private fun setDialog(){
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
splash_progress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
|
|
||||||
|
|
||||||
responsemachine.observe(viewLifecycleOwner, Observer {
|
responsemachine.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||||
.setOkButton("Cerrar") {
|
.setOkButton("Cerrar") {
|
||||||
|
@ -165,13 +162,13 @@ private fun setDialog(){
|
||||||
// Log.i("VERDNATURA::", "valor devuelto ${it.response}")
|
// Log.i("VERDNATURA::", "valor devuelto ${it.response}")
|
||||||
|
|
||||||
if (it.type.equals("getnameDevice")) {
|
if (it.type.equals("getnameDevice")) {
|
||||||
deviceName.text = it.response
|
binding.deviceName.text = it.response
|
||||||
}
|
}
|
||||||
if (it.type.equals("getWorker")) {
|
if (it.type.equals("getWorker")) {
|
||||||
assigned_devicename.text = it.response
|
binding.assignedDevicename.text = it.response
|
||||||
}
|
}
|
||||||
if (it.type.equals("getWorkerPlate")) {
|
if (it.type.equals("getWorkerPlate")) {
|
||||||
registered_vehiclecontrol.text = it.response
|
binding.registeredVehiclecontrol.text = it.response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,8 @@ import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
import es.verdnatura.presentation.view.feature.diadeventa.adapter.DayOfSaleAdapter
|
import es.verdnatura.presentation.view.feature.diadeventa.adapter.DayOfSaleAdapter
|
||||||
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow
|
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState
|
/*import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
|
||||||
import kotlinx.android.synthetic.main.buyers_fragment.*
|
import kotlinx.android.synthetic.main.buyers_fragment.*
|
||||||
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
|
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
|
||||||
import kotlinx.android.synthetic.main.fragment_item_card.*
|
import kotlinx.android.synthetic.main.fragment_item_card.*
|
||||||
|
@ -27,7 +26,7 @@ import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
|
||||||
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
|
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
|
||||||
import kotlinx.android.synthetic.main.fragment_itemshelvingdayofsale.*
|
import kotlinx.android.synthetic.main.fragment_itemshelvingdayofsale.*
|
||||||
import kotlinx.android.synthetic.main.fragment_parking.*
|
import kotlinx.android.synthetic.main.fragment_parking.*
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
import kotlinx.android.synthetic.main.toolbar.**/
|
||||||
|
|
||||||
class DayOfSaleFragment(
|
class DayOfSaleFragment(
|
||||||
var entryPoint: String = ""
|
var entryPoint: String = ""
|
||||||
|
@ -38,7 +37,6 @@ class DayOfSaleFragment(
|
||||||
private var password = ""
|
private var password = ""
|
||||||
private var warehouseFk = ""
|
private var warehouseFk = ""
|
||||||
private var adapter: DayOfSaleAdapter? = null
|
private var adapter: DayOfSaleAdapter? = null
|
||||||
private var listItemsRow: ArrayList<ItemExpeditionStateRow> = ArrayList()
|
|
||||||
private var itemScan = ""
|
private var itemScan = ""
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -60,7 +58,7 @@ class DayOfSaleFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolBar(title: String) {
|
private fun setToolBar(title: String) {
|
||||||
toolbar_title.text = title
|
binding.mainToolbar.toolbarTitle.text = title
|
||||||
|
|
||||||
|
|
||||||
val listIcons: ArrayList<Drawable> = ArrayList()
|
val listIcons: ArrayList<Drawable> = ArrayList()
|
||||||
|
@ -69,7 +67,7 @@ class DayOfSaleFragment(
|
||||||
|
|
||||||
listIcons.add(iconParking)
|
listIcons.add(iconParking)
|
||||||
|
|
||||||
toolbar_icons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
|
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
|
||||||
if (item == iconParking) {
|
if (item == iconParking) {
|
||||||
|
@ -80,29 +78,29 @@ class DayOfSaleFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
toolbar_icons.layoutManager =
|
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
edit_itemFk.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
edit_itemFk.setOnEditorActionListener { v, actionId, event ->
|
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
if (!edit_itemFk.text.toString().isNullOrEmpty()) {
|
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
|
||||||
getItemsSaleDate(edit_itemFk.text.toString())
|
getItemsSaleDate(binding.scanInput.text.toString())
|
||||||
|
|
||||||
itemScan = edit_itemFk.text.toString()
|
itemScan = binding.scanInput.text.toString()
|
||||||
}
|
}
|
||||||
edit_itemFk.setText("")
|
binding.scanInput.setText("")
|
||||||
(activity as MainActivity).hideKeyboard(edit_itemFk)
|
(activity as MainActivity).hideKeyboard(binding.scanInput)
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +114,7 @@ class DayOfSaleFragment(
|
||||||
user = prefs.getString(USER, "").toString()
|
user = prefs.getString(USER, "").toString()
|
||||||
password = prefs.getString(PASSWORD, "").toString()
|
password = prefs.getString(PASSWORD, "").toString()
|
||||||
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
|
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.itemShelving_getSaleDate(user, password,vShelvingFK,"itemShelving_getSaleDate")
|
viewModel.itemShelving_getSaleDate(user, password,vShelvingFK,"itemShelving_getSaleDate")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,14 +125,12 @@ class DayOfSaleFragment(
|
||||||
|
|
||||||
loadItemShelvingSaleDateList.observe(viewLifecycleOwner, Observer{ event ->
|
loadItemShelvingSaleDateList.observe(viewLifecycleOwner, Observer{ event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
adapter = DayOfSaleAdapter(it.list)
|
adapter = DayOfSaleAdapter(it.list)
|
||||||
|
|
||||||
itemexpeditionstate_recyclerview.adapter = adapter
|
binding.itemexpeditionstateRecyclerview.adapter = adapter
|
||||||
itemexpeditionstate_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
binding.itemexpeditionstateRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
|
|
||||||
// navigateToToday(it)
|
|
||||||
if (it.list.isEmpty()){
|
if (it.list.isEmpty()){
|
||||||
customDialog.setTitle("Sin resultados")
|
customDialog.setTitle("Sin resultados")
|
||||||
.setDescription("No se ha podido obtener datos de la etiqueta escaneada. ")
|
.setDescription("No se ha podido obtener datos de la etiqueta escaneada. ")
|
||||||
|
@ -157,7 +153,7 @@ class DayOfSaleFragment(
|
||||||
response.observe(viewLifecycleOwner, Observer {
|
response.observe(viewLifecycleOwner, Observer {
|
||||||
if (it.isError){
|
if (it.isError){
|
||||||
|
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
|
@ -177,29 +173,6 @@ class DayOfSaleFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* private fun setItemExpeditionState(itemInfo: itemExpedetionState) {
|
|
||||||
setToolBar(getString(R.string.wagon) +":"+ itemScan)
|
|
||||||
|
|
||||||
listItemsRow = ArrayList()
|
|
||||||
for (i in itemInfo.list) {
|
|
||||||
listItemsRow.add(
|
|
||||||
ItemExpeditionStateRow(
|
|
||||||
title = i.key,
|
|
||||||
value = i.value.replace(".0",""),
|
|
||||||
isEditable = false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
itemexpeditionstate_recyclerview.adapter = adapter
|
|
||||||
itemexpeditionstate_recyclerview.layoutManager =
|
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
|
||||||
|
|
||||||
|
|
||||||
}*/
|
|
||||||
private fun showParking() {
|
private fun showParking() {
|
||||||
|
|
||||||
customDialogList.setTitle("Escanea el parking")
|
customDialogList.setTitle("Escanea el parking")
|
||||||
|
|
|
@ -21,9 +21,9 @@ import es.verdnatura.presentation.view.feature.faltas.adapter.FaltasAdapter
|
||||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
/*import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.fragment_faltas.*
|
import kotlinx.android.synthetic.main.fragment_faltas.*
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
import kotlinx.android.synthetic.main.toolbar.**/
|
||||||
|
|
||||||
class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(FaltasViewModel::class) {
|
class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(FaltasViewModel::class) {
|
||||||
|
|
||||||
|
@ -62,9 +62,9 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
(activity as MainActivity).hideBottomNavigation(View.GONE)
|
||||||
toolbar_title.text = getString(R.string.faultsReview)
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.faultsReview)
|
||||||
setToolBar()
|
setToolBar()
|
||||||
|
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
|
@ -73,7 +73,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
|
||||||
if (reload){
|
if (reload){
|
||||||
reload = false
|
reload = false
|
||||||
hideLoad = false
|
hideLoad = false
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.getFaltas(user,password,warehouseFk)
|
viewModel.getFaltas(user,password,warehouseFk)
|
||||||
}
|
}
|
||||||
super.init()
|
super.init()
|
||||||
|
@ -84,25 +84,25 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
|
||||||
val listIcons:ArrayList<Drawable> = ArrayList()
|
val listIcons:ArrayList<Drawable> = ArrayList()
|
||||||
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
|
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
|
||||||
listIcons.add(iconReload)
|
listIcons.add(iconReload)
|
||||||
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
if (item == iconReload){
|
if (item == iconReload){
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModel.getFaltas(user,password,warehouseFk)
|
viewModel.getFaltas(user,password,warehouseFk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEvents(){
|
private fun setEvents(){
|
||||||
backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
filter_itemFk.setOnKeyListener { v, keyCode, event ->
|
binding.filterItemFk.setOnKeyListener { v, keyCode, event ->
|
||||||
if (filter_itemFk.text.toString().isNullOrEmpty()){
|
if (binding.filterItemFk.text.toString().isNullOrEmpty()){
|
||||||
if (listInvetory.size != listInvetoryAux.size){
|
if (listInvetory.size != listInvetoryAux.size){
|
||||||
listInvetory.removeAll(listInvetoryAux)
|
listInvetory.removeAll(listInvetoryAux)
|
||||||
listInvetoryAux.forEach {
|
listInvetoryAux.forEach {
|
||||||
|
@ -114,7 +114,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
|
||||||
}else{
|
}else{
|
||||||
listInvetory.removeAll(listInvetoryAux)
|
listInvetory.removeAll(listInvetoryAux)
|
||||||
listInvetoryAux.forEach {
|
listInvetoryAux.forEach {
|
||||||
if (it.itemFk.contains(filter_itemFk.text.toString(),true)){
|
if (it.itemFk.contains(binding.filterItemFk.text.toString(),true)){
|
||||||
listInvetory.add(it)
|
listInvetory.add(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
|
||||||
with(viewModel){
|
with(viewModel){
|
||||||
faltasList.observe(viewLifecycleOwner, Observer {
|
faltasList.observe(viewLifecycleOwner, Observer {
|
||||||
if (hideLoad){
|
if (hideLoad){
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
}else{
|
}else{
|
||||||
hideLoad = true
|
hideLoad = true
|
||||||
}
|
}
|
||||||
|
@ -174,8 +174,8 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
|
||||||
}
|
}
|
||||||
|
|
||||||
},pasillerosItemClickListener!!)
|
},pasillerosItemClickListener!!)
|
||||||
location_recyclerview.adapter = adapter
|
binding.locationRecyclerview.adapter = adapter
|
||||||
location_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
binding.locationRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
package es.verdnatura.presentation.view.feature.historico.fragment
|
package es.verdnatura.presentation.view.feature.historico.fragment
|
||||||
|
|
||||||
|
/*import kotlinx.android.synthetic.main.activity_main.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_buscar_item.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_historico.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_historico. binding.splashProgress
|
||||||
|
import kotlinx.android.synthetic.main.fragment_inventary.*
|
||||||
|
import kotlinx.android.synthetic.main.toolbar.*
|
||||||
|
import java.text.SimpleDateFormat*/
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.Color.*
|
import android.graphics.Color.*
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.appcompat.widget.TooltipCompat
|
|
||||||
import androidx.core.content.ContextCompat.getColor
|
import androidx.core.content.ContextCompat.getColor
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -25,12 +29,7 @@ import es.verdnatura.presentation.view.feature.historico.adapter.HistoricoAdapte
|
||||||
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoListVO
|
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoListVO
|
||||||
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
|
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import kotlinx.android.synthetic.main.fragment_buscar_item.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_historico.*
|
|
||||||
import kotlinx.android.synthetic.main.fragment_historico.splash_progress
|
|
||||||
import kotlinx.android.synthetic.main.fragment_inventary.*
|
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -66,10 +65,10 @@ class HistoricoFragment(
|
||||||
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
|
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
requireActivity().main_bottom_navigation.visibility = View.GONE
|
(activity as MainActivity).hideBottomNavigation(View.GONE)
|
||||||
filter = "all"
|
filter = "all"
|
||||||
viewModel.itemDiary(user, password, itemFk, warehouseFk,"itemDiary")
|
viewModel.itemDiary(user, password, itemFk, warehouseFk,"itemDiary")
|
||||||
toolbar_title.text = getString(R.string.itemdiary) + ":" + itemFk
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemdiary) + ":" + itemFk
|
||||||
setToolBar()
|
setToolBar()
|
||||||
setEvents()
|
setEvents()
|
||||||
|
|
||||||
|
@ -111,13 +110,13 @@ class HistoricoFragment(
|
||||||
listIcons.add(iconReload)
|
listIcons.add(iconReload)
|
||||||
|
|
||||||
|
|
||||||
toolbar_icons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
|
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
|
||||||
|
|
||||||
if (item == iconReload) {
|
if (item == iconReload) {
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModelwithFilter("all")
|
viewModelwithFilter("all")
|
||||||
// TooltipCompat.setTooltipText(view!!, "Recarga");
|
// TooltipCompat.setTooltipText(view!!, "Recarga");
|
||||||
// view?.let { TooltipCompat.setTooltipText(it, "Recarga") };
|
// view?.let { TooltipCompat.setTooltipText(it, "Recarga") };
|
||||||
|
@ -133,13 +132,13 @@ class HistoricoFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == iconGargabe) {
|
if (item == iconGargabe) {
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModelwithFilter("contenedor")
|
viewModelwithFilter("contenedor")
|
||||||
view?.performLongClick()
|
view?.performLongClick()
|
||||||
|
|
||||||
}
|
}
|
||||||
if (item == iconFault) {
|
if (item == iconFault) {
|
||||||
splash_progress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModelwithFilter("falta")
|
viewModelwithFilter("falta")
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,7 +153,7 @@ class HistoricoFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
toolbar_icons.layoutManager =
|
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -165,13 +164,12 @@ class HistoricoFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
filter_nameordateitem.setOnKeyListener { v, keyCode, event ->
|
binding.filterNameordateitem.setOnKeyListener { v, keyCode, event ->
|
||||||
// //Log.i("VERDNATURA:","El key a filtrar ${filter_nameordateitem.text.toString()}")
|
if (binding.filterNameordateitem.text.toString().isNullOrEmpty()) {
|
||||||
if (filter_nameordateitem.text.toString().isNullOrEmpty()) {
|
|
||||||
if (listHistoric.size != listHistoryAux.size) {
|
if (listHistoric.size != listHistoryAux.size) {
|
||||||
listHistoric.removeAll(listHistoryAux)
|
listHistoric.removeAll(listHistoryAux)
|
||||||
listHistoryAux.forEach {
|
listHistoryAux.forEach {
|
||||||
|
@ -186,7 +184,7 @@ class HistoricoFragment(
|
||||||
|
|
||||||
|
|
||||||
if (it.name != null && (it.name.contains(
|
if (it.name != null && (it.name.contains(
|
||||||
filter_nameordateitem.text.toString(),
|
binding.filterNameordateitem.text.toString(),
|
||||||
true
|
true
|
||||||
))
|
))
|
||||||
) {
|
) {
|
||||||
|
@ -210,13 +208,9 @@ class HistoricoFragment(
|
||||||
loadHistoricoList.observe(viewLifecycleOwner, Observer { event ->
|
loadHistoricoList.observe(viewLifecycleOwner, Observer { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
splash_progress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
listToAdapter(it.list, filter)
|
listToAdapter(it.list, filter)
|
||||||
// //Log.i("VERDNATURA:","el total original es ${it.list.size}")
|
navigateToToday(it)
|
||||||
/* adapter = HistoricoAdapter(it.list)
|
|
||||||
historico_recyclerview.adapter = adapter
|
|
||||||
historico_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)*/
|
|
||||||
navigateToToday(it)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -244,8 +238,8 @@ class HistoricoFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter = HistoricoAdapter(listHistoric)
|
adapter = HistoricoAdapter(listHistoric)
|
||||||
historico_recyclerview.adapter = adapter
|
binding.historicoRecyclerview.adapter = adapter
|
||||||
historico_recyclerview.layoutManager =
|
binding.historicoRecyclerview.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
listHistoryAux.addAll(listHistoric)
|
listHistoryAux.addAll(listHistoric)
|
||||||
|
@ -264,7 +258,7 @@ class HistoricoFragment(
|
||||||
positionToday += 1
|
positionToday += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
historico_recyclerview.scrollToPosition(positionToday)
|
binding.historicoRecyclerview.scrollToPosition(positionToday)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -9,8 +9,10 @@ import kotlinx.android.synthetic.main.toolbar.*
|
||||||
|
|
||||||
|
|
||||||
class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
|
class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.activity_imageview
|
override fun getLayoutId(): Int = R.layout.activity_imageview
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
toolbar_title.text = (intent.getStringExtra("title"))
|
toolbar_title.text = (intent.getStringExtra("title"))
|
||||||
imgView.loadUrl(intent.getStringExtra("url"))
|
imgView.loadUrl(intent.getStringExtra("url"))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.main.activity
|
package es.verdnatura.presentation.view.feature.main.activity
|
||||||
|
|
||||||
|
//import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
@ -11,7 +12,7 @@ import es.verdnatura.databinding.ActivityMainBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.MAINACTIVITY
|
import es.verdnatura.domain.ConstAndValues.MAINACTIVITY
|
||||||
import es.verdnatura.presentation.base.BaseActivity
|
import es.verdnatura.presentation.base.BaseActivity
|
||||||
import es.verdnatura.presentation.common.*
|
import es.verdnatura.presentation.common.*
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialogMainActivity
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
||||||
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
||||||
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemProposalFragment
|
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemProposalFragment
|
||||||
|
@ -50,7 +51,6 @@ import es.verdnatura.presentation.view.feature.smarttag.register.RegisterSmartTa
|
||||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment
|
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -62,7 +62,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
OnCollectionSelectedListener, OnBuyerSelectedListener {
|
OnCollectionSelectedListener, OnBuyerSelectedListener {
|
||||||
|
|
||||||
private var lastBottomMenuItemSelected: ItemMenuVO? = null
|
private var lastBottomMenuItemSelected: ItemMenuVO? = null
|
||||||
private lateinit var customDialog: CustomDialog
|
private lateinit var customDialog: CustomDialogMainActivity
|
||||||
var firstItem: ItemMenuVO? = null
|
var firstItem: ItemMenuVO? = null
|
||||||
var fm = supportFragmentManager
|
var fm = supportFragmentManager
|
||||||
var TAG = "MainActivity"
|
var TAG = "MainActivity"
|
||||||
|
@ -70,7 +70,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
override fun getLayoutId(): Int = R.layout.activity_main
|
override fun getLayoutId(): Int = R.layout.activity_main
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
customDialog = CustomDialog(this)
|
customDialog = CustomDialogMainActivity(this)
|
||||||
setBottomMenu()
|
setBottomMenu()
|
||||||
if (haveSector()) addFragment(
|
if (haveSector()) addFragment(
|
||||||
PasilleroFragment.newInstance("Verdnatura"),
|
PasilleroFragment.newInstance("Verdnatura"),
|
||||||
|
@ -101,7 +101,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setBottomMenu() {
|
private fun setBottomMenu() {
|
||||||
val bottomMenu = main_bottom_navigation
|
val bottomMenu = binding.mainBottomNavigation
|
||||||
bottomMenu.itemIconTintList = null
|
bottomMenu.itemIconTintList = null
|
||||||
GlobalScope.launch(Dispatchers.Main) {
|
GlobalScope.launch(Dispatchers.Main) {
|
||||||
val bottomMenuItems: ArrayList<ItemMenuVO> = ArrayList()
|
val bottomMenuItems: ArrayList<ItemMenuVO> = ArrayList()
|
||||||
|
@ -519,5 +519,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
addFragmentOnTop(ExpeditionStateFragment.newInstance("main"))
|
addFragmentOnTop(ExpeditionStateFragment.newInstance("main"))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
fun hideBottomNavigation(visible:Int){
|
||||||
|
binding.mainBottomNavigation.visibility = visible
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,14 @@ class QrFragment(
|
||||||
|
|
||||||
splash_progress.visibility = View.GONE
|
splash_progress.visibility = View.GONE
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
|
|
||||||
|
customDialog.setTitle("Mensaje")
|
||||||
|
.setDescription("Operación " )
|
||||||
|
.setOkButton("Aceptar") {
|
||||||
|
customDialog.dismiss()
|
||||||
|
backButton.performClick()
|
||||||
|
}.show()
|
||||||
|
|
||||||
setToolbar()
|
setToolbar()
|
||||||
setEvents()
|
setEvents()
|
||||||
super.init()
|
super.init()
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/verdnatura_black">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/main_toolbar"
|
||||||
|
layout="@layout/toolbar"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/splash_progress"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/verdnatura_black_8_alpha_6"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
|
<com.airbnb.lottie.LottieAnimationView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/verdnatura_logo_large_height"
|
||||||
|
app:lottie_autoPlay="true"
|
||||||
|
app:lottie_loop="true"
|
||||||
|
app:lottie_rawRes="@raw/orange_loading"
|
||||||
|
app:lottie_speed="2" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</layout>
|
|
@ -27,14 +27,14 @@
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/textinputlayout_username"
|
android:id="@+id/textinputlayout_scan"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColorHint="@android:color/darker_gray"
|
android:textColorHint="@android:color/darker_gray"
|
||||||
android:layout_marginTop="@dimen/toolbar_height">
|
android:layout_marginTop="@dimen/toolbar_height">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/edit_itemFk"
|
android:id="@+id/scan_input"
|
||||||
style="@style/InputLineTextSearch"
|
style="@style/InputLineTextSearch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:backgroundTint="@android:color/white"
|
android:backgroundTint="@android:color/white"
|
||||||
|
|
Loading…
Reference in New Issue