Fix thread su creaUl in PickingResi e su DialogBasket
This commit is contained in:
parent
5f5117c0f6
commit
60a405536c
@ -4,6 +4,8 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.InputType;
|
||||
import android.text.SpannableString;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
@ -51,6 +53,7 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentView;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
@ -68,6 +71,9 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
@Inject
|
||||
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||
|
||||
@Inject
|
||||
Handler handler;
|
||||
|
||||
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
||||
|
||||
private ObservableArrayList<PickingResiListModel> mPickingResiMutableData = new ObservableArrayList<>();
|
||||
@ -250,10 +256,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
public void createNewLU() {
|
||||
this.mBindings.mainFab.close(true);
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewmodel.createNewLU(null, null, () -> {
|
||||
this.onLoadingEnded();
|
||||
});
|
||||
this.mViewmodel.createNewLU(null, null, this::onLoadingEnded);
|
||||
}
|
||||
|
||||
public void removeListFilter() {
|
||||
@ -385,6 +388,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
@Override
|
||||
public void onLUOpened(MtbColt mtbColt) {
|
||||
handler.post(() -> {
|
||||
noLUPresent.set(false);
|
||||
|
||||
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
|
||||
@ -392,14 +396,17 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
.show();
|
||||
|
||||
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUClosed() {
|
||||
handler.post(() -> {
|
||||
noLUPresent.set(true);
|
||||
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null);
|
||||
|
||||
if (this.mShouldCloseActivity) super.onBackPressed();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.basket_lu;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
@ -10,8 +12,8 @@ import it.integry.integrywmsnative.view.dialogs.basket_lu.pages.page2.DialogBask
|
||||
public class DialogBasketLUModule {
|
||||
|
||||
@Provides
|
||||
DialogBasketLU_Page1_ViewModel providesDialogBasketLUPage1ViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer) {
|
||||
return new DialogBasketLU_Page1_ViewModel(colliMagazzinoRESTConsumer);
|
||||
DialogBasketLU_Page1_ViewModel providesDialogBasketLUPage1ViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, Handler handler) {
|
||||
return new DialogBasketLU_Page1_ViewModel(colliMagazzinoRESTConsumer, handler);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@ -2,6 +2,7 @@ package it.integry.integrywmsnative.view.dialogs.basket_lu;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -36,7 +37,8 @@ public class DialogBasketLUView extends BaseDialogFragment {
|
||||
private final RunnableArgs<MtbColt> mOnComplete;
|
||||
private DialogBasketLuBinding mBindings;
|
||||
|
||||
|
||||
@Inject
|
||||
Handler handler;
|
||||
|
||||
public DialogBasketLUView(RunnableArgs<MtbColt> onComplete) {
|
||||
mOnComplete = onComplete;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.basket_lu.pages.page1;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
@ -30,9 +31,12 @@ public class DialogBasketLU_Page1_ViewModel extends DialogBasketLU_BaseViewModel
|
||||
|
||||
private final ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer;
|
||||
|
||||
private final Handler handler;
|
||||
|
||||
@Inject
|
||||
public DialogBasketLU_Page1_ViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer) {
|
||||
public DialogBasketLU_Page1_ViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, Handler handler) {
|
||||
this.colliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,17 +57,20 @@ public class DialogBasketLU_Page1_ViewModel extends DialogBasketLU_BaseViewModel
|
||||
@Override
|
||||
public void onShow() {
|
||||
this.mBinding.getRoot().requestLayout();
|
||||
|
||||
mBinding.constraintLayout.setMaxHeight((int) (mContext.getResources().getDisplayMetrics().heightPixels * 0.75));
|
||||
|
||||
colliMagazzinoRESTConsumer.retrieveBasketColli(mtbColts -> {
|
||||
handler.post(() -> {
|
||||
availableMtbColts = mtbColts;
|
||||
if(mtbColts != null && !mtbColts.isEmpty()) initRecyclerView(availableMtbColts);
|
||||
|
||||
mBinding.emptyView.setVisibility(mtbColts != null && !mtbColts.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
});
|
||||
}, ex -> {
|
||||
handler.post(() -> {
|
||||
mBinding.emptyView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user