refs #5135 feat: refactor animation
This commit is contained in:
parent
11fc8ce52e
commit
a5953a22f5
|
@ -229,7 +229,7 @@ interface SalixService {
|
|||
fun expeditionLoadingAdd(
|
||||
@Query("params") params: Any? = null,
|
||||
@Query("schema") schema: String = "vn"
|
||||
): Call<Any>
|
||||
): Call<List<Map<String, Any>>>
|
||||
|
||||
@POST("Applications/expeditionState_addByPallet/execute-proc")
|
||||
fun expeditionStateAddByPallet(
|
||||
|
|
|
@ -51,21 +51,16 @@ class BufferFragmentViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun expeditionLoadingAdd(vExpeditionFk: Int, vBufferFk: Int) {
|
||||
salix.expeditionLoadingAdd(arrayListOf(vExpeditionFk, vBufferFk))
|
||||
.enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_bufferloadresponse.value = ResponseItemVO(
|
||||
salix.expeditionLoadingAdd(arrayListOf(vExpeditionFk, vBufferFk), schema = "srt")
|
||||
.enqueue(object : SalixCallback<List<Map<String, Any>>>(context) {
|
||||
override fun onSuccess(response: Response<List<Map<String, Any>>>) {
|
||||
_bufferloadresponse.value =
|
||||
ResponseItemVO(
|
||||
isError = false,
|
||||
response = response.body().toString()!!
|
||||
response = response.body()!![0]["vMessage"].toString()
|
||||
)
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_bufferloadresponse.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
package es.verdnatura.presentation.view.feature.buffer.fragment
|
||||
|
||||
|
||||
import android.media.MediaPlayer
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentBufferLoadexpeditionBinding
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnSmartTagRowClickListener
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
|
@ -30,27 +27,19 @@ class BufferLoadFragment(
|
|||
private var tagsAdapter: BufferAdapter? = null
|
||||
private var itemScaned: Int = 0
|
||||
var mperror: MediaPlayer? = null
|
||||
var mpok: MediaPlayer? = null
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = BufferLoadFragment(entryPoint)
|
||||
}
|
||||
|
||||
|
||||
override fun init() {
|
||||
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
goBack = false
|
||||
ma.hideBottomNavigation(GONE)
|
||||
binding.splashProgress.visibility = GONE
|
||||
|
||||
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
|
||||
mpok= MediaPlayer.create((activity as MainActivity),R.raw.ok)
|
||||
|
||||
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
|
||||
setEvents()
|
||||
setToolBar()
|
||||
|
||||
showExpeditionOrBufferScan()
|
||||
super.init()
|
||||
}
|
||||
|
@ -66,28 +55,27 @@ class BufferLoadFragment(
|
|||
|
||||
}
|
||||
|
||||
|
||||
private fun checkLoadExpedition(expeditionOrBuffer: Int) {
|
||||
|
||||
listTags.add(SmartTag(expeditionOrBuffer.toString(), getTextScaned(listTags.size + 1) + " $expeditionOrBuffer"))
|
||||
listTags.add(
|
||||
SmartTag(
|
||||
expeditionOrBuffer.toString(),
|
||||
getTextScaned(listTags.size + 1) + " $expeditionOrBuffer"
|
||||
)
|
||||
)
|
||||
customDialogList.setTitle(getString(R.string.scanBuffer))
|
||||
|
||||
tagsAdapter!!.notifyDataSetChanged()
|
||||
|
||||
|
||||
if (listTags.size==2) {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
if (listTags.size == 2) {
|
||||
viewModel.expeditionLoadingAdd(
|
||||
vBufferFk = expeditionOrBuffer,
|
||||
vExpeditionFk = listTags.first().code.toString().toInt())
|
||||
vExpeditionFk = listTags.first().code.toString().toInt()
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
itemScaned = expeditionOrBuffer
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun setEvents() {
|
||||
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
|
@ -96,34 +84,21 @@ class BufferLoadFragment(
|
|||
|
||||
}
|
||||
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
|
||||
with(viewModel) {
|
||||
binding.splashProgress.visibility = GONE
|
||||
bufferloadresponse.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (it.response == getString(R.string.registerAdded)) {
|
||||
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage,it.isError,true)
|
||||
it.response?.let { it1 -> ma.messageWithSound(it1, false, true) }
|
||||
} else {
|
||||
|
||||
if (it.response == getString(R.string.registerAdded)){
|
||||
|
||||
it.response?.let { it1 -> ma.messageWithSound(it1,false,true) }
|
||||
}else{
|
||||
mperror?.start()
|
||||
it.response.toast(requireContext())
|
||||
ma.messageWithSound(it.response,isError = true,true)
|
||||
}
|
||||
listTags.clear()
|
||||
tagsAdapter!!.notifyDataSetChanged()
|
||||
showExpeditionOrBufferScan()
|
||||
|
||||
|
||||
|
||||
}
|
||||
binding.splashProgress.visibility = GONE
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -135,10 +110,11 @@ class BufferLoadFragment(
|
|||
return when (tagScaned) {
|
||||
1 -> getString(R.string.expedition)
|
||||
2 -> getString(R.string.buffer)
|
||||
else -> { ""}
|
||||
|
||||
else -> {
|
||||
""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -180,10 +156,8 @@ class BufferLoadFragment(
|
|||
customDialogList.getRecyclerView().layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue