Completato refactoring DialogInfoAggiuntiveLU
This commit is contained in:
@@ -114,7 +114,8 @@ import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.Di
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.InfoAggiuntiveLUDialogComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPesoLUComponent;
|
||||
@@ -195,7 +196,8 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
DialogBindProductBarcodeWithPackageModule.class,
|
||||
DialogAskUnknownBarcodeNotesModule.class,
|
||||
ProdVersamentoMaterialeInBufferModule.class,
|
||||
DialogInputQuantityToReturnModule.class
|
||||
DialogInputQuantityToReturnModule.class,
|
||||
DialogInfoAggiuntiveLUModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -281,8 +283,6 @@ public interface MainApplicationComponent {
|
||||
|
||||
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
||||
|
||||
InfoAggiuntiveLUDialogComponent.Factory infoAggiuntiveLUDialogComponent();
|
||||
|
||||
DialogEditArticoloComponent.Factory dialogEditArticoloComponent();
|
||||
|
||||
DialogPrintOrderSSCCListComponent.Factory dialogPrintOrderSSCCListComponent();
|
||||
@@ -329,6 +329,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
DialogInputQuantityToReturnComponent.Factory dialogInputQuantityToReturnComponent();
|
||||
|
||||
DialogInfoAggiuntiveLUComponent.Factory dialogInfoAggiuntiveLUComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -37,6 +37,7 @@ import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
@@ -50,7 +51,6 @@ import it.integry.integrywmsnative.databinding.ActivityAccettazioneBollaPickingB
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.SitBollaAccettazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.TestataBollaAccettazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_picking.dto.AccettazioneBollaPickingOrderBy;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_picking.dto.PickingObjectDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_picking.ui.AccettazioneBollaPickingListAdapter;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_picking.ui.AccettazioneBollaPickingListModel;
|
||||
@@ -63,7 +63,7 @@ import it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLU;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done.DialogVersamentoAutomaticoULDoneView;
|
||||
@@ -447,9 +447,8 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
|
||||
@Override
|
||||
public void onInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||
runOnUiThread(() -> {
|
||||
DialogInfoAggiuntiveLU.newInstance(onComplete).show(getSupportFragmentManager(), "InfoAggiuntiveLUDialog");
|
||||
});
|
||||
DialogInfoAggiuntiveLUView.newInstance(onComplete, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,10 +5,12 @@ import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.preference.PreferenceManager;
|
||||
@@ -42,6 +44,7 @@ import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
@@ -53,7 +56,6 @@ import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityToast;
|
||||
import it.integry.integrywmsnative.databinding.ActivityAccettazioneOrdineInevasoBinding;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.dto.OrdineAccettazioneInevasoDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.dto.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordini_picking.dto.AccettazioneOrdineInevasoOrderBy;
|
||||
@@ -73,7 +75,7 @@ import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFrag
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul.DialogAskShouldVersamentoAutomaticoULView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLU;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done.DialogVersamentoAutomaticoULDoneView;
|
||||
@@ -111,6 +113,8 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
private boolean mShowSecondaryUntMis = true;
|
||||
|
||||
private PopupMenu fabPopupMenu;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -121,7 +125,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
mBindings = DataBindingUtil.setContentView(this, R.layout.activity_accettazione_ordine_inevaso);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
mBindings.setAccettazioneView(this);
|
||||
mBindings.setView(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.accettazionePickingComponent()
|
||||
@@ -142,6 +146,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
this.initBarcodeReader();
|
||||
this.initRecyclerView();
|
||||
this.initFilters();
|
||||
this.initFab();
|
||||
|
||||
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
|
||||
|
||||
@@ -152,6 +157,51 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
useQtaOrd);
|
||||
}
|
||||
|
||||
private void initFab() {
|
||||
fabPopupMenu = new PopupMenu(this, this.mBindings.accettazioneOrdineInevasoFab,
|
||||
(Gravity.END | Gravity.BOTTOM),
|
||||
androidx.appcompat.R.attr.popupMenuStyle,
|
||||
com.google.android.material.R.style.Widget_Material3_PopupMenu_ContextMenu);
|
||||
|
||||
fabPopupMenu.setForceShowIcon(true);
|
||||
fabPopupMenu.getMenuInflater().inflate(R.menu.accettazione_ordine_inevaso_fab_menu, fabPopupMenu.getMenu());
|
||||
|
||||
fabPopupMenu.setOnMenuItemClickListener(item -> {
|
||||
int itemId = item.getItemId();
|
||||
|
||||
if (itemId == R.id.show_created_ul) {
|
||||
showCreatedUL();
|
||||
} else if (itemId == R.id.create_ul) {
|
||||
createNewLU();
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// if (fabPopupMenu.getMenu() instanceof MenuBuilder) {
|
||||
// var menuBuilder = (MenuBuilder) fabPopupMenu.getMenu();
|
||||
// menuBuilder.setOptionalIconsVisible(true);
|
||||
// for (var item : menuBuilder.getVisibleItems()) {
|
||||
// var iconMarginPx =
|
||||
// TypedValue.applyDimension(
|
||||
// TypedValue.COMPLEX_UNIT_DIP, ICON_MARGIN.toFloat(), resources.displayMetrics)
|
||||
// .toInt();
|
||||
// if (item.icon != null) {
|
||||
// if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
// item.icon = InsetDrawable(item.icon, iconMarginPx, 0, iconMarginPx,0)
|
||||
// } else {
|
||||
// item.icon =
|
||||
// object : InsetDrawable(item.icon, iconMarginPx, 0, iconMarginPx, 0) {
|
||||
// override fun getIntrinsicWidth(): Int {
|
||||
// return intrinsicHeight + iconMarginPx + iconMarginPx
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void initFilters() {
|
||||
|
||||
var onPredicateChanged = new OnGeneralChangedCallback() {
|
||||
@@ -678,8 +728,12 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
};
|
||||
|
||||
|
||||
public void showFabMenu() {
|
||||
fabPopupMenu.show();
|
||||
}
|
||||
|
||||
public void createNewLU() {
|
||||
this.mBindings.accettazioneOrdineInevasoFab.close(true);
|
||||
this.fabPopupMenu.dismiss();
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.createNewLU(null, null, false, () -> {
|
||||
@@ -688,7 +742,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
}
|
||||
|
||||
public void showCreatedUL() {
|
||||
this.mBindings.accettazioneOrdineInevasoFab.close(true);
|
||||
this.fabPopupMenu.dismiss();
|
||||
|
||||
this.mViewModel.retrieveExistentLU(this::startListaBancaliRegistratiActivity);
|
||||
}
|
||||
@@ -773,9 +827,12 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
@Override
|
||||
public void onInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||
runOnUiThread(() -> {
|
||||
DialogInfoAggiuntiveLU.newInstance(onComplete).show(getSupportFragmentManager(), "InfoAggiuntiveLUDialog");
|
||||
});
|
||||
// runOnUiThread(() -> {
|
||||
// DialogInfoAggiuntiveLU.newInstance(onComplete).show(getSupportFragmentManager(), "InfoAggiuntiveLUDialog");
|
||||
// });
|
||||
|
||||
DialogInfoAggiuntiveLUView.newInstance(onComplete, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFrag
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShouldPrint;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLU;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
|
||||
@@ -276,7 +276,8 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
@Override
|
||||
public void onInfoAggiuntiveRequired(RunnableArgss<String, MtbTCol> onComplete) {
|
||||
DialogInfoAggiuntiveLU.newInstance(onComplete).show(getSupportFragmentManager(), "InfoAggiuntiveLUDialog");
|
||||
DialogInfoAggiuntiveLUView.newInstance(onComplete, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -73,7 +73,7 @@ import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotView;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLU;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPesoLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
@@ -1015,6 +1015,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
@Override
|
||||
public void onInfoAggiuntiveRequired(MtbColt mtbColt, RunnableArgss<String, MtbTCol> onComplete) {
|
||||
DialogInfoAggiuntiveLU.newInstance(mtbColt, onComplete).show(getSupportFragmentManager(), "InfoAggiuntiveLUDialog");
|
||||
DialogInfoAggiuntiveLUView.newInstance(mtbColt, onComplete, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableField;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogNoteAggiuntiveNuovaUlBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.adapter.DialogInputLUProdTipoColloAdapter;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.adapter.DialogInputLUProdTipoColloListModel;
|
||||
|
||||
public class DialogInfoAggiuntiveLU extends BaseDialogFragment implements InfoAggiuntiveLUDialogViewModel.Listener {
|
||||
|
||||
@Inject
|
||||
InfoAggiuntiveLUDialogViewModel mViewModel;
|
||||
|
||||
private DialogNoteAggiuntiveNuovaUlBinding mBindings;
|
||||
private final RunnableArgss<String, MtbTCol> mOnComplete;
|
||||
private MtbColt currentMtbColt;
|
||||
private DialogInputLUProdTipoColloAdapter codTcolArrayAdapter = null;
|
||||
public ObservableField<String> additionalNotes = new ObservableField<>();
|
||||
public ObservableField<String> selectedMtbTcol = new ObservableField<>();
|
||||
public ObservableField<DialogInputLUProdTipoColloListModel> currentMtbTCol = new ObservableField<>();
|
||||
|
||||
public static DialogInfoAggiuntiveLU newInstance(@NotNull RunnableArgss<String, MtbTCol> onComplete) {
|
||||
return new DialogInfoAggiuntiveLU(null, onComplete);
|
||||
}
|
||||
|
||||
public static DialogInfoAggiuntiveLU newInstance(MtbColt mtbColt, @NotNull RunnableArgss<String, MtbTCol> onComplete) {
|
||||
return new DialogInfoAggiuntiveLU(mtbColt, onComplete);
|
||||
}
|
||||
|
||||
private DialogInfoAggiuntiveLU(MtbColt mtbColt, @NotNull RunnableArgss<String, MtbTCol> onComplete) {
|
||||
super();
|
||||
this.mOnComplete = onComplete;
|
||||
this.currentMtbColt = mtbColt;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
this.init();
|
||||
|
||||
UtilityDialog.setTo90PercentWidth(requireActivity(), this);
|
||||
this.mViewModel.setListener(this);
|
||||
this.mViewModel.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_note_aggiuntive_nuova_ul, container, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.infoAggiuntiveLUDialogComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mBindings.setView(this);
|
||||
mBindings.setViewModel(this.mViewModel);
|
||||
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
getDialog().setCanceledOnTouchOutside(false);
|
||||
getDialog().setCancelable(false);
|
||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
if (mOnComplete != null)
|
||||
mOnComplete.run(additionalNotes.get(), mViewModel.getInternalTipoPed());
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
|
||||
|
||||
UtilityObservable.addPropertyChanged(this.selectedMtbTcol, (value) -> {
|
||||
if (this.codTcolArrayAdapter != null && this.codTcolArrayAdapter.getDataset() != null) {
|
||||
Optional<DialogInputLUProdTipoColloListModel> selectedItem = Stream.of(this.codTcolArrayAdapter.getDataset())
|
||||
.filter(x -> x.toString().equals(value))
|
||||
.findFirst();
|
||||
|
||||
if (selectedItem.isPresent()) {
|
||||
currentMtbTCol.set(selectedItem.get());
|
||||
this.mViewModel.setInternalTipoPed(selectedItem.get().getOriginalModel());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.mViewModel.getTipiCollo().observe(getViewLifecycleOwner(), tipiCollo -> {
|
||||
|
||||
|
||||
codTcolArrayAdapter = new DialogInputLUProdTipoColloAdapter(getActivity(), R.layout.array_adapter_single_item, tipiCollo);
|
||||
mBindings.filledExposedDropdownCodTcol.setAdapter(codTcolArrayAdapter);
|
||||
|
||||
if (currentMtbColt != null && !UtilityString.isNullOrEmpty(currentMtbColt.getCodTcol()) && UtilityString.isNullOrEmpty(this.selectedMtbTcol.get())) {
|
||||
MtbTCol tipoPedana = Stream.of(tipiCollo).filter(x -> x.getCodTcol().equalsIgnoreCase(currentMtbColt.getCodTcol())).findFirstOrElse(null);
|
||||
if (tipoPedana != null) {
|
||||
this.selectedMtbTcol.set(tipoPedana.getCodTcol() + " - " + tipoPedana.getDescrizione());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.mBindings.filledExposedDropdownCodTcol.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
currentMtbTCol.set(codTcolArrayAdapter.getItem(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
currentMtbTCol.set(null);
|
||||
}
|
||||
});
|
||||
|
||||
mBindings.buttonConfirm.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
|
||||
if (this.currentMtbColt != null) {
|
||||
this.additionalNotes.set(currentMtbColt.getAnnotazioni());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogInfoAggiuntiveLUComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogInfoAggiuntiveLUComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogInfoAggiuntiveLUView dialogInfoAggiuntiveLUView);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
||||
|
||||
@Module(subcomponents = DialogInfoAggiuntiveLUComponent.class)
|
||||
public class DialogInfoAggiuntiveLUModule {
|
||||
|
||||
@Provides
|
||||
DialogInfoAggiuntiveLUViewModel providesDialogInfoAggiuntiveLUViewModel(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
return new DialogInfoAggiuntiveLUViewModel(magazzinoRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.ObservableField;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogInfoAggiuntiveLuBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.adapter.DialogInputLUProdTipoColloAdapter;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.adapter.DialogInputLUProdTipoColloListModel;
|
||||
|
||||
public class DialogInfoAggiuntiveLUView extends BaseDialogFragment implements DialogInfoAggiuntiveLUViewModel.Listener {
|
||||
|
||||
@Inject
|
||||
DialogInfoAggiuntiveLUViewModel mViewModel;
|
||||
|
||||
|
||||
public ObservableField<String> additionalNotes = new ObservableField<>();
|
||||
public ObservableField<String> selectedMtbTcol = new ObservableField<>();
|
||||
public ObservableField<DialogInputLUProdTipoColloListModel> currentMtbTCol = new ObservableField<>();
|
||||
|
||||
|
||||
private DialogInfoAggiuntiveLuBinding mBindings;
|
||||
private Context mContext;
|
||||
|
||||
|
||||
private final RunnableArgss<String, MtbTCol> mOnComplete;
|
||||
private final Runnable mOnAbort;
|
||||
private final MtbColt currentMtbColt;
|
||||
|
||||
|
||||
public static DialogInfoAggiuntiveLUView newInstance(@NotNull RunnableArgss<String, MtbTCol> onComplete, @NotNull Runnable onAbort) {
|
||||
return new DialogInfoAggiuntiveLUView(null, onComplete, onAbort);
|
||||
}
|
||||
|
||||
public static DialogInfoAggiuntiveLUView newInstance(MtbColt mtbColt, @NotNull RunnableArgss<String, MtbTCol> onComplete, @NotNull Runnable onAbort) {
|
||||
return new DialogInfoAggiuntiveLUView(mtbColt, onComplete, onAbort);
|
||||
}
|
||||
|
||||
private DialogInfoAggiuntiveLUView(MtbColt mtbColt, @NotNull RunnableArgss<String, MtbTCol> onComplete, @NotNull Runnable onAbort) {
|
||||
super();
|
||||
this.mOnComplete = onComplete;
|
||||
this.mOnAbort = onAbort;
|
||||
this.currentMtbColt = mtbColt;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
mBindings = DialogInfoAggiuntiveLuBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogInfoAggiuntiveLUComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mBindings.setView(this);
|
||||
mBindings.setViewModel(mViewModel);
|
||||
mViewModel.setListener(this);
|
||||
|
||||
setCancelable(false);
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable())
|
||||
.setPositiveButton(R.string.confirm, (dialogInterface, i) -> {
|
||||
mOnComplete.run(additionalNotes.get(), currentMtbTCol.get() != null ? currentMtbTCol.get().getOriginalModel() : null);
|
||||
})
|
||||
.setNegativeButton(R.string.abort, (dialogInterface, i) -> {
|
||||
this.mOnAbort.run();
|
||||
})
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
super.onShow(dialogInterface);
|
||||
|
||||
this.init();
|
||||
this.mViewModel.init();
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
if (this.currentMtbColt != null)
|
||||
this.additionalNotes.set(currentMtbColt.getAnnotazioni());
|
||||
|
||||
var codTcolArrayAdapter = new DialogInputLUProdTipoColloAdapter(requireContext(),
|
||||
R.layout.array_adapter_single_item,
|
||||
this.mViewModel.getTipiCollo());
|
||||
|
||||
mBindings.filledExposedDropdownCodTcol.setAdapter(codTcolArrayAdapter);
|
||||
|
||||
this.mViewModel.getTipiCollo().observe(this, tipiCollo -> {
|
||||
|
||||
if (currentMtbColt != null && !UtilityString.isNullOrEmpty(currentMtbColt.getCodTcol()) && UtilityString.isNullOrEmpty(this.selectedMtbTcol.get())) {
|
||||
tipiCollo.stream()
|
||||
.filter(x -> x.getCodTcol().equalsIgnoreCase(currentMtbColt.getCodTcol()))
|
||||
.findFirst()
|
||||
.ifPresent(tipoPedana -> this.selectedMtbTcol.set(tipoPedana.getCodTcol() + " - " + tipoPedana.getDescrizione()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
UtilityObservable.addPropertyChanged(this.selectedMtbTcol, (value) -> {
|
||||
if (codTcolArrayAdapter.getDataset() != null) {
|
||||
codTcolArrayAdapter.getDataset().stream()
|
||||
.filter(x -> x.toString().equals(value))
|
||||
.findFirst()
|
||||
.ifPresent(tipoPedana -> {
|
||||
currentMtbTCol.set(tipoPedana);
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.mBindings.filledExposedDropdownCodTcol.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
currentMtbTCol.set(codTcolArrayAdapter.getItem(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
currentMtbTCol.set(null);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,23 +10,21 @@ import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingL
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
||||
|
||||
public class InfoAggiuntiveLUDialogViewModel {
|
||||
public class DialogInfoAggiuntiveLUViewModel {
|
||||
|
||||
public final MutableLiveData<List<MtbTCol>> tipiCollo = new MutableLiveData<>();
|
||||
|
||||
private MtbTCol internalTipoPed;
|
||||
private final MutableLiveData<List<MtbTCol>> tipiCollo = new MutableLiveData<>();
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
private final MagazzinoRESTConsumer mMagazzinoRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public InfoAggiuntiveLUDialogViewModel(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
this.mMagazzinoRESTConsumer = magazzinoRESTConsumer;
|
||||
public DialogInfoAggiuntiveLUViewModel(MagazzinoRESTConsumer mMagazzinoRESTConsumer) {
|
||||
this.mMagazzinoRESTConsumer = mMagazzinoRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void init() {
|
||||
new Thread(this::sendOnLoadingStarted).start();
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
mMagazzinoRESTConsumer.getTipiCollo(tipiCollo -> {
|
||||
this.tipiCollo.postValue(tipiCollo);
|
||||
@@ -35,19 +33,14 @@ public class InfoAggiuntiveLUDialogViewModel {
|
||||
}
|
||||
|
||||
public MutableLiveData<List<MtbTCol>> getTipiCollo() {
|
||||
return this.tipiCollo;
|
||||
return tipiCollo;
|
||||
}
|
||||
|
||||
|
||||
public void setInternalTipoPed(MtbTCol internalTipoPed) {
|
||||
this.internalTipoPed = internalTipoPed;
|
||||
public void setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
|
||||
public MtbTCol getInternalTipoPed() {
|
||||
return internalTipoPed;
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
}
|
||||
@@ -60,13 +53,9 @@ public class InfoAggiuntiveLUDialogViewModel {
|
||||
if (this.mListener != null) mListener.onError(ex);
|
||||
}
|
||||
|
||||
public void setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
|
||||
void onError(Exception ex);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface InfoAggiuntiveLUDialogComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
InfoAggiuntiveLUDialogComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogInfoAggiuntiveLU infoAggiuntiveLUDialog);
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
||||
|
||||
@Module(subcomponents = InfoAggiuntiveLUDialogComponent.class)
|
||||
public class InfoAggiuntiveLUDialogModule {
|
||||
|
||||
@Provides
|
||||
InfoAggiuntiveLUDialogViewModel providesInfoAggiuntiveLUDialogViewModel(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
return new InfoAggiuntiveLUDialogViewModel(magazzinoRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -328,10 +328,11 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
|
||||
}
|
||||
});
|
||||
|
||||
codTcolArrayAdapter = new DialogInputLUProdTipoColloAdapter(getActivity(), R.layout.array_adapter_single_item, this.mViewModel.getTipiCollo());
|
||||
mBindings.filledExposedDropdownCodTcol.setAdapter(codTcolArrayAdapter);
|
||||
|
||||
this.mViewModel.getTipiCollo().observe(getViewLifecycleOwner(), tipiCollo -> {
|
||||
|
||||
codTcolArrayAdapter = new DialogInputLUProdTipoColloAdapter(getActivity(), R.layout.array_adapter_single_item, tipiCollo);
|
||||
mBindings.filledExposedDropdownCodTcol.setAdapter(codTcolArrayAdapter);
|
||||
|
||||
if (mDialogInputLUProdDTO.getCodTcol() != null) {
|
||||
Optional<MtbTCol> optTCol = Stream.of(tipiCollo)
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
@@ -13,15 +14,20 @@ import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
|
||||
public class DialogInputLUProdTipoColloAdapter extends ArrayAdapter<DialogInputLUProdTipoColloListModel> {
|
||||
|
||||
private final List<DialogInputLUProdTipoColloListModel> mDataset;
|
||||
private List<DialogInputLUProdTipoColloListModel> mDataset;
|
||||
|
||||
public DialogInputLUProdTipoColloAdapter(@NonNull Context context, int resource, @NonNull List<MtbTCol> objects) {
|
||||
public DialogInputLUProdTipoColloAdapter(@NonNull Context context, int resource, @NonNull MutableLiveData<List<MtbTCol>> inputData) {
|
||||
super(context, resource);
|
||||
this.mDataset = Stream.of(objects).map(x -> new DialogInputLUProdTipoColloListModel()
|
||||
.setOriginalModel(x))
|
||||
.toList();
|
||||
|
||||
addAll(mDataset);
|
||||
inputData.observeForever(data -> {
|
||||
mDataset = Stream.of(data)
|
||||
.map(x -> new DialogInputLUProdTipoColloListModel()
|
||||
.setOriginalModel(x))
|
||||
.toList();
|
||||
|
||||
clear();
|
||||
addAll(mDataset);
|
||||
});
|
||||
}
|
||||
|
||||
public List<DialogInputLUProdTipoColloListModel> getDataset() {
|
||||
|
||||
Reference in New Issue
Block a user