diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/fragment/ItemShelvingLogFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/fragment/ItemShelvingLogFragment.kt index 9818bf2a..46e8cb86 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/fragment/ItemShelvingLogFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/fragment/ItemShelvingLogFragment.kt @@ -5,7 +5,6 @@ import android.view.inputmethod.EditorInfo import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R import es.verdnatura.databinding.FragmentItemshelvinglogBinding -import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.view.component.CustomDialog @@ -36,7 +35,6 @@ class ItemShelvingLogFragment( super.init() } - override fun onAttach(context: Context) { if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context super.onAttach(context) @@ -69,29 +67,27 @@ class ItemShelvingLogFragment( override fun observeViewModel() { with(viewModel) { - loadItemShelvingLogList.observe(viewLifecycleOwner) { event -> - event.getContentIfNotHandled().notNull { + itemShelvingLogList.observe(viewLifecycleOwner) { - if (it.list.isEmpty()) { - customDialog.setTitle(getString(R.string.noResults)) - .setDescription(getString(R.string.noDataLabelScanned)) - .setOkButton(getString(R.string.close)) { - customDialog.dismiss() - }.show() - } else { - adapter = ItemShelvingLogAdapter( - it.list, - onPasillerosItemClickListener = pasillerosItemClickListener!! + if (it.list.isEmpty()) { + customDialog.setTitle(getString(R.string.noResults)) + .setDescription(getString(R.string.noDataLabelScanned)) + .setOkButton(getString(R.string.close)) { + customDialog.dismiss() + }.show() + } else { + adapter = ItemShelvingLogAdapter( + it.list, + onPasillerosItemClickListener = pasillerosItemClickListener!! + ) + binding.itemshelvinglogRecyclerview.adapter = adapter + binding.itemshelvinglogRecyclerview.layoutManager = + LinearLayoutManager( + requireContext(), + LinearLayoutManager.VERTICAL, + false ) - binding.itemshelvinglogRecyclerview.adapter = adapter - binding.itemshelvinglogRecyclerview.layoutManager = - LinearLayoutManager( - requireContext(), - LinearLayoutManager.VERTICAL, - false - ) - setToolBar(getString(R.string.itemShelvingLog) + ":" + itemScan) - } + setToolBar(getString(R.string.itemShelvingLog) + ":" + itemScan) } } }