refs #5135 feat: refactor animation

This commit is contained in:
Sergio De la torre 2024-01-09 08:50:35 +01:00
parent c264406f0e
commit 5910b8dabd
17 changed files with 221 additions and 917 deletions

View File

@ -2,9 +2,7 @@
package es.verdnatura.presentation.view.feature.claim.fragment package es.verdnatura.presentation.view.feature.claim.fragment
import android.view.View.GONE import android.view.View.GONE
import android.view.View.VISIBLE
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
@ -32,20 +30,14 @@ class ClaimFragment(
private var listClaims: ArrayList<GeneralItem> = ArrayList() private var listClaims: ArrayList<GeneralItem> = ArrayList()
private var claimAdapter: GeneralAdapter? = null private var claimAdapter: GeneralAdapter? = null
companion object { companion object {
fun newInstance(entryPoint: String) = ClaimFragment(entryPoint) fun newInstance(entryPoint: String) = ClaimFragment(entryPoint)
} }
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
goBack = false
ma.hideBottomNavigation(GONE)
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
setEvents() setEvents()
setToolBar() setToolBar()
setAdapter() setAdapter()
@ -53,22 +45,15 @@ class ClaimFragment(
super.init() super.init()
} }
override fun onPause() {
goBack = true
super.onPause()
}
private fun setToolBar() { private fun setToolBar() {
ma.hideBottomNavigation(GONE)
binding.mainToolbar.toolbarTitle.text = entryPoint binding.mainToolbar.toolbarTitle.text = entryPoint
} }
private fun setAdapter() { private fun setAdapter() {
claimAdapter = GeneralAdapter(listClaims, object : OnGeneralItemRowClickListener { claimAdapter = GeneralAdapter(listClaims, object : OnGeneralItemRowClickListener {
override fun OnGeneralItemRowClickListener(item: GeneralItem) { override fun OnGeneralItemRowClickListener(item: GeneralItem) {
} }
}) })
customDialogList.getRecyclerView().adapter = claimAdapter customDialogList.getRecyclerView().adapter = claimAdapter
@ -76,20 +61,9 @@ class ClaimFragment(
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
} }
private fun itemShelving_addByClaim(shelving: String) {
binding.splashProgress.visibility = VISIBLE
viewModel.itemShelvingAddByClaim(
listClaims.first().code!!.toInt(),
shelving
)
customDialogList.dismiss()
}
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
customDialogList.dismiss() customDialogList.dismiss()
requireActivity().onBackPressed() requireActivity().onBackPressed()
@ -97,104 +71,71 @@ class ClaimFragment(
} }
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
binding.splashProgress.visibility = GONE
responseadd.observe(viewLifecycleOwner, Observer { responseadd.observe(viewLifecycleOwner, Observer {
customDialogList.dismiss()
listClaims.clear()
claimAdapter!!.notifyDataSetChanged()
showInputClaim()
if (it.isError) {
customDialogList.dismiss()
listClaims.clear()
claimAdapter!!.notifyDataSetChanged()
showInputClaim()
ma.messageWithSound(it.errorMessage, true, false)
} else {
customDialogList.dismiss()
ma.messageWithSound(
getString(R.string.claimLabel) + listClaims.first().code + getString(R.string.keepPlate) +
listClaims.get(
1
).code, false, true
)
listClaims.clear()
claimAdapter!!.notifyDataSetChanged()
showInputClaim()
}
binding.splashProgress.visibility = GONE
}) })
} }
} }
private fun getTextToPosition(TagsScaned: Int): String { private fun getTextToPosition(tagsScaned: Int): String {
var message = getString(R.string.dataCompllete) var message = getString(R.string.dataCompllete)
when (tagsScaned) {
when (TagsScaned) {
1 -> message = getString(R.string.scanShelving) 1 -> message = getString(R.string.scanShelving)
} }
return message return message
} }
private fun getTextScaned(TagScaned: Int): String { private fun getTextScaned(tagScaned: Int): String {
var message = "" var message = ""
when (tagScaned) {
when (TagScaned) {
1 -> message = getString(R.string.claimLabel) 1 -> message = getString(R.string.claimLabel)
2 -> message = getString(R.string.shelving) 2 -> message = getString(R.string.shelving)
} }
return message return message
} }
private fun add_item(itemScaned: String) { private fun addItem(itemScaned: String) {
val nameClaim: String = getTextScaned(listClaims.size + 1) + itemScaned val nameClaim: String = getTextScaned(listClaims.size + 1) + itemScaned
customDialogList.setTitle(getTextToPosition(listClaims.size + 1)) customDialogList.setTitle(getTextToPosition(listClaims.size + 1))
listClaims.add(GeneralItem(itemScaned, nameClaim)) listClaims.add(GeneralItem(itemScaned, nameClaim))
claimAdapter!!.notifyDataSetChanged() claimAdapter!!.notifyDataSetChanged()
} }
private fun showInputClaim() { private fun showInputClaim() {
customDialogList.setTitle(getString(R.string.insertClaimCode)) customDialogList.setTitle(getString(R.string.insertClaimCode))
.setOkButton(getString(R.string.end)) { .setOkButton(getString(R.string.end)) {
ma.hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss() customDialogList.dismiss()
requireActivity().onBackPressed() requireActivity().onBackPressed()
}.setValue("").show() }.setValue("").show()
customDialogList.getEditText().requestFocus() customDialogList.getEditText().requestFocus()
ma.hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!customDialogList.getValue().isEmpty()) { if (customDialogList.getValue().isNotEmpty()) {
addItem(customDialogList.getValue())
add_item(customDialogList.getValue())
if (listClaims.size > 1) { if (listClaims.size > 1) {
viewModel.itemShelvingAddByClaim(
itemShelving_addByClaim(customDialogList.getValue().uppercase()) listClaims.first().code!!.toInt(),
customDialogList.getValue().uppercase()
)
customDialogList.dismiss()
} }
} }
@ -204,13 +145,6 @@ class ClaimFragment(
} }
false false
} }
hideKeyboard() hideKeyboard()
} }
}
}

View File

@ -23,6 +23,7 @@ class ClaimViewModel(val context: Context) : BaseViewModel(context) {
salix.itemShelvingAddByClaim(arrayListOf(claimFK, shelvingFK).formatWithQuotes()) salix.itemShelvingAddByClaim(arrayListOf(claimFK, shelvingFK).formatWithQuotes())
.enqueue(object : SalixCallback<Unit>(context) { .enqueue(object : SalixCallback<Unit>(context) {
override fun onSuccess(response: Response<Unit>) { override fun onSuccess(response: Response<Unit>) {
_responseadd.value = ResponseItemVO( _responseadd.value = ResponseItemVO(
isError = false, isError = false,
errorMessage = getMessageFromAllResponse( errorMessage = getMessageFromAllResponse(
@ -30,15 +31,7 @@ class ClaimViewModel(val context: Context) : BaseViewModel(context) {
response.message() response.message()
) )
) )
super.onSuccess(response)
}
override fun onError(t: Throwable) {
_responseadd.value = ResponseItemVO(
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), t.message!!
)
)
} }
}) })

View File

@ -32,19 +32,16 @@ import es.verdnatura.presentation.view.feature.inventario.model.ItemShelvingVisi
import es.verdnatura.presentation.view.feature.inventario.model.ItemShelvingVisibleZero import es.verdnatura.presentation.view.feature.inventario.model.ItemShelvingVisibleZero
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
@Suppress("UNUSED_ANONYMOUS_PARAMETER") @Suppress("UNUSED_ANONYMOUS_PARAMETER")
class InventaryParkingFragment( class InventaryParkingFragment(
var title: String = "", var title: String = "",
) : BaseFragment<FragmentInventoryParkingBinding, InventaryViewModel>( ) : BaseFragment<FragmentInventoryParkingBinding, InventaryViewModel>(
InventaryViewModel::class InventaryViewModel::class
) { ) {
private var adapter: InventoryParkingAdapter? = null private var adapter: InventoryParkingAdapter? = null
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private var isBack = false private var isBack = false
private lateinit var myListInventory: MutableList<ItemInventoryParking> private lateinit var myListInventory: MutableList<ItemInventoryParking>
private var listParkings: ArrayList<BarcodeVO> = ArrayList() private var listParkings: ArrayList<BarcodeVO> = ArrayList()
@ -59,8 +56,7 @@ class InventaryParkingFragment(
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
companion object { companion object {
fun newInstance(title: String) = fun newInstance(title: String) = InventaryParkingFragment(title)
InventaryParkingFragment(title)
} }
override fun getLayoutId(): Int = R.layout.fragment_inventory_parking override fun getLayoutId(): Int = R.layout.fragment_inventory_parking
@ -79,7 +75,6 @@ class InventaryParkingFragment(
} }
override fun onAttach(context: Context) { override fun onAttach(context: Context) {
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
super.onAttach(context) super.onAttach(context)
@ -113,11 +108,9 @@ class InventaryParkingFragment(
}) })
} }
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
private fun setToolBar() { private fun setToolBar() {
val iconAdd = ImageView(context) val iconAdd = ImageView(context)
iconAdd.setImageResource(R.drawable.ic_add_black_24dp) iconAdd.setImageResource(R.drawable.ic_add_black_24dp)
@ -162,13 +155,11 @@ class InventaryParkingFragment(
iconFilter.drawable -> { iconFilter.drawable -> {
try { try {
filterActivated = !filterActivated filterActivated = !filterActivated
adapter!!.setItems( adapter!!.setItems(if (filterActivated) {
if (filterActivated) { myListInventory.filter { it.isChecked == null || it.isChecked == 0 }
myListInventory.filter { it.isChecked == null || it.isChecked == 0 } } else {
} else { myListInventory
myListInventory })
}
)
iconFilter.drawable.setTint( iconFilter.drawable.setTint(
ContextCompat.getColor( ContextCompat.getColor(
context!!, context!!,
@ -205,7 +196,6 @@ class InventaryParkingFragment(
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
} }
private fun chageListAdapter(filterList: List<ImageView>, removeReset: Boolean = false) { private fun chageListAdapter(filterList: List<ImageView>, removeReset: Boolean = false) {
if (!removeReset) { if (!removeReset) {
(binding.mainToolbar.toolbarIcons.adapter as ToolBarAdapterTooltip).setItemsList( (binding.mainToolbar.toolbarIcons.adapter as ToolBarAdapterTooltip).setItemsList(
@ -230,17 +220,14 @@ class InventaryParkingFragment(
.setDescription(getString(R.string.checkItemShelvingSelect)) .setDescription(getString(R.string.checkItemShelvingSelect))
.setOkButton(getString(R.string.cancel)) { .setOkButton(getString(R.string.cancel)) {
customDialogInput.dismiss() customDialogInput.dismiss()
} }.setKoButton(getString(R.string.ok)) {
.setKoButton(getString(R.string.ok)) {
checkSelvingsForUpdate(customDialogInput.getValue()) checkSelvingsForUpdate(customDialogInput.getValue())
} }.show()
.show()
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ -> customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
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 (customDialogInput.getValue().isNotEmpty() if (customDialogInput.getValue().isNotEmpty()) {
) {
checkSelvingsForUpdate(customDialogInput.getValue()) checkSelvingsForUpdate(customDialogInput.getValue())
} }
return@setOnEditorActionListener true return@setOnEditorActionListener true
@ -262,12 +249,9 @@ class InventaryParkingFragment(
if (inqValues.size() == 0) { if (inqValues.size() == 0) {
ma.messageWithSound("", true, true, "", null) ma.messageWithSound("", true, true, "", null)
} else { } else {
filter.add("id", JsonObject().apply { add("inq", inqValues) }) filter.add("id", JsonObject().apply { add("inq", inqValues) })
binding.splashProgress.visibility = VISIBLE
viewModel.itemShelvingsReset( viewModel.itemShelvingsReset(
filter, filter, ItemShelvingChecked(null, mobileApplication.userId!!)
ItemShelvingChecked(null, mobileApplication.userId!!)
) )
} }
ma.hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
@ -292,7 +276,7 @@ class InventaryParkingFragment(
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogList.getEditText().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 (!customDialogList.getValue().isEmpty()) { if (customDialogList.getValue().isNotEmpty()) {
try { try {
if (listParkings.size == 1) { if (listParkings.size == 1) {
@ -301,7 +285,6 @@ class InventaryParkingFragment(
customDialogList.getValue().uppercase() customDialogList.getValue().uppercase()
) )
ma.hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
listParkings.clear() listParkings.clear()
customDialogList.dismiss() customDialogList.dismiss()
@ -311,7 +294,6 @@ class InventaryParkingFragment(
listParkings.add(0, BarcodeVO(code = customDialogList.getValue())) listParkings.add(0, BarcodeVO(code = customDialogList.getValue()))
} }
} catch (e: Exception) { } catch (e: Exception) {
ma.messageWithSound(e.message.toString(), true, true, "", true) ma.messageWithSound(e.message.toString(), true, true, "", true)
} }
@ -326,8 +308,7 @@ class InventaryParkingFragment(
} }
listWagonsAdapter = BarcodeAdapter( listWagonsAdapter = BarcodeAdapter(
listParkings, listParkings, object : OnBarcodeRowClickListener {
object : OnBarcodeRowClickListener {
override fun onBarcodeRowClickListener(item: BarcodeVO) { override fun onBarcodeRowClickListener(item: BarcodeVO) {
} }
@ -341,12 +322,10 @@ class InventaryParkingFragment(
} }
private fun callGetInventory(parkingFromScan: String, parkingToScan: String) { private fun callGetInventory(parkingFromScan: String, parkingToScan: String) {
binding.splashProgress.visibility = VISIBLE
parkingFrom = parkingFromScan parkingFrom = parkingFromScan
parkingTo = parkingToScan parkingTo = parkingToScan
viewModel.getInventoryParking( viewModel.getInventoryParking(
parkingFromScan, parkingFromScan, parkingToScan
parkingToScan
) )
binding.mainToolbar.toolbarTitle.text = "$parkingFrom$parkingTo" binding.mainToolbar.toolbarTitle.text = "$parkingFrom$parkingTo"
} }
@ -364,11 +343,8 @@ class InventaryParkingFragment(
positionShelvingChecking = -1 positionShelvingChecking = -1
positionItemChecking = -1 positionItemChecking = -1
shelvingSaved = "" shelvingSaved = ""
binding.splashProgress.visibility = VISIBLE
viewModel.getInventoryParking( viewModel.getInventoryParking(
parkingFrom, parkingFrom, parkingTo
parkingTo
) )
binding.editMatricula.hint = getString(R.string.scanShelving) binding.editMatricula.hint = getString(R.string.scanShelving)
@ -394,9 +370,7 @@ class InventaryParkingFragment(
try { try {
binding.editMatricula.setText( binding.editMatricula.setText(
itemScanValue( itemScanValue(
binding.editMatricula.text.toString(), binding.editMatricula.text.toString(), "buy", "more"
"buy",
"more"
).toString() ).toString()
) )
} catch (ex: Exception) { } catch (ex: Exception) {
@ -422,11 +396,7 @@ class InventaryParkingFragment(
if (allChecked) { if (allChecked) {
ma.messageWithSound( ma.messageWithSound(
getString(R.string.plateChecked), getString(R.string.plateChecked), false, true, "", isToasted = true
false,
true,
"",
isToasted = true
) )
chageListAdapter(listIcons) chageListAdapter(listIcons)
adapter!!.setItems(myListInventory.filter { it.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk }) adapter!!.setItems(myListInventory.filter { it.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk })
@ -436,16 +406,11 @@ class InventaryParkingFragment(
binding.editMatricula.hint = getString(R.string.scanShelving) binding.editMatricula.hint = getString(R.string.scanShelving)
binding.textinputlayoutMatricula.hint = getString(R.string.scanShelving) binding.textinputlayoutMatricula.hint = getString(R.string.scanShelving)
} else { } else {
if (positionShelvingChecking == -1) { if (positionShelvingChecking == -1) {
ma.messageWithSound( ma.messageWithSound(
getString(R.string.shelvingNotFound), getString(R.string.shelvingNotFound), true, true, "", true
true,
true,
"",
true
) )
} else { } else {
@ -456,7 +421,6 @@ class InventaryParkingFragment(
binding.textinputlayoutMatricula.hint = binding.textinputlayoutMatricula.hint =
getString(R.string.scanItemForChecking) getString(R.string.scanItemForChecking)
} }
} }
} else { } else {
@ -465,9 +429,7 @@ class InventaryParkingFragment(
viewModel.getIdFromCodeSalix( viewModel.getIdFromCodeSalix(
code = itemScanValue( code = itemScanValue(
binding.editMatricula.text.toString(), binding.editMatricula.text.toString(), "buy", "more"
"buy",
"more"
).toString() ).toString()
) )
@ -475,7 +437,6 @@ class InventaryParkingFragment(
ma.messageWithSound(ex.message!!, true, true, "", null) ma.messageWithSound(ex.message!!, true, true, "", null)
} }
} }
binding.editMatricula.setText("") binding.editMatricula.setText("")
ma.hideKeyboard(binding.editMatricula) ma.hideKeyboard(binding.editMatricula)
@ -485,24 +446,17 @@ class InventaryParkingFragment(
return@setOnEditorActionListener false return@setOnEditorActionListener false
} }
} }
private fun checkItem(itemCode: String) { private fun checkItem(itemCode: String) {
println("itemCode es $itemCode")
positionItemChecking = myListInventory.indexOfFirst { item -> positionItemChecking = myListInventory.indexOfFirst { item ->
item.itemFk == itemCode item.itemFk == itemCode.toInt() && item.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk && item.isChecked == null
.toInt() && item.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk && item.isChecked == null
} }
if (positionItemChecking == -1) { if (positionItemChecking == -1) {
ma.messageWithSound( ma.messageWithSound(
getString(R.string.itemNotFoundScanAgain), getString(R.string.itemNotFoundScanAgain), true, true, "", true
true,
true,
"",
true
) )
positionShelvingChecking = -1 positionShelvingChecking = -1
@ -510,7 +464,6 @@ class InventaryParkingFragment(
} else { } else {
try { try {
binding.splashProgress.visibility = VISIBLE
viewModel.itemShelvingUpdate( viewModel.itemShelvingUpdate(
myListInventory[positionItemChecking].id, myListInventory[positionItemChecking].id,
ItemShelvingChecked(true, mobileApplication.userId!!) ItemShelvingChecked(true, mobileApplication.userId!!)
@ -542,14 +495,11 @@ class InventaryParkingFragment(
with(viewModel) { with(viewModel) {
inventoryListParking.observe(viewLifecycleOwner, Observer { inventoryListParking.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
if (it.list.isNotEmpty()) { if (it.list.isNotEmpty()) {
if (it.list[0].isError) { if (it.list[0].isError) {
ma.messageWithSound( ma.messageWithSound(
it.list[0].errorMessage, it.list[0].errorMessage, it.list[0].isError, false
it.list[0].isError,
false
) )
} else { } else {
@ -565,46 +515,22 @@ class InventaryParkingFragment(
loadReponseCode.observe(viewLifecycleOwner) { event -> loadReponseCode.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { event.getContentIfNotHandled().notNull {
binding.splashProgress.visibility = GONE checkItem(it.response)
if (it.isError) {
ma.messageWithSound(it.errorMessage, it.isError, true)
} else {
checkItem(it.response)
}
} }
} }
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE chageListAdapter(listIcons, true)
if (it.isError) { callGetInventory(
ma.messageWithSound(it.errorMessage, it.isError, true) parkingFrom, parkingTo
)
} else {
ma.messageWithSound("", it.isError, true, isToasted = false)
chageListAdapter(listIcons, true)
callGetInventory(
parkingFrom,
parkingTo
)
}
}) })
responseReset.observe(viewLifecycleOwner, Observer { responseReset.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE callGetInventory(
if (it.isError) { parkingFrom, parkingTo
ma.messageWithSound(it.errorMessage, it.isError, true) )
chageListAdapter(listIcons, true)
} else {
ma.messageWithSound("", it.isError, true, isToasted = false)
callGetInventory(
parkingFrom,
parkingTo
)
chageListAdapter(listIcons, true)
}
}) })
} }
@ -613,21 +539,20 @@ class InventaryParkingFragment(
private fun createListInventoryParking( private fun createListInventoryParking(
) { ) {
adapter = InventoryParkingAdapter( adapter = InventoryParkingAdapter((if (filterActivated) {
(if (filterActivated) { if (!shelvingSaved.isNullOrEmpty()) {
if (!shelvingSaved.isNullOrEmpty()) { myListInventory.filter { (it.isChecked == null || it.isChecked == 0) && it.shelvingFk == shelvingSaved }
myListInventory.filter { (it.isChecked == null || it.isChecked == 0) && it.shelvingFk == shelvingSaved }
} else {
myListInventory.filter { it.isChecked == null || it.isChecked == 0 }
}
} else { } else {
if (!shelvingSaved.isNullOrEmpty()) { myListInventory.filter { it.isChecked == null || it.isChecked == 0 }
myListInventory.filter { it.shelvingFk == shelvingSaved } }
} else {
myListInventory } else {
} if (!shelvingSaved.isNullOrEmpty()) {
}), myListInventory.filter { it.shelvingFk == shelvingSaved }
} else {
myListInventory
}
}),
onPasillerosItemClickListener = pasillerosItemClickListener!!, onPasillerosItemClickListener = pasillerosItemClickListener!!,
onVisibleInventoryClickListener = object : OnVisibleInventoryClickListener { onVisibleInventoryClickListener = object : OnVisibleInventoryClickListener {
override fun onVisibleInventoryClickListener(item: ItemInventoryParking) { override fun onVisibleInventoryClickListener(item: ItemInventoryParking) {
@ -637,19 +562,15 @@ class InventaryParkingFragment(
}, },
onMoreClickListener = object : OnMoreClickListener { onMoreClickListener = object : OnMoreClickListener {
override fun onMoreClickListener(item: ItemUbicadorVO) { override fun onMoreClickListener(item: ItemUbicadorVO) {
// showMoreOptions(item)
} }
}) })
binding.inventoryParkingRecyclerview.adapter = adapter binding.inventoryParkingRecyclerview.adapter = adapter
binding.inventoryParkingRecyclerview.layoutManager = binding.inventoryParkingRecyclerview.layoutManager = LinearLayoutManager(
LinearLayoutManager( requireContext(), LinearLayoutManager.VERTICAL, false
requireContext(), )
LinearLayoutManager.VERTICAL,
false
)
} }
@ -657,22 +578,18 @@ class InventaryParkingFragment(
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER) customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
customDialogInput.setTitle(getString(R.string.quantity)) customDialogInput.setTitle(getString(R.string.quantity))
customDialogInput.setDescription(getString(R.string.quantityVisible)) customDialogInput.setDescription(getString(R.string.quantityVisible)).setValue("")
.setValue("")
.setOkButton(getString(R.string.modify)) { .setOkButton(getString(R.string.modify)) {
try { try {
if (customDialogInput.getValue().toInt() >= 0) { if (customDialogInput.getValue().toInt() >= 0) {
binding.splashProgress.visibility = VISIBLE
viewModel.itemShelvingUpdate( viewModel.itemShelvingUpdate(
item.id, item.id, if (customDialogInput.getValue().toInt() == 0) {
if (customDialogInput.getValue().toInt() == 0) {
ItemShelvingVisibleZero(customDialogInput.getValue().toInt(), true) ItemShelvingVisibleZero(customDialogInput.getValue().toInt(), true)
} else { } else {
ItemShelvingVisible(customDialogInput.getValue().toInt()) ItemShelvingVisible(customDialogInput.getValue().toInt())
} }
) )
} else { } else {
throw Exception("") throw Exception("")
} }
@ -688,60 +605,4 @@ class InventaryParkingFragment(
customDialogInput.setFocusText() customDialogInput.setFocusText()
} }
}
/* private fun showMoreOptions(item: ItemUbicadorVO) {
customDialogTwoButtons.setTitle(item.item.toString())
.setDescription(getString(R.string.selectAction))
.setOkButton(getString(R.string.transfer)) {
customDialogInput.setTitle(getString(R.string.shelvingNew))
.setDescription(getString(R.string.selectDestiny) + item.item)
.setValue("")
.setOkButton(getString(R.string.transfer)) {
if (customDialogInput.getValue().isNotEmpty()) {
binding.splashProgress.visibility = VISIBLE
listItems.remove(item)
adapter!!.notifyDataSetChanged()
customDialogInput.dismiss()
} else {
getString(R.string.wagonIncorrect).toast(requireContext())
}
}.setKoButton(getString(R.string.cancel)) {
customDialogInput.dismiss()
}.show()
customDialogInput.getEditText().requestFocus()
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText()
.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
listItems.remove(item)
adapter!!.notifyDataSetChanged()
customDialogInput.dismiss()
return@setOnEditorActionListener true
}
false
}
customDialogTwoButtons.dismiss()
}.setOkButtonTwo(getString(R.string.delete)) {
customDialog.setTitle(getString(R.string.confirm))
.setDescription(
getString(R.string.deleteQuantity) + item.item
)
.setOkButton(getString(R.string.delete)) {
}.setKoButton(getString(R.string.cancel)) {
customDialog.dismiss()
customDialogTwoButtons.dismiss()
}.show()
}.setKoButton(getString(R.string.cancel)) {
customDialogTwoButtons.dismiss()
}.show()
}*/
}

View File

@ -6,7 +6,6 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import com.google.gson.JsonObject import com.google.gson.JsonObject
import es.verdnatura.MobileApplication import es.verdnatura.MobileApplication
import es.verdnatura.R
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.SilexCallback import es.verdnatura.domain.SilexCallback
import es.verdnatura.domain.formatWithQuotes import es.verdnatura.domain.formatWithQuotes
@ -79,21 +78,20 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
//sergio para obtener comprador //sergio para obtener comprador
fun itemShelvingBuyerGet() { fun itemShelvingBuyerGet() {
salix.getBuyers("""{"order":"nickname"}""").enqueue(object : salix.getBuyers("""{"order":"nickname"}""")
SalixCallback<List<BuyerVO>>(context) { .enqueue(object : SalixCallback<List<BuyerVO>>(context) {
override fun onSuccess(response: Response<List<BuyerVO>>) { override fun onSuccess(response: Response<List<BuyerVO>>) {
_buyersList.value = response.body()?.let { BuyerListVO(it) } _buyersList.value = response.body()?.let { BuyerListVO(it) }
} }
}) })
} }
val loadInventaryList = Transformations.map(_inventaryList) { Event(it) } val loadInventaryList = Transformations.map(_inventaryList) { Event(it) }
fun getInventory(buyerFk: Int, warehouseFk: Int) { fun getInventory(buyerFk: Int, warehouseFk: Int) {
salix.itemShelvingFilterBuyer(params = arrayListOf(buyerFk, warehouseFk)) salix.itemShelvingFilterBuyer(params = arrayListOf(buyerFk, warehouseFk))
.enqueue(object : .enqueue(object : SalixCallback<List<ItemInventaryVO>>(context) {
SalixCallback<List<ItemInventaryVO>>(context) {
override fun onSuccess(response: Response<List<ItemInventaryVO>>) { override fun onSuccess(response: Response<List<ItemInventaryVO>>) {
_inventaryList.value = response.body()?.let { InventaryListVO(it) } _inventaryList.value = response.body()?.let { InventaryListVO(it) }
} }
@ -108,18 +106,10 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
) { ) {
salix.itemShelvingUpdate(itemShelvingFk, params) salix.itemShelvingUpdate(itemShelvingFk, params)
.enqueue(object : SilexCallback<Any>(context) { .enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_response.value = _response.value = ResponseItemVO(isError = false, response = response.message())
ResponseItemVO(isError = false, response = response.message()) super.onSuccess(response)
} }
}) })
@ -131,36 +121,25 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
) { ) {
salix.itemShelvingsUpdate(where, params) salix.itemShelvingsUpdate(where, params).enqueue(object : SalixCallback<Any>(context) {
.enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) {
_responseReset.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_responseReset.value = _responseReset.value =
ResponseItemVO(isError = false, response = response.message()) ResponseItemVO(isError = false, response = response.message())
super.onSuccess(response)
} }
}) })
} }
fun itemTrash( fun itemTrash(
itemFk: Int, itemFk: Int, warehouseFk: Int, newValue: Int, isTrash: Boolean
warehouseFk: Int,
newValue: Int,
isTrash: Boolean
) { ) {
salix.itemTrash(arrayListOf(itemFk, warehouseFk, newValue, isTrash).formatWithQuotes()) salix.itemTrash(arrayListOf(itemFk, warehouseFk, newValue, isTrash).formatWithQuotes())
.enqueue(object : SalixCallback<Any>(context) { .enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_response.value = _response.value = ResponseItemVO(isError = false, response = response.message())
ResponseItemVO(isError = false, response = response.message())
} }
}) })
} }
@ -177,8 +156,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
fun workerGetFromHasMistake(departmentFk: Int) { fun workerGetFromHasMistake(departmentFk: Int) {
salix.workerGetFromHasMistake(arrayListOf(departmentFk)) salix.workerGetFromHasMistake(arrayListOf(departmentFk))
.enqueue(object : .enqueue(object : SalixCallback<List<WorkerFromMistake>>(context) {
SalixCallback<List<WorkerFromMistake>>(context) {
override fun onSuccess(response: Response<List<WorkerFromMistake>>) { override fun onSuccess(response: Response<List<WorkerFromMistake>>) {
_workerFromMistakeList.value = _workerFromMistakeList.value =
response.body()?.let { workerFromMistakeList(it) } response.body()?.let { workerFromMistakeList(it) }
@ -188,10 +166,8 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
val listError: ArrayList<WorkerFromMistake> = ArrayList() val listError: ArrayList<WorkerFromMistake> = ArrayList()
listError.add( listError.add(
WorkerFromMistake( WorkerFromMistake(
isError = true, isError = true, errorMessage = getMessageFromAllResponse(
errorMessage = getMessageFromAllResponse( nameofFunction(this), t.message!!
nameofFunction(this),
t.message!!
) )
) )
) )
@ -202,12 +178,10 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
} }
fun workerMistakeTypeGet() { fun workerMistakeTypeGet() {
salix.workerMistakesTypes() salix.workerMistakesTypes().enqueue(object : SilexCallback<List<MistakeType>>(context) {
.enqueue(object : SilexCallback<List<MistakeType>>(context) {
override fun onSuccess(response: Response<List<MistakeType>>) { override fun onSuccess(response: Response<List<MistakeType>>) {
_mistakeWorkerList.value = _mistakeWorkerList.value = response.body()?.let { workerMistakeTypeList(it) }
response.body()?.let { workerMistakeTypeList(it) }
} }
@ -215,13 +189,10 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
} }
fun workerMistakeAdd( fun workerMistakeAdd(
vUserFk: Int, vUserFk: Int, vTypeFk: String
vTypeFk: String
) { ) {
salix.workerMistakesAdd(WorkerMistakeSalix(vUserFk, vTypeFk)) salix.workerMistakesAdd(WorkerMistakeSalix(vUserFk, vTypeFk))
.enqueue(object : .enqueue(object : SalixCallback<Any>(context) {})
SalixCallback<Any>(context) {
})
} }
fun expeditionMistake_add( fun expeditionMistake_add(
@ -235,9 +206,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
typeFk = vTypeFk, typeFk = vTypeFk,
workerFk = (context as MobileApplication).userId!! workerFk = (context as MobileApplication).userId!!
) )
) ).enqueue(object : SalixCallback<Any>(context) {
.enqueue(object :
SalixCallback<Any>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_responseAddMistake.value = ResponseItemVO( _responseAddMistake.value = ResponseItemVO(
isError = true, isError = true,
@ -248,31 +217,26 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage // sergio:refactor:solo debería haber un mensaje no un response o errorMessage
_responseAddMistake.value = _responseAddMistake.value = ResponseItemVO(
ResponseItemVO( isError = false, response = response.message()
isError = false, )
response = response.message()
)
} }
}) })
} }
fun getInventoryParking( fun getInventoryParking(
vParkingFrom: String, vParkingFrom: String, vParkingTo: String
vParkingTo: String
) { ) {
salix.getInventoryParking(vParkingFrom, vParkingTo) salix.getInventoryParking(vParkingFrom, vParkingTo)
.enqueue(object : .enqueue(object : SalixCallback<List<ItemInventoryParking>>(context) {
SilexCallback<List<ItemInventoryParking>>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
val listError: ArrayList<ItemInventoryParking> = ArrayList() val listError: ArrayList<ItemInventoryParking> = ArrayList()
listError.add( listError.add(
ItemInventoryParking( ItemInventoryParking(
isError = true, isError = true,
errorMessage = getMessageFromAllResponse( errorMessage = getMessageFromAllResponse(
nameofFunction(this), nameofFunction(this), t.message!!
t.message!!
), ),
) )
) )
@ -292,8 +256,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
ItemInventoryParking( ItemInventoryParking(
isError = false, isError = false,
errorMessage = getMessageFromAllResponse( errorMessage = getMessageFromAllResponse(
nameofFunction(this), nameofFunction(this), response.message()
response.message()
), ),
) )
) )
@ -305,8 +268,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
} }
fun ItemListInventoryParking_( fun ItemListInventoryParking_(
vParkingFrom: String, vParkingFrom: String, vParkingTo: String
vParkingTo: String
) { ) {
var myList = InventoryParkingList( var myList = InventoryParkingList(
@ -324,8 +286,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
"http://verdnatura.es/vn-image-data/catalog/1600x900/dgalaxy", "http://verdnatura.es/vn-image-data/catalog/1600x900/dgalaxy",
0, 0,
2 2
), ), ItemInventoryParking(
ItemInventoryParking(
2, 2,
31, 31,
"F-01-1", "F-01-1",
@ -338,8 +299,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
"http://verdnatura.es/vn-image-data/catalog/1600x900/92400", "http://verdnatura.es/vn-image-data/catalog/1600x900/92400",
1, 1,
2 2
), ), ItemInventoryParking(
ItemInventoryParking(
3, 3,
31, 31,
"F-01-1", "F-01-1",
@ -352,8 +312,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
"http://verdnatura.es/vn-image-data/catalog/1600x900/92400", "http://verdnatura.es/vn-image-data/catalog/1600x900/92400",
null, null,
2 2
), ), ItemInventoryParking(
ItemInventoryParking(
4, 4,
32, 32,
"F-01-2", "F-01-2",
@ -366,8 +325,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
"http://verdnatura.es/vn-image-data/catalog/1600x900/dgalaxy", "http://verdnatura.es/vn-image-data/catalog/1600x900/dgalaxy",
0, 0,
2 2
), ), ItemInventoryParking(
ItemInventoryParking(
5, 5,
33, 33,
"F-01-3", "F-01-3",
@ -380,8 +338,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
"http://verdnatura.es/vn-image-data/catalog/1600x900/002912", "http://verdnatura.es/vn-image-data/catalog/1600x900/002912",
0, 0,
0 0
), ), ItemInventoryParking(
ItemInventoryParking(
6, 6,
34, 34,
"F-01-4", "F-01-4",
@ -394,8 +351,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
"http://verdnatura.es/vn-image-data/catalog/1600x900/bqamor", "http://verdnatura.es/vn-image-data/catalog/1600x900/bqamor",
2, 2,
0 0
), ), ItemInventoryParking(
ItemInventoryParking(
7, 7,
34, 34,
"F-01-4", "F-01-4",
@ -408,8 +364,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
"http://verdnatura.es/vn-image-data/catalog/1600x900/bqamor", "http://verdnatura.es/vn-image-data/catalog/1600x900/bqamor",
0, 0,
0 0
), ), ItemInventoryParking(
ItemInventoryParking(
8, 8,
34, 34,
"F-01-4", "F-01-4",
@ -422,8 +377,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
"http://verdnatura.es/vn-image-data/catalog/1600x900/50001", "http://verdnatura.es/vn-image-data/catalog/1600x900/50001",
0, 0,
2 2
), ), ItemInventoryParking(
ItemInventoryParking(
9, 9,
34, 34,
"F-01-4", "F-01-4",
@ -471,12 +425,9 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
val listError: ArrayList<MistakeType> = ArrayList() val listError: ArrayList<MistakeType> = ArrayList()
listError.add( listError.add(
MistakeType( MistakeType(
isError = true, isError = true, errorMessage = getMessageFromAllResponse(
errorMessage = getMessageFromAllResponse( nameofFunction(this), t.message!!
nameofFunction(this), ), description = ""
t.message!!
),
description = ""
) )
) )
_mistakeWorkerList.value = workerMistakeTypeList(listError) _mistakeWorkerList.value = workerMistakeTypeList(listError)
@ -491,12 +442,9 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
val listError: ArrayList<MistakeType> = ArrayList() val listError: ArrayList<MistakeType> = ArrayList()
listError.add( listError.add(
MistakeType( MistakeType(
isError = true, isError = true, errorMessage = getMessageFromAllResponse(
errorMessage = getMessageFromAllResponse( nameofFunction(this), response.message()
nameofFunction(this), ), description = ""
response.message()
),
description = ""
) )
) )
_mistakeWorkerList.value = workerMistakeTypeList(listError) _mistakeWorkerList.value = workerMistakeTypeList(listError)
@ -507,30 +455,10 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
} }
fun getIdFromCodeSalix(code: String) { fun getIdFromCodeSalix(code: String) {
salix.barcodes_toitem(code) salix.barcodes_toitem(code).enqueue(object : SalixCallback<String?>(context) {
.enqueue(object : SilexCallback<String?>(context) {
override fun onError(t: Throwable) {
_responseCode.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<String?>) { override fun onSuccess(response: Response<String?>) {
if (response.body() == null) { _responseCode.value =
_responseCode.value = ResponseItemVO( ResponseItemVO(isError = false, response = response.body()!!.toString())
isError = true,
errorMessage = context.getString(R.string.itemNotValid)
)
} else {
println("itemCode response" + response.body())
println("itemCode response string" + response.body().toString())
println("itemCode response toInt" + response.body().toString().toInt())
_responseCode.value =
ResponseItemVO(isError = false, response = response.body()!!.toString())
}
} }
}) })
} }

View File

@ -2,7 +2,6 @@ package es.verdnatura.presentation.view.feature.packingHolland.fragment
import android.text.InputType import android.text.InputType
import android.view.View.GONE import android.view.View.GONE
import android.view.View.INVISIBLE
import android.view.View.VISIBLE import android.view.View.VISIBLE
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import es.verdnatura.R import es.verdnatura.R
@ -12,7 +11,6 @@ import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.itemScanValue import es.verdnatura.presentation.common.itemScanValue
import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogInput
//Tarea #4940
class PackingHollandFragment(var entrypoint: String) : class PackingHollandFragment(var entrypoint: String) :
BaseFragment<FragmentGeneralBlackBinding, PackingHollandViewModel>( BaseFragment<FragmentGeneralBlackBinding, PackingHollandViewModel>(
PackingHollandViewModel::class PackingHollandViewModel::class
@ -27,13 +25,11 @@ class PackingHollandFragment(var entrypoint: String) :
} }
override fun init() { override fun init() {
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
binding.mainToolbar.toolbarTitle.text = entrypoint binding.mainToolbar.toolbarTitle.text = entrypoint
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
binding.scanInput.visibility = VISIBLE binding.scanInput.visibility = VISIBLE
setEvents() setEvents()
super.init() super.init()
} }
@ -42,7 +38,6 @@ class PackingHollandFragment(var entrypoint: String) :
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { _, actionId, _ -> binding.scanInput.setOnEditorActionListener { _, actionId, _ ->
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) {
@ -69,22 +64,6 @@ class PackingHollandFragment(var entrypoint: String) :
} }
} }
override fun observeViewModel() {
with(viewModel) {
response.observe(viewLifecycleOwner) {
binding.splashProgress.visibility = GONE
if (it.isError) {
ma.messageWithSound(it.errorMessage, true, true)
} else {
ma.messageWithSound(it.errorMessage, false, true, isToasted = false)
}
}
}
}
private fun showQuantityPacking() { private fun showQuantityPacking() {
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER) customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
@ -100,10 +79,8 @@ class PackingHollandFragment(var entrypoint: String) :
ma.hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ -> customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
callPacking(customDialogInput.getValue()) callPacking(customDialogInput.getValue())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -112,23 +89,18 @@ class PackingHollandFragment(var entrypoint: String) :
ma.hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
} }
private fun callPacking(value: String) { private fun callPacking(value: String) {
if (customDialogInput.getValue().isNotEmpty()) { if (customDialogInput.getValue().isNotEmpty()) {
try { try {
ma.hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.dismiss() customDialogInput.dismiss()
binding.splashProgress.visibility = VISIBLE
viewModel.travelUpdatePacking( viewModel.travelUpdatePacking(
itemFk = shelvingScaned, itemFk = shelvingScaned,
packingFk = value.toInt() packingFk = value.toInt()
) )
binding.scanInput.requestFocus()
} catch (ex: Exception) { } catch (ex: Exception) {
binding.splashProgress.visibility = INVISIBLE
getString(R.string.errorInput).toast(requireActivity()) getString(R.string.errorInput).toast(requireActivity())
customDialogInput.setValue("") customDialogInput.setValue("")
} }

View File

@ -1,15 +1,11 @@
package es.verdnatura.presentation.view.feature.packingHolland.fragment package es.verdnatura.presentation.view.feature.packingHolland.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Response
class PackingHollandViewModel(val context: Context) : BaseViewModel(context) { class PackingHollandViewModel(val context: Context) : BaseViewModel(context) {
@ -17,26 +13,14 @@ class PackingHollandViewModel(val context: Context) : BaseViewModel(context) {
val response: LiveData<ResponseItemVO> val response: LiveData<ResponseItemVO>
get() = _response get() = _response
fun travelUpdatePacking( fun travelUpdatePacking(
itemFk: Int, itemFk: Int,
packingFk: Int packingFk: Int
) { ) {
salix.travelUpdatePacking(arrayListOf(itemFk, packingFk)) salix.travelUpdatePacking(arrayListOf(itemFk, packingFk))
.enqueue(object : SalixCallback<Any>(context) { .enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_response.value =
ResponseItemVO(isError = false, response = response.message()!!)
}
override fun onError(t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
}) })
} }
} }

View File

@ -1,6 +1,5 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context import android.content.Context
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.media.MediaPlayer import android.media.MediaPlayer
@ -38,7 +37,6 @@ class ExpeditionPalletFragment(
ExpeditionPalletViewModel::class ExpeditionPalletViewModel::class
) { ) {
private var adapter: ExpeditionPalletAdapter? = null private var adapter: ExpeditionPalletAdapter? = null
private var onPalletClickListener: OnPalletClickListener? = null private var onPalletClickListener: OnPalletClickListener? = null
private var onComprobarPalletViewClickListener: OnComprobarPalletViewClickListener? = null private var onComprobarPalletViewClickListener: OnComprobarPalletViewClickListener? = null
@ -49,10 +47,8 @@ class ExpeditionPalletFragment(
var mperror: MediaPlayer? = null var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null var mpok: MediaPlayer? = null
companion object { companion object {
fun newInstance(item: ItemExpeditionTruckVO) = fun newInstance(item: ItemExpeditionTruckVO) = ExpeditionPalletFragment(item)
ExpeditionPalletFragment(item)
} }
override fun onAttach(context: Context) { override fun onAttach(context: Context) {
@ -73,12 +69,10 @@ class ExpeditionPalletFragment(
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
binding.splashProgress.visibility = View.VISIBLE
ma.hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = binding.mainToolbar.toolbarTitle.text =
itemExpeditionTruckVO!!.eta.toString() + " " + if (itemExpeditionTruckVO!!.Destino.isNullOrBlank()) { itemExpeditionTruckVO!!.eta + " " + if (itemExpeditionTruckVO!!.Destino.isNullOrBlank()) {
itemExpeditionTruckVO!!.description itemExpeditionTruckVO!!.description
} else { } else {
itemExpeditionTruckVO!!.Destino itemExpeditionTruckVO!!.Destino
} }
@ -110,7 +104,6 @@ class ExpeditionPalletFragment(
ToolBarAdapter(listIcons, object : OnOptionsSelectedListener { ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload) { if (item == iconReload) {
binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionPalletList( viewModel.expeditionPalletList(
itemExpeditionTruckVO!!.id itemExpeditionTruckVO!!.id
) )
@ -141,34 +134,19 @@ class ExpeditionPalletFragment(
event.getContentIfNotHandled().notNull { showScanExpeditions(it) } event.getContentIfNotHandled().notNull { showScanExpeditions(it) }
}) })
response.observe(viewLifecycleOwner, Observer {
if (it.isError) {
ma.messageWithSound(it.errorMessage, true, false)
}
})
responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer { responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer {
if (it.isError) {
ma.messageWithSound(it.errorMessage, true, false)
} else { if (it.response == "1") {
mperror?.start()
if (it.response == "1") {
mperror?.start()
}
} }
}) })
} }
} }
private fun printExpeditionList(it: ItemPalletListVO) { private fun printExpeditionList(it: ItemPalletListVO) {
binding.splashProgress.visibility = View.GONE
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
adapter = ExpeditionPalletAdapter( adapter = ExpeditionPalletAdapter(
it.list, it.list,
@ -182,22 +160,16 @@ class ExpeditionPalletFragment(
} }
private fun expeditionScanAdd() { private fun expeditionScanAdd() {
binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionScanAdd( viewModel.expeditionScanAdd(
vPalletFk = 0, vPalletFk = 0, vTruckFk = itemExpeditionTruckVO!!.id
vTruckFk = itemExpeditionTruckVO!!.id
) )
} }
private fun showScanExpeditions(it: ItemScanList) { private fun showScanExpeditions(it: ItemScanList) {
binding.splashProgress.visibility = View.GONE
listExpeditions = ArrayList() listExpeditions = ArrayList()
it.list.forEach { it.list.forEach {
if (it.expeditionFk != "0") if (it.expeditionFk != "0") listExpeditions.add(BarcodeVO(code = it.expeditionFk))
listExpeditions.add(BarcodeVO(code = it.expeditionFk))
} }
customDialogList.setTitle(getString(R.string.expeditionP) + binding.mainToolbar.toolbarTitle.text + ")") customDialogList.setTitle(getString(R.string.expeditionP) + binding.mainToolbar.toolbarTitle.text + ")")
@ -211,8 +183,7 @@ class ExpeditionPalletFragment(
if (listExpeditions.size > 0) { if (listExpeditions.size > 0) {
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener( onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(
itemExpeditionTruckVO!!, itemExpeditionTruckVO!!, ItemPalletVO(Pallet = it.list.get(0).palletFk)
ItemPalletVO(Pallet = it.list.get(0).palletFk)
) )
} else { } else {
customDialog.setTitle(getString(R.string.info)) customDialog.setTitle(getString(R.string.info))
@ -221,13 +192,10 @@ class ExpeditionPalletFragment(
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
} }
customDialogList.dismiss() customDialogList.dismiss()
}.setKoButton(getString(R.string.close)) { }.setKoButton(getString(R.string.close)) {
ma.hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionPalletList( viewModel.expeditionPalletList(
itemExpeditionTruckVO!!.id itemExpeditionTruckVO!!.id
) )
@ -247,12 +215,10 @@ class ExpeditionPalletFragment(
listExpeditions.add(0, BarcodeVO(code = customDialogList.getValue())) listExpeditions.add(0, BarcodeVO(code = customDialogList.getValue()))
customDialogList.setDescription(getString(R.string.total) + listExpeditions.size) customDialogList.setDescription(getString(R.string.total) + listExpeditions.size)
viewModel.expeditionScanPut( viewModel.expeditionScanPut(
it.list.get(0).palletFk, it.list.get(0).palletFk, customDialogList.getValue().toInt()
customDialogList.getValue().toInt()
) )
viewModel.expeditionCheckRoute( viewModel.expeditionCheckRoute(
it.list[0].palletFk, it.list[0].palletFk, customDialogList.getValue().toInt()
customDialogList.getValue().toInt()
) )
} else { } else {
if (mperror != null) mperror!!.start() if (mperror != null) mperror!!.start()
@ -281,8 +247,6 @@ class ExpeditionPalletFragment(
customDialogList.getRecyclerView().layoutManager = customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
} }
} }

View File

@ -41,38 +41,10 @@ class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
.enqueue(object : .enqueue(object :
SalixCallback<List<ItemPalletVO>>(context) { SalixCallback<List<ItemPalletVO>>(context) {
override fun onSuccess(response: Response<List<ItemPalletVO>>) { override fun onSuccess(response: Response<List<ItemPalletVO>>) {
if (response.body() != null) {
_expeditionPalletList.value =
response.body()?.let { ItemPalletListVO(it) }
} else {
val listError: ArrayList<ItemPalletVO> = ArrayList()
listError.add(
ItemPalletVO(
0,
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
)
_expeditionPalletList.value = ItemPalletListVO(listError)
}
}
override fun onError(t: Throwable) { _expeditionPalletList.value =
val listError: ArrayList<ItemPalletVO> = ArrayList() response.body()?.let { ItemPalletListVO(it) }
listError.add(
ItemPalletVO(
0,
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
)
)
)
_expeditionPalletList.value = ItemPalletListVO(listError)
} }
}) })
@ -85,39 +57,7 @@ class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
.enqueue(object : .enqueue(object :
SalixCallback<List<ItemScanVO>>(context) { SalixCallback<List<ItemScanVO>>(context) {
override fun onSuccess(response: Response<List<ItemScanVO>>) { override fun onSuccess(response: Response<List<ItemScanVO>>) {
if (response.body() != null) {
_scanList.value = response.body()?.let { ItemScanList(it) } _scanList.value = response.body()?.let { ItemScanList(it) }
} else {
val listError: ArrayList<ItemScanVO> = ArrayList()
listError.add(
ItemScanVO(
"",
0,
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
)
_scanList.value = ItemScanList(listError)
}
}
override fun onError(t: Throwable) {
val listError: ArrayList<ItemScanVO> = ArrayList()
listError.add(
ItemScanVO(
"",
0,
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
)
)
)
_scanList.value = ItemScanList(listError)
} }
}) })
@ -143,27 +83,13 @@ class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
salix.expeditionCheckRoute(arrayListOf(vPalletFk, vExpeditionFk)) salix.expeditionCheckRoute(arrayListOf(vPalletFk, vExpeditionFk))
.enqueue(object : SalixCallback<String>(context) { .enqueue(object : SalixCallback<String>(context) {
override fun onSuccess(response: Response<String>) { override fun onSuccess(response: Response<String>) {
if (response.body() == null) {
_responseCheckexpeditionScanPut.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
} else {
_responseCheckexpeditionScanPut.value = _responseCheckexpeditionScanPut.value =
ResponseItemVO(isError = false, response = response.body()!!) ResponseItemVO(isError = false, response = response.body()!!)
} }
}
override fun onError(t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
}) })
} }

View File

@ -4,9 +4,9 @@ import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.core.content.res.ResourcesCompat
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
@ -49,14 +49,12 @@ class ExpeditionTruckListFragment :
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun init() { override fun init() {
customDialogHor = CustomDialogHour(requireContext()) customDialogHor = CustomDialogHour(requireContext())
binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = getString(R.string.psScan) + getCURDATE() binding.mainToolbar.toolbarTitle.text = getString(R.string.psScan) + getCURDATE()
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }
setToolBar() setToolBar()
viewModel.expeditionTruckList() viewModel.expeditionTruckList()
super.init() super.init()
} }
@ -64,11 +62,11 @@ class ExpeditionTruckListFragment :
private fun setToolBar() { private fun setToolBar() {
val listIcons: ArrayList<Drawable> = ArrayList() val listIcons: ArrayList<Drawable> = ArrayList()
val iconReload: Drawable = val iconReload: Drawable =
resources.getDrawable(R.drawable.ic_autorenew_black_24dp, resources.newTheme()) ResourcesCompat.getDrawable(resources, R.drawable.ic_autorenew_black_24dp, null)!!
val iconPlus: Drawable = val iconPlus: Drawable =
resources.getDrawable(R.drawable.ic_add_black_24dp, resources.newTheme()) ResourcesCompat.getDrawable(resources, R.drawable.ic_add_black_24dp, null)!!
val iconState: Drawable = val iconState: Drawable =
resources.getDrawable(R.drawable.ic_visibility_white_24dp, resources.newTheme()) ResourcesCompat.getDrawable(resources, R.drawable.ic_visibility_white_24dp, null)!!
listIcons.add(iconState) listIcons.add(iconState)
listIcons.add(iconReload) listIcons.add(iconReload)
@ -80,7 +78,6 @@ class ExpeditionTruckListFragment :
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload) { if (item == iconReload) {
binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionTruckList() viewModel.expeditionTruckList()
} else if (item == iconPlus) { } else if (item == iconPlus) {
addTruck() addTruck()
@ -114,10 +111,8 @@ class ExpeditionTruckListFragment :
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
private fun printExpeditionList(it: ItemExpeditionTruckList) { private fun printExpeditionList(it: ItemExpeditionTruckList) {
binding.splashProgress.visibility = View.GONE
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
it.list.filter { it.eta != null } it.list.filter { it.eta != null }.map { it.eta = it.eta.isoToString() }
.map { it.eta = it.eta.isoToString()}
adapter = ExpeditionListAdapter(it.list, onTruckClickListener!!) adapter = ExpeditionListAdapter(it.list, onTruckClickListener!!)
binding.expeditionTruckRecyclerview.adapter = adapter binding.expeditionTruckRecyclerview.adapter = adapter
binding.expeditionTruckRecyclerview.layoutManager = lm binding.expeditionTruckRecyclerview.layoutManager = lm
@ -158,22 +153,9 @@ class ExpeditionTruckListFragment :
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
private fun customDialogActionTruck() { private fun customDialogActionTruck() {
viewModel.expeditionTruckAdd( viewModel.expeditionTruckAdd(
customDialogHor.getHoraValue(), customDialogHor.getHoraValue(), customDialogHor.getDestinoValue()
customDialogHor.getDestinoValue()
) )
binding.splashProgress.visibility = View.VISIBLE
customDialogHor.dismiss() customDialogHor.dismiss()
} }
} }

View File

@ -7,8 +7,6 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.ExpeditionTruckSalix import es.verdnatura.presentation.view.feature.paletizador.model.ExpeditionTruckSalix
@ -41,19 +39,6 @@ class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context
_expeditionTruckList.value = _expeditionTruckList.value =
response.body()?.let { ItemExpeditionTruckList(it) } response.body()?.let { ItemExpeditionTruckList(it) }
} }
override fun onError(t: Throwable) {
val listError: ArrayList<ItemExpeditionTruckVO> = ArrayList()
listError.add(
ItemExpeditionTruckVO(
0,
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
)
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
}
}) })
} }
@ -65,26 +50,8 @@ class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context
description = vDescription description = vDescription
) )
).enqueue(object : SalixCallback<Any>(context) { ).enqueue(object : SalixCallback<Any>(context) {
override fun onFailure(call: Call<Any>, t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onResponse(call: Call<Any>, response: Response<Any>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (!response.isSuccessful) { _response.value = ResponseItemVO(isError = false, response = response.message())
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
} else {
_response.value = ResponseItemVO(isError = false, response = response.message())
}
} }
}) })

View File

@ -29,7 +29,6 @@ import java.io.IOException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
class PhotosFragment( class PhotosFragment(
var title: String, var title: String,
var uriImage: Uri? var uriImage: Uri?
@ -50,7 +49,6 @@ class PhotosFragment(
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
override fun init() { override fun init() {
binding.mainToolbar.toolbarTitle.text = title binding.mainToolbar.toolbarTitle.text = title
binding.splashProgress.visibility = GONE
setEvents() setEvents()
setToolBar() setToolBar()
setImage() setImage()
@ -91,7 +89,6 @@ class PhotosFragment(
iconSend.drawable -> upLoadPhoto() iconSend.drawable -> upLoadPhoto()
} }
} }
}) })
binding.mainToolbar.toolbarIcons.layoutManager = binding.mainToolbar.toolbarIcons.layoutManager =
@ -118,12 +115,10 @@ class PhotosFragment(
).toString().toLong() ).toString().toLong()
try { try {
binding.splashProgress.visibility = VISIBLE
viewModel.getItemCard( viewModel.getItemCard(
originalItem, getDataInt(WAREHOUSEFK) originalItem, getDataInt(WAREHOUSEFK)
) )
} catch (Ex: Exception) { } catch (Ex: Exception) {
ma.messageWithSound(Ex.message.toString(), true, true) ma.messageWithSound(Ex.message.toString(), true, true)
} }
@ -143,7 +138,6 @@ class PhotosFragment(
with(viewModel) { with(viewModel) {
responseinsert.observe(viewLifecycleOwner) { responseinsert.observe(viewLifecycleOwner) {
binding.splashProgress.visibility = GONE
if (it.isError) { if (it.isError) {
ma.messageWithSound( ma.messageWithSound(
it.errorMessage + getString(R.string.user) + title, it.errorMessage + getString(R.string.user) + title,
@ -161,7 +155,6 @@ class PhotosFragment(
} }
itemcard.observe(viewLifecycleOwner) { itemcard.observe(viewLifecycleOwner) {
binding.splashProgress.visibility = GONE
if (it.isError) { if (it.isError) {
ma.messageWithSound(it.errorMessage, true, false) ma.messageWithSound(it.errorMessage, true, false)
} else { } else {
@ -196,7 +189,6 @@ class PhotosFragment(
val drawable = binding.itemcardImage.drawable val drawable = binding.itemcardImage.drawable
if (drawable is BitmapDrawable) { if (drawable is BitmapDrawable) {
val bitmap = drawable.bitmap val bitmap = drawable.bitmap
binding.splashProgress.visibility = VISIBLE
viewModel.uploadPhoto( viewModel.uploadPhoto(
itemFK = originalItem, itemFK = originalItem,
urlImage = saveBitmapAsTempFile(requireContext(), bitmap) urlImage = saveBitmapAsTempFile(requireContext(), bitmap)
@ -239,12 +231,11 @@ class PhotosFragment(
binding.itemcardImage.setImageURI(data.data) binding.itemcardImage.setImageURI(data.data)
} else { } else {
// Imagen cámara // Imagen cámara
var uri = saveBitmapAsTempFile( val uri = saveBitmapAsTempFile(
requireContext(), requireContext(),
data?.extras?.get("data") as Bitmap data?.extras?.get("data") as Bitmap
).toUri() ).toUri()
binding.itemcardImage.setImageURI(uri) binding.itemcardImage.setImageURI(uri)
//binding.itemcardImage.setImageBitmap(data?.extras?.get("data") as? Bitmap?)
} }
} }

View File

@ -20,8 +20,7 @@ import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewMod
@Suppress("UNUSED_ANONYMOUS_PARAMETER") @Suppress("UNUSED_ANONYMOUS_PARAMETER")
class ReubicationCollectionFragment( class ReubicationCollectionFragment(
var list: MutableList<Reubication>, var list: MutableList<Reubication>, var shelving: String
var shelving: String
) : BaseFragment<FragmentReubicationCollectionBinding, UbicadorViewModel>( ) : BaseFragment<FragmentReubicationCollectionBinding, UbicadorViewModel>(
UbicadorViewModel::class UbicadorViewModel::class
) { ) {
@ -33,8 +32,7 @@ class ReubicationCollectionFragment(
companion object { companion object {
fun newInstance( fun newInstance(
entryPoint: MutableList<Reubication>, entryPoint: MutableList<Reubication>, shelving: String
shelving: String
): ReubicationCollectionFragment { ): ReubicationCollectionFragment {
return ReubicationCollectionFragment(entryPoint, shelving) return ReubicationCollectionFragment(entryPoint, shelving)
@ -73,15 +71,12 @@ class ReubicationCollectionFragment(
adapter = ReubicatorAdapter(list.sortedWith(compareBy { item -> adapter = ReubicatorAdapter(list.sortedWith(compareBy { item ->
item.carros.getOrNull(0)?.pickingOrder ?: 0 item.carros.getOrNull(0)?.pickingOrder ?: 0
}), }), pasillerosItemClickListener!!, object : OnReubicationClickListener {
pasillerosItemClickListener!!, override fun onReubicationClick(reubication: Reubication) {
object : showLeaveItemDialog(reubication)
OnReubicationClickListener { }
override fun onReubicationClick(reubication: Reubication) {
showLeaveItemDialog(reubication)
}
}) })
binding.reubicatorCollectionsRecycler.adapter = adapter binding.reubicatorCollectionsRecycler.adapter = adapter
binding.reubicatorCollectionsRecycler.layoutManager = binding.reubicatorCollectionsRecycler.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
@ -94,7 +89,6 @@ class ReubicationCollectionFragment(
} }
binding.collectionSwipe.setOnRefreshListener { binding.collectionSwipe.setOnRefreshListener {
callItemShelvingReturn() callItemShelvingReturn()
binding.collectionSwipe.isRefreshing = false binding.collectionSwipe.isRefreshing = false
@ -120,33 +114,23 @@ class ReubicationCollectionFragment(
false false
} }
} }
private fun scanPlate(plate: String) { private fun scanPlate(plate: String) {
//showLeaveItemDialog(plate)
var found = false var found = false
all_list@ for (items in list) { all_list@ for (items in list) {
for (placements in items.carros) { for (placements in items.carros) {
if (placements.shelvingFk == plate) { if (placements.shelvingFk == plate) {
found = true found = true
showLeaveItemDialog(items) showLeaveItemDialog(items)
break@all_list break@all_list
} }
} }
} }
if (!found) { if (!found) {
ma.messageWithSound( ma.messageWithSound(
getString(R.string.itemScanetNotFound), getString(R.string.itemScanetNotFound), true, true, isToasted = true
true,
true,
isToasted = true
) )
} }
} }
@ -189,18 +173,14 @@ class ReubicationCollectionFragment(
} }
private fun customDialogMerge(itemReubication: Reubication) { private fun customDialogMerge(itemReubication: Reubication) {
if (customDialogInputTwoValues.getValueTwo().isNotEmpty()) { if (customDialogInputTwoValues.getValueTwo().isNotEmpty()) {
binding.splashProgress.visibility = VISIBLE
viewModel.itemShelving_merge( viewModel.itemShelving_merge(
itemReubication.id, itemReubication.id, customDialogInputTwoValues.getValueTwo().uppercase()
customDialogInputTwoValues.getValueTwo().uppercase()
) )
} else { } else {
ma.messageWithSound( ma.messageWithSound(
getString(R.string.returnScan), getString(R.string.returnScan), true, true, isToasted = true
true,
true,
isToasted = true
) )
} }
customDialogInputTwoValues.setValue("") customDialogInputTwoValues.setValue("")
@ -210,7 +190,6 @@ class ReubicationCollectionFragment(
} }
private fun scanRequest() { private fun scanRequest() {
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
@ -219,7 +198,6 @@ class ReubicationCollectionFragment(
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
loadReubicationList.observe(viewLifecycleOwner) { event -> loadReubicationList.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { event.getContentIfNotHandled().notNull {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
@ -249,19 +227,7 @@ class ReubicationCollectionFragment(
} }
response.observe(viewLifecycleOwner) { response.observe(viewLifecycleOwner) {
binding.splashProgress.visibility = GONE callItemShelvingReturn()
if (it.isError) {
ma.messageWithSound(it.errorMessage, true, true)
} else {
ma.messageWithSound(it.response, false, false, "", false)
callItemShelvingReturn()
}
} }
} }
@ -269,7 +235,6 @@ class ReubicationCollectionFragment(
private fun callItemShelvingReturn() { private fun callItemShelvingReturn() {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.itemShelving_return( viewModel.itemShelving_return(
shelvingFk = shelving, shelvingFk = shelving,
) )

View File

@ -62,10 +62,8 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
fun itemShelvingList( fun itemShelvingList(
vShelvingFk: String vShelvingFk: String
) { ) {
salix.itemShelvingList(params = listOf(vShelvingFk.uppercase()).formatWithQuotes()) salix.itemShelvingList(params = listOf(vShelvingFk.uppercase()).formatWithQuotes()).enqueue(
.enqueue( object : SalixCallback<List<ItemUbicadorVO>>(context) {
object :
SalixCallback<List<ItemUbicadorVO>>(context) {
override fun onSuccess(response: Response<List<ItemUbicadorVO>>) { override fun onSuccess(response: Response<List<ItemUbicadorVO>>) {
_shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) } _shelvingList.value = response.body()?.let { ItemUbicadorListVO(it) }
} }
@ -90,8 +88,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
fun shelvingPriorityUpdate( fun shelvingPriorityUpdate(
priority: Int, priority: Int, shelving: String
shelving: String
) { ) {
salix.updateShelvingPriority( salix.updateShelvingPriority(
@ -113,15 +110,11 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
fun itemShelvingAddList( fun itemShelvingAddList(
shelving: String, shelving: String, items: Any, isChecking: Boolean, warehouse: Int
items: Any,
isChecking: Boolean,
warehouse: Int
) { ) {
salix.itemShelvingAddList( salix.itemShelvingAddList(
arrayListOf(shelving, items, isChecking, warehouse).formatWithQuotes() arrayListOf(shelving, items, isChecking, warehouse).formatWithQuotes()
).enqueue(object : ).enqueue(object : SilexCallback<Any>(context) {
SilexCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_responseAddList.value = _responseAddList.value =
ResponseItemVO(isError = false, response = response.message()!!) ResponseItemVO(isError = false, response = response.message()!!)
@ -140,12 +133,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
fun itemShelvingAdd( fun itemShelvingAdd(
shelving: String, shelving: String, item: Number, quantity: Int, packing: Int?, warehouse: Int, grouping: Int?
item: Number,
quantity: Int,
packing: Int?,
warehouse: Int,
grouping: Int?
) { ) {
salix.itemShelvingAdd( salix.itemShelvingAdd(
arrayListOf( arrayListOf(
@ -174,10 +162,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
fun itemShelvingMakeEdit( fun itemShelvingMakeEdit(
quantity: Int, quantity: Int, packing: Int, itemShelvingFk: Int, grouping: Int?
packing: Int,
itemShelvingFk: Int,
grouping: Int?
) { ) {
salix.itemShelvingUpdate( salix.itemShelvingUpdate(
@ -201,18 +186,15 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
fun setParking( fun setParking(
shelving: String, shelving: String, parking: String
parking: String
) { ) {
salix.setParking(arrayListOf(shelving, parking).formatWithQuotes()) salix.setParking(arrayListOf(shelving, parking).formatWithQuotes())
.enqueue(object : Callback<Any> { .enqueue(object : Callback<Any> {
override fun onResponse(call: Call<Any>, response: Response<Any>) { override fun onResponse(call: Call<Any>, response: Response<Any>) {
if (!response.isSuccessful) { if (!response.isSuccessful) {
_response.value = ResponseItemVO( _response.value = ResponseItemVO(
isError = true, isError = true, errorMessage = getMessageFromAllResponse(
errorMessage = getMessageFromAllResponse( nameofFunction(this), response.message()
nameofFunction(this),
response.message()
) )
) )
} else { } else {
@ -231,25 +213,17 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
fun itemShelving_merge( fun itemShelving_merge(
vShelf: Int, vShelf: Int, vShelvingFk: String
vShelvingFk: String
) { ) {
salix.itemShelvingsUpdate( salix.itemShelvingsUpdate(
where = JsonObject().apply { addProperty("id", vShelf) }, where = JsonObject().apply { addProperty("id", vShelf) },
params = hashMapOf("shelvingFk" to vShelvingFk) params = hashMapOf("shelvingFk" to vShelvingFk)
) ).enqueue(object : SalixCallback<Any>(context) {
.enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_response.value = _response.value =
ResponseItemVO(isError = false, response = response.message()!!) ResponseItemVO(isError = false, response = response.message()!!)
super.onSuccess(response)
} }
}) })
} }
@ -261,8 +235,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
salix.itemShelvingsUpdate( salix.itemShelvingsUpdate(
where = JsonObject().apply { addProperty("shelvingFk", vShelvingFk) }, where = JsonObject().apply { addProperty("shelvingFk", vShelvingFk) },
params = hashMapOf("isChecked" to null) params = hashMapOf("isChecked" to null)
) ).enqueue(object : SilexCallback<Any>(context) {
.enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_response.value = ResponseItemVO( _response.value = ResponseItemVO(
isError = true, isError = true,
@ -281,9 +254,8 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
code: String code: String
) { ) {
//Tarea 6276 //Tarea 6276
// salix.shelvingLogAdd(hashMapOf("code" to code)) // salix.shelvingLogAdd(hashMapOf("code" to code))
silex.shelvingLog_add(code) silex.shelvingLog_add(code).enqueue(object : SalixCallback<Any>(context) {
.enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_responseLog.value = _responseLog.value =
@ -305,9 +277,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
val listError: ArrayList<Reubication> = ArrayList() val listError: ArrayList<Reubication> = ArrayList()
listError.add( listError.add(
Reubication( Reubication(
0, 0, isError = true, errorMessage = getMessageFromAllResponse(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this), nameofFunction(this),
t.message!!, t.message!!,
@ -322,11 +292,8 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
val listError: ArrayList<Reubication> = ArrayList() val listError: ArrayList<Reubication> = ArrayList()
listError.add( listError.add(
Reubication( Reubication(
0, 0, isError = true, errorMessage = getMessageFromAllResponse(
isError = true, nameofFunction(this), response.message()
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
) )
) )
) )
@ -348,8 +315,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
salix.itemShelvingsUpdate( salix.itemShelvingsUpdate(
where = JsonObject().apply { addProperty("shelvingFk", shelvingFk) }, where = JsonObject().apply { addProperty("shelvingFk", shelvingFk) },
hashMapOf("visible" to 0) hashMapOf("visible" to 0)
) ).enqueue(object : SalixCallback<Any>(context) {
.enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_response.value = ResponseItemVO( _response.value = ResponseItemVO(
isError = true, isError = true,
@ -358,23 +324,20 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_response.value = _response.value = ResponseItemVO(isError = false, response = response.message())
ResponseItemVO(isError = false, response = response.message())
} }
}) })
} }
fun shelvingChangeSalix( fun shelvingChangeSalix(
shelvingFkIn: String, shelvingFkIn: String, shelvingFkOut: String
shelvingFkOut: String
) { ) {
salix.itemShelvingsUpdate( salix.itemShelvingsUpdate(
where = JsonObject().apply { addProperty("shelvingFk", shelvingFkIn) }, where = JsonObject().apply { addProperty("shelvingFk", shelvingFkIn) },
hashMapOf("shelvingFk" to shelvingFkOut) hashMapOf("shelvingFk" to shelvingFkOut)
) ).enqueue(object : SalixCallback<Any>(context) {
.enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_response.value = ResponseItemVO( _response.value = ResponseItemVO(
isError = true, isError = true,
@ -383,15 +346,13 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_response.value = _response.value = ResponseItemVO(isError = false, response = response.message())
ResponseItemVO(isError = false, response = response.message())
} }
}) })
} }
fun itemShelvingTransfer( fun itemShelvingTransfer(
itemFk: Int, itemFk: Int, shelvingFk: String
shelvingFk: String
) { ) {
salix.itemShelvingTransfer(arrayListOf(itemFk, shelvingFk).formatWithQuotes()) salix.itemShelvingTransfer(arrayListOf(itemFk, shelvingFk).formatWithQuotes())
@ -411,8 +372,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
fun itemShelvingDelete(itemFk: Int) { fun itemShelvingDelete(itemFk: Int) {
salix.itemShelvingsDelete(itemFk) salix.itemShelvingsDelete(itemFk).enqueue(object : SalixCallback<Any>(context) {
.enqueue(object : SalixCallback<Any>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_response.value = ResponseItemVO( _response.value = ResponseItemVO(
@ -422,8 +382,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_response.value = _response.value = ResponseItemVO(isError = false, response = response.message())
ResponseItemVO(isError = false, response = response.message())
} }
}) })
@ -432,15 +391,11 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
fun itemShelvingSelfConsumption(shelvingFk: String, itemFk: Int, quantity: Int) { fun itemShelvingSelfConsumption(shelvingFk: String, itemFk: Int, quantity: Int) {
salix.itemShelvingSelfConsumption( salix.itemShelvingSelfConsumption(
arrayListOf( arrayListOf(
shelvingFk, shelvingFk, itemFk, quantity
itemFk,
quantity
).formatWithQuotes() ).formatWithQuotes()
) ).enqueue(object : SalixCallback<Any>(context) {
.enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_response.value = _response.value = ResponseItemVO(isError = false, response = response.message())
ResponseItemVO(isError = false, response = response.message())
} }
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
@ -454,8 +409,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
} }
fun getIdFromCode(code: String) { fun getIdFromCode(code: String) {
salix.barcodes_toitem(code) salix.barcodes_toitem(code).enqueue(object : SilexCallback<String?>(context) {
.enqueue(object : SilexCallback<String?>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_responseCode.value = ResponseItemVO( _responseCode.value = ResponseItemVO(
isError = true, isError = true,
@ -467,8 +421,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
if (response.body() == null) { if (response.body() == null) {
_responseCode.value = ResponseItemVO( _responseCode.value = ResponseItemVO(
isError = true, isError = true, errorMessage = context.getString(R.string.itemNotValid)
errorMessage = context.getString(R.string.itemNotValid)
) )
} else { } else {
_responseCode.value = _responseCode.value =

View File

@ -3,12 +3,10 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/verdnatura_black" android:background="@color/verdnatura_black">
>
<LinearLayout <LinearLayout
android:id="@+id/linearLayout2" android:id="@+id/linearLayout2"
@ -50,7 +48,6 @@
android:textSize="@dimen/body2" /> android:textSize="@dimen/body2" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
@ -65,36 +62,12 @@
app:layout_constraintTop_toBottomOf="@+id/linearLayout2" app:layout_constraintTop_toBottomOf="@+id/linearLayout2"
tools:listitem="@layout/item_expeditionpallet_row" /> tools:listitem="@layout/item_expeditionpallet_row" />
<include
' <include
android:id="@+id/main_toolbar" android:id="@+id/main_toolbar"
layout="@layout/toolbar_fragment" layout="@layout/toolbar_fragment"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="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"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<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> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View File

@ -6,8 +6,7 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/verdnatura_black" android:background="@color/verdnatura_black">
>
<LinearLayout <LinearLayout
android:id="@+id/linearLayout2" android:id="@+id/linearLayout2"
@ -39,7 +38,6 @@
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" /> android:textSize="@dimen/body2" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
@ -54,36 +52,12 @@
app:layout_constraintTop_toBottomOf="@+id/linearLayout2" app:layout_constraintTop_toBottomOf="@+id/linearLayout2"
tools:listitem="@layout/item_expeditiontruck_row" /> tools:listitem="@layout/item_expeditiontruck_row" />
<include
' <include
android:id="@+id/main_toolbar" android:id="@+id/main_toolbar"
layout="@layout/toolbar_fragment" layout="@layout/toolbar_fragment"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="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"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<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> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View File

@ -31,22 +31,20 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:textColorHint="@android:color/darker_gray" android:textColorHint="@android:color/darker_gray"
android:visibility="gone"> android:visibility="gone"></com.google.android.material.textfield.TextInputLayout>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_matricula"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:backgroundTint="@android:color/white"
android:gravity="center"
android:hint="@string/Escaneamatricula"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:textColor="@color/verdnatura_white"
android:textColorHint="@android:color/holo_orange_light" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_matricula"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:backgroundTint="@android:color/white"
android:gravity="center"
android:hint="@string/Escaneamatricula"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:textColor="@color/verdnatura_white"
android:textColorHint="@android:color/holo_orange_light" />
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/textinputlayout_prioridad" android:id="@+id/textinputlayout_prioridad"
@ -128,31 +126,5 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="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="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<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> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -19,19 +18,17 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" > android:orientation="vertical">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_itemFk" android:id="@+id/edit_itemFk"
style="@style/ScanLineTextSearch" style="@style/ScanLineTextSearch"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_marginBottom="@dimen/layout_margin_1"
android:hint="@string/scanItemUpload" android:hint="@string/scanItemUpload"
android:inputType="text" android:inputType="text"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:textColorHint="@color/verdnatura_white" android:textColorHint="@color/verdnatura_white" />
android:layout_marginBottom="@dimen/layout_margin_1"
/>
<LinearLayout <LinearLayout
android:id="@+id/itemcard_layout" android:id="@+id/itemcard_layout"
@ -44,74 +41,42 @@
android:id="@+id/itemcard_image" android:id="@+id/itemcard_image"
android:layout_width="@dimen/itemcard_image" android:layout_width="@dimen/itemcard_image"
android:layout_height="@dimen/itemcard_image" android:layout_height="@dimen/itemcard_image"
android:scaleType="centerCrop"
android:src="@drawable/loadphoto"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginBottom="@dimen/layout_margin_1"/> android:layout_marginBottom="@dimen/layout_margin_1"
android:scaleType="centerCrop"
android:src="@drawable/loadphoto" />
<TextView <TextView
android:id="@+id/item_data" android:id="@+id/item_data"
android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/ef_margin_small"
android:ellipsize="end"
android:gravity="center" android:gravity="center"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end"
android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_pumpkin_orange" android:textColor="@color/verdnatura_pumpkin_orange"
android:textColorHint="@color/verdnatura_white" android:textColorHint="@color/verdnatura_white"
android:layout_margin="@dimen/ef_margin_small" android:textSize="@dimen/body1" />
/>
<ImageView <ImageView
android:id="@+id/itemcard_original" android:id="@+id/itemcard_original"
android:layout_width="@dimen/itemcard_image" android:layout_width="@dimen/itemcard_image"
android:layout_height="@dimen/itemcard_image" android:layout_height="@dimen/itemcard_image"
android:layout_gravity="center"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/loadphoto" android:src="@drawable/loadphoto"
android:visibility="invisible" android:visibility="invisible" />
android:layout_gravity="center"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<include <include
android:id="@+id/main_toolbar" android:id="@+id/main_toolbar"
layout="@layout/toolbar_fragment" layout="@layout/toolbar_fragment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/splash_progress"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/verdnatura_black_8_alpha_6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent" />
android:gravity="center">
<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> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>