refs #6810 feat:crashlytics
This commit is contained in:
parent
388081d10e
commit
4a5b09fc56
|
@ -3,7 +3,6 @@ package es.verdnatura.presentation.view.feature.ubicador.fragment
|
|||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.text.InputType
|
||||
import android.text.TextWatcher
|
||||
import android.view.View
|
||||
|
@ -12,7 +11,6 @@ import android.view.View.VISIBLE
|
|||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.ImageView
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
|
@ -22,6 +20,7 @@ import es.verdnatura.domain.notNull
|
|||
import es.verdnatura.domain.toInt
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.Action
|
||||
import es.verdnatura.presentation.common.OnMoreClickListenerNew
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
|
@ -79,7 +78,6 @@ class UbicadorFragmentNew(
|
|||
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun init() {
|
||||
|
||||
setDialogs()
|
||||
|
@ -89,7 +87,7 @@ class UbicadorFragmentNew(
|
|||
//setNewIcons()
|
||||
ma.hideBottomNavigation(GONE)
|
||||
|
||||
if (!shelvingFk.isNullOrEmpty()) {
|
||||
if (shelvingFk.isEmpty()) {
|
||||
isShelvinLogfromMainScreen = false
|
||||
setIconsActions(true)
|
||||
setIcons()
|
||||
|
@ -129,7 +127,6 @@ class UbicadorFragmentNew(
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun setIcons() {
|
||||
|
||||
listIcons.clear()
|
||||
|
@ -165,12 +162,10 @@ class UbicadorFragmentNew(
|
|||
}
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
||||
iconAdd.tooltipText = getString(R.string.addItemShelving)
|
||||
iconReset.tooltipText = getTooltip(R.drawable.ic_remove_checks)
|
||||
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
||||
iconAdd.tooltipText = getString(R.string.addItemShelving)
|
||||
iconReset.tooltipText = getTooltip(R.drawable.ic_remove_checks)
|
||||
|
||||
}
|
||||
listIcons.add(iconAdd)
|
||||
listIcons.add(iconReload)
|
||||
|
||||
|
@ -185,7 +180,7 @@ class UbicadorFragmentNew(
|
|||
|
||||
iconReload.drawable -> {
|
||||
|
||||
if (!shelvingFk.isNullOrEmpty()) {
|
||||
if (shelvingFk.isEmpty()) {
|
||||
binding.editPrioridad.setText("")
|
||||
viewModel.itemShelvingListNew(
|
||||
shelvingFk
|
||||
|
@ -198,8 +193,8 @@ class UbicadorFragmentNew(
|
|||
}
|
||||
|
||||
iconReset.drawable -> {
|
||||
if (!shelvingFk.isNullOrBlank()) {
|
||||
var customDialogReset = CustomDialog(requireContext())
|
||||
if (shelvingFk.isBlank()) {
|
||||
val customDialogReset = CustomDialog(requireContext())
|
||||
customDialogReset.setTitle(getString(R.string.checkItemShelvingDescrip))
|
||||
.setDescription(getString(R.string.checkItemShelving))
|
||||
.setOkButton(getString(R.string.ok)) {
|
||||
|
@ -226,7 +221,6 @@ class UbicadorFragmentNew(
|
|||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun setEvents() {
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
|
@ -237,7 +231,7 @@ class UbicadorFragmentNew(
|
|||
binding.editMatricula.requestFocus()
|
||||
binding.editMatricula.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
if (!binding.editMatricula.text.toString().isNullOrEmpty()) {
|
||||
if (binding.editMatricula.text.toString().isNotEmpty()) {
|
||||
setIconsActions(true)
|
||||
setIcons()
|
||||
if (!modeCheckUbication || (modeCheckUbication && binding.editMatricula.text.toString().length == 3 && !binding.editMatricula.text!![0].isDigit())) {
|
||||
|
@ -275,7 +269,7 @@ class UbicadorFragmentNew(
|
|||
|
||||
binding.editPrioridad.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
if (!binding.editPrioridad.text.toString().isNullOrEmpty()) {
|
||||
if (binding.editPrioridad.text.toString().isNotEmpty()) {
|
||||
viewModel.shelvingPriorityUpdate(
|
||||
binding.editPrioridad.toInt(), shelvingFk
|
||||
)
|
||||
|
@ -291,7 +285,7 @@ class UbicadorFragmentNew(
|
|||
|
||||
|
||||
binding.automaticImg.setOnClickListener {
|
||||
if (!shelvingFk.isNullOrEmpty())
|
||||
if (shelvingFk.isEmpty())
|
||||
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = getString(R.string.titleAuto)), entryPoint = shelvingFk
|
||||
|
@ -302,7 +296,7 @@ class UbicadorFragmentNew(
|
|||
}
|
||||
|
||||
binding.parkingImg.setOnClickListener {
|
||||
if (!shelvingFk.isNullOrBlank()) {
|
||||
if (shelvingFk.isBlank()) {
|
||||
customDialogInput.setTitle(getString(R.string.parkingShelving)).setValue("")
|
||||
.setOkButton(
|
||||
getString(
|
||||
|
@ -335,10 +329,10 @@ class UbicadorFragmentNew(
|
|||
}
|
||||
|
||||
binding.editImg.setOnClickListener {
|
||||
if (!shelvingFk.isNullOrBlank()) {
|
||||
if (shelvingFk.isBlank()) {
|
||||
customDialogInput.setTitle(getString(R.string.changeShelving)).setValue("")
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
if (!customDialogInput.getValue().isNullOrBlank()) {
|
||||
if (customDialogInput.getValue().isNotBlank()) {
|
||||
customDialogActionChange()
|
||||
} else {
|
||||
getString(R.string.errorShelving).toast(
|
||||
|
@ -368,34 +362,34 @@ class UbicadorFragmentNew(
|
|||
}
|
||||
|
||||
binding.deleteImg.setOnClickListener {
|
||||
if (!shelvingFk.isNullOrBlank()) {
|
||||
var customDialogDelete = CustomDialog(requireContext())
|
||||
customDialogDelete.setTitle(getString(R.string.empty))
|
||||
.setDescription(getString(R.string.operationNoReturn))
|
||||
.setOkButton(getString(R.string.empty)) {
|
||||
if (shelvingFk.isNotBlank()) {
|
||||
val customDialogDelete = CustomDialog(requireContext())
|
||||
customDialogDelete.setTitle(getString(R.string.empty))
|
||||
.setDescription(getString(R.string.operationNoReturn))
|
||||
.setOkButton(getString(R.string.empty)) {
|
||||
|
||||
viewModel.clearShelvingList(
|
||||
shelvingFk
|
||||
)
|
||||
listItems.forEach {
|
||||
it.stickers = 0
|
||||
it.visible = 0
|
||||
}
|
||||
if (adapter != null) {
|
||||
adapter!!.notifyDataSetChanged()
|
||||
viewModel.clearShelvingList(
|
||||
shelvingFk
|
||||
)
|
||||
listItems.forEach {
|
||||
it.stickers = 0
|
||||
it.visible = 0
|
||||
}
|
||||
if (adapter != null) {
|
||||
adapter!!.notifyDataSetChanged()
|
||||
}
|
||||
customDialogDelete.dismiss()
|
||||
}
|
||||
|
||||
customDialogDelete.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogDelete.dismiss()
|
||||
}
|
||||
}.show()
|
||||
} else {
|
||||
getString(R.string.errorShelving).toast(
|
||||
requireContext()
|
||||
)
|
||||
|
||||
customDialogDelete.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogDelete.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
getString(R.string.errorShelving).toast(
|
||||
requireContext()
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -403,7 +397,9 @@ class UbicadorFragmentNew(
|
|||
private fun customDialogActionParking() {
|
||||
parking = customDialogInput.getValue()
|
||||
//Tarea 6964
|
||||
/* viewModel.hasItemOlder(shelvingFk,customDialogInput.getValue())*/
|
||||
/* viewModel.hasItemOlder(shelvingFk,customDialogInput.getValue(),
|
||||
action = Action.PARKINEAR
|
||||
)*/
|
||||
viewModel.setParking(
|
||||
shelvingFk, customDialogInput.getValue()
|
||||
)
|
||||
|
@ -447,14 +443,13 @@ class UbicadorFragmentNew(
|
|||
}
|
||||
|
||||
private fun setTooltips() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
binding.editImg.tooltipText = getTooltip(R.drawable.ic_mode_edit_black_24dp)
|
||||
binding.deleteImg.tooltipText = getTooltip(R.drawable.ic_delete_forever_black_24dp)
|
||||
binding.editPrioridad.tooltipText = getString(R.string.changePriority)
|
||||
binding.parkingImg.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
||||
binding.automaticImg.tooltipText = getTooltip(R.drawable.ic_flash_auto_black_24dp)
|
||||
|
||||
}
|
||||
binding.editImg.tooltipText = getTooltip(R.drawable.ic_mode_edit_black_24dp)
|
||||
binding.deleteImg.tooltipText = getTooltip(R.drawable.ic_delete_forever_black_24dp)
|
||||
binding.editPrioridad.tooltipText = getString(R.string.changePriority)
|
||||
binding.parkingImg.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
||||
binding.automaticImg.tooltipText = getTooltip(R.drawable.ic_flash_auto_black_24dp)
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
|
@ -521,7 +516,7 @@ class UbicadorFragmentNew(
|
|||
|
||||
responseMake.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (!shelvingFk.isNullOrEmpty()) {
|
||||
if (shelvingFk.isNotEmpty()) {
|
||||
binding.mainToolbar.toolbarTitle.text = shelvingFk
|
||||
viewModel.itemShelvingListNew(
|
||||
shelvingFk
|
||||
|
@ -532,17 +527,29 @@ class UbicadorFragmentNew(
|
|||
|
||||
responseHasOlder.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
ma.messageWithSound("", true, true, "", false)
|
||||
// ma.messageWithSound("", true, true, "", false)
|
||||
customDialogOlder.setTitle(getString(R.string.info))
|
||||
.setDescription(getString(R.string.itemOlderInfo, shelvingFk))
|
||||
.setDescription(
|
||||
getString(
|
||||
R.string.itemOlderInfo,
|
||||
responseHasOlder.value!!.action
|
||||
)
|
||||
)
|
||||
.setOkButton(
|
||||
getString(R.string.ok)
|
||||
) {
|
||||
when (responseHasOlder.value!!.action) {
|
||||
Action.PARKINEAR -> viewModel.setParking(
|
||||
responseHasOlder.value!!.shelvingFkIn,
|
||||
parking
|
||||
)
|
||||
|
||||
Action.TRANSFERIR -> viewModel.itemShelvingTransfer(
|
||||
responseHasOlder.value!!.itemFk!!,
|
||||
responseHasOlder.value!!.shelvingFkOut!!
|
||||
)
|
||||
}
|
||||
customDialogOlder.dismiss()
|
||||
//customDialogActionParking()
|
||||
viewModel.setParking(
|
||||
shelvingFk, parking
|
||||
)
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogOlder.dismiss()
|
||||
|
@ -641,7 +648,7 @@ class UbicadorFragmentNew(
|
|||
|
||||
if (isEditItem) {
|
||||
customDialogUbicador.setTitle(getString(R.string.editItem) + itemUbicador!!.item)
|
||||
.setItemValue(itemUbicador!!.item.toString())
|
||||
.setItemValue(itemUbicador.item.toString())
|
||||
.setPackingValue(itemUbicador.packing.toString())
|
||||
.setVisibleValue(itemUbicador.visible.toString())
|
||||
.setEtiquetaValue((itemUbicador.visible / (itemUbicador.packing ?: 0)).toString())
|
||||
|
@ -670,7 +677,7 @@ class UbicadorFragmentNew(
|
|||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
|
||||
if (!customDialogUbicador.getItemValue().isNullOrEmpty()) {
|
||||
if (customDialogUbicador.getItemValue().isNotEmpty()) {
|
||||
try {
|
||||
|
||||
customDialogUbicador.setItemValue(
|
||||
|
@ -705,14 +712,14 @@ class UbicadorFragmentNew(
|
|||
try {
|
||||
|
||||
if (customDialogUbicador.getItemValue()
|
||||
.isNullOrEmpty() || customDialogUbicador.getPackingValue().isNullOrBlank()
|
||||
.isEmpty() || customDialogUbicador.getPackingValue().isBlank()
|
||||
) {
|
||||
getString(R.string.itemAndPackingMandatory).toast(context)
|
||||
} else {
|
||||
saveItemCall(customDialogUbicador, itemUbicador)
|
||||
customDialogUbicador.dismiss()
|
||||
}
|
||||
} catch(ex:Exception){
|
||||
} catch (ex: Exception) {
|
||||
ex.message!!.toast(requireContext())
|
||||
}
|
||||
}
|
||||
|
@ -725,7 +732,7 @@ class UbicadorFragmentNew(
|
|||
if (itemUbicador?.id == null) {
|
||||
viewModel.itemShelvingAdd(
|
||||
shelving = shelvingFk,
|
||||
item = customDialogUbicador.getItemValue().toLong()!!,
|
||||
item = customDialogUbicador.getItemValue().toLong(),
|
||||
quantity = customDialogUbicador.getVisibleValue().toIntOrNull()!!,
|
||||
packing = customDialogUbicador.getPackingValue().toIntOrNull(),
|
||||
warehouse = mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK),
|
||||
|
@ -736,8 +743,8 @@ class UbicadorFragmentNew(
|
|||
viewModel.itemShelvingMakeEdit(
|
||||
customDialogUbicador.getVisibleValue().toIntOrNull()!!,
|
||||
customDialogUbicador.getPackingValue().toInt(),
|
||||
itemUbicador?.id!!,
|
||||
itemUbicador?.grouping
|
||||
itemUbicador.id,
|
||||
itemUbicador.grouping
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -777,7 +784,7 @@ class UbicadorFragmentNew(
|
|||
customDialogInput.setTitle(getString(R.string.shelvingNew))
|
||||
.setDescription(getString(R.string.selectDestiny) + item.item).setValue("")
|
||||
.setOkButton(getString(R.string.transfer)) {
|
||||
customDialogInputAction(item)
|
||||
customDialogTransferAction(item)
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogInput.dismiss()
|
||||
|
@ -786,14 +793,14 @@ class UbicadorFragmentNew(
|
|||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
customDialogInputAction(item)
|
||||
customDialogTransferAction(item)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
customDialogTwoButtons.dismiss()
|
||||
}.setOkButtonTwo(getString(R.string.delete)) {
|
||||
var customDialogConfirm = CustomDialog(requireContext())
|
||||
val customDialogConfirm = CustomDialog(requireContext())
|
||||
customDialogConfirm.setTitle(getString(R.string.confirm)).setDescription(
|
||||
if (!isAutoSelf) {
|
||||
getString(R.string.itemDeleteConfirm) + item.item + "?"
|
||||
|
@ -830,8 +837,12 @@ class UbicadorFragmentNew(
|
|||
customDialogTwoButtons.show()
|
||||
}
|
||||
|
||||
private fun customDialogInputAction(item: ItemUbicador) {
|
||||
private fun customDialogTransferAction(item: ItemUbicador) {
|
||||
if (customDialogInput.getValue().isNotEmpty()) {
|
||||
/* Tarea 6964
|
||||
viewModel.hasItemOlder(shelvingFkIn = shelvingFk , shelvingFkOut = customDialogInput.getValue(),itemFk = item.id,
|
||||
action = Action.TRANSFERIR
|
||||
)*/
|
||||
viewModel.itemShelvingTransfer(
|
||||
item.id, customDialogInput.getValue()
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue