Implementata barra di ricerca nel dialog di selezione articoli da prelevare
This commit is contained in:
parent
f970eb6cac
commit
4c9a1bbaa9
@ -190,7 +190,6 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
|
|
||||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||||
@ -238,6 +237,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUOpened(MtbColt mtbColt) {
|
public void onLUOpened(MtbColt mtbColt) {
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
mToolbarTitleText.setText(String.format(getActivity().getText(R.string.lu_number_text).toString(), mtbColt.getNumCollo()));
|
mToolbarTitleText.setText(String.format(getActivity().getText(R.string.lu_number_text).toString(), mtbColt.getNumCollo()));
|
||||||
|
|
||||||
initAdapter();
|
initAdapter();
|
||||||
@ -253,15 +253,18 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
});
|
});
|
||||||
|
|
||||||
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUClosed() {
|
public void onLUClosed() {
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
mToolbarTitleText.setText(getActivity().getText(R.string.free_picking_title_fragment).toString());
|
mToolbarTitleText.setText(getActivity().getText(R.string.free_picking_title_fragment).toString());
|
||||||
destroyAdapter();
|
destroyAdapter();
|
||||||
|
|
||||||
thereIsAnyRowInUL.set(false);
|
thereIsAnyRowInUL.set(false);
|
||||||
thereIsAnOpenedUL.set(false);
|
thereIsAnOpenedUL.set(false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -276,6 +279,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
|
|
||||||
if (ex instanceof InvalidPesoKGException) {
|
if (ex instanceof InvalidPesoKGException) {
|
||||||
@ -285,6 +289,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
}
|
}
|
||||||
|
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -357,7 +362,9 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRowSaved() {
|
public void onRowSaved() {
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -181,15 +181,18 @@ public class PickingLiberoViewModel {
|
|||||||
if (this.mFlagAskCliente) {
|
if (this.mFlagAskCliente) {
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
this.sendLUClienteRequired((vtbDest, codJcom) -> {
|
this.sendLUClienteRequired((vtbDest, codJcom) -> {
|
||||||
this.sendOnLoadingStarted();
|
|
||||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
|
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
|
||||||
}, onComplete);
|
}, () -> {
|
||||||
|
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, null, null, onComplete);
|
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, null, null, onComplete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNewLU_PostClienteAsk(Integer customNumCollo, String customSerCollo, VtbDest vtbDest, String codJcom, Runnable onComplete) {
|
private void createNewLU_PostClienteAsk(Integer customNumCollo, String customSerCollo, VtbDest vtbDest, String codJcom, Runnable onComplete) {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
MtbColt mtbColt = new MtbColt();
|
MtbColt mtbColt = new MtbColt();
|
||||||
mtbColt.initDefaultFields();
|
mtbColt.initDefaultFields();
|
||||||
mtbColt.setGestione(mDefaultGestione)
|
mtbColt.setGestione(mDefaultGestione)
|
||||||
@ -378,6 +381,7 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
mColliMagazzinoRESTConsumer.saveCollo(clonedTestata, value -> {
|
mColliMagazzinoRESTConsumer.saveCollo(clonedTestata, value -> {
|
||||||
for (int i = 0; i < mtbColrObservableField.size(); i++) {
|
for (int i = 0; i < mtbColrObservableField.size(); i++) {
|
||||||
MtbColr initialMtbColr = mtbColrObservableField.get(i);
|
MtbColr initialMtbColr = mtbColrObservableField.get(i);
|
||||||
@ -389,19 +393,6 @@ public class PickingLiberoViewModel {
|
|||||||
.setSerCollo(value.getSerCollo());
|
.setSerCollo(value.getSerCollo());
|
||||||
|
|
||||||
initialMtbColr.setRiga(value.getMtbColr().get(i).getRiga());
|
initialMtbColr.setRiga(value.getMtbColr().get(i).getRiga());
|
||||||
|
|
||||||
// for (int j = 0; j < value.getMtbColr().size(); j++) {
|
|
||||||
// MtbColr savedMtbColr = value.getMtbColr().get(j);
|
|
||||||
// if (savedMtbColr.getCodMart().equals(initialMtbColr.getCodMart()) &&
|
|
||||||
// UtilityString.equalsIgnoreCase(savedMtbColr.getPartitaMag(), initialMtbColr.getPartitaMag()) &&
|
|
||||||
// UtilityString.equalsIgnoreCase(savedMtbColr.getCodCol(), initialMtbColr.getCodCol()) &&
|
|
||||||
// UtilityString.equalsIgnoreCase(savedMtbColr.getCodTagl(), initialMtbColr.getCodTagl()) &&
|
|
||||||
// savedMtbColr.getQtaCol().equals(initialMtbColr.getQtaCol()) &&
|
|
||||||
// savedMtbColr.getNumCnf().equals(initialMtbColr.getNumCnf())) {
|
|
||||||
// initialMtbColr.setRiga(savedMtbColr.getRiga());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
mCurrentMtbColt.getMtbColr().add(mtbColrObservableField.get(i));
|
mCurrentMtbColt.getMtbColr().add(mtbColrObservableField.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,7 +400,10 @@ public class PickingLiberoViewModel {
|
|||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
|
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
|
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}, onComplete);
|
}, onComplete);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -96,6 +96,7 @@ public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.O
|
|||||||
@Override
|
@Override
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
if(position != lastPage) {
|
if(position != lastPage) {
|
||||||
|
if(lastPage != -1) mDatasetViews.get(lastPage).getValue().onDismiss();
|
||||||
viewPager.onPageChanged(mDatasetViews.get(position).getKey().getRoot());
|
viewPager.onPageChanged(mDatasetViews.get(position).getKey().getRoot());
|
||||||
mDatasetViews.get(position).getValue().onShow();
|
mDatasetViews.get(position).getValue().onShow();
|
||||||
lastPage = position;
|
lastPage = position;
|
||||||
@ -111,4 +112,8 @@ public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.O
|
|||||||
public void onPageScrollStateChanged(int state) {
|
public void onPageScrollStateChanged(int state) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onDismiss() {
|
||||||
|
if(lastPage != -1) mDatasetViews.get(lastPage).getValue().onDismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -133,6 +133,7 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
mAdapter.onDismiss();
|
||||||
if(!mIsClienteSelected) {
|
if(!mIsClienteSelected) {
|
||||||
this.mOnAbort.run();
|
this.mOnAbort.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,8 +66,8 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
"WHERE vtb_clie.flag_stato = 'A' " +
|
"WHERE vtb_clie.flag_stato = 'A' " +
|
||||||
"ORDER BY rag_soc";
|
"ORDER BY rag_soc";
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<HashMap<String, Object>>>() {
|
Type typeOfObjectsList = new TypeToken<ArrayList<HashMap<String, Object>>>() { }.getType();
|
||||||
}.getType();
|
|
||||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<HashMap<String, Object>>>() {
|
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<HashMap<String, Object>>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ArrayList<HashMap<String, Object>> value) {
|
public void onSuccess(ArrayList<HashMap<String, Object>> value) {
|
||||||
@ -106,6 +106,11 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss() {
|
||||||
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnConfirmClickListener(Runnable onConfirm) {
|
public void setOnConfirmClickListener(Runnable onConfirm) {
|
||||||
this.mBinding.buttonYes.setOnClickListener(v -> {
|
this.mBinding.buttonYes.setOnClickListener(v -> {
|
||||||
|
|||||||
@ -71,6 +71,10 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnConfirmClickListener(Runnable onConfirm) {
|
public void setOnConfirmClickListener(Runnable onConfirm) {
|
||||||
this.mOnConfirm = onConfirm;
|
this.mOnConfirm = onConfirm;
|
||||||
|
|||||||
@ -12,6 +12,8 @@ public interface IDialogAskClienteViewModel {
|
|||||||
|
|
||||||
void onShow();
|
void onShow();
|
||||||
|
|
||||||
|
void onDismiss();
|
||||||
|
|
||||||
void setOnConfirmClickListener(Runnable onConfirm);
|
void setOnConfirmClickListener(Runnable onConfirm);
|
||||||
|
|
||||||
void setOnAbortClickListener(Runnable onAbort);
|
void setOnAbortClickListener(Runnable onAbort);
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import android.graphics.drawable.ColorDrawable;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.appcompat.widget.SearchView;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
@ -22,7 +23,6 @@ import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
|||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
@ -42,13 +42,13 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
private Context currentContext;
|
private Context currentContext;
|
||||||
private Dialog mDialog;
|
private Dialog mDialog;
|
||||||
|
|
||||||
|
private DialogChooseArtsFromListaArtsLayoutBinding mBindings;
|
||||||
private DialogChooseArtsFromListaArtsAdapter currentAdapter;
|
private DialogChooseArtsFromListaArtsAdapter currentAdapter;
|
||||||
|
|
||||||
private RunnableArgs<List<MtbColr>> mOnItemsChoosed;
|
private RunnableArgs<List<MtbColr>> mOnItemsChoosed;
|
||||||
private Runnable mOnAbort;
|
private Runnable mOnAbort;
|
||||||
|
|
||||||
private List<DialogChooseArtsFromListaArtsItemModel> mDataset;
|
private List<DialogChooseArtsFromListaArtsItemModel> mDataset;
|
||||||
private BindableBoolean filterStatus = new BindableBoolean(false);
|
|
||||||
|
|
||||||
public static void make(@NotNull final FragmentActivity activity, List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
public static void make(@NotNull final FragmentActivity activity, List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||||
activity.runOnUiThread(() -> {
|
activity.runOnUiThread(() -> {
|
||||||
@ -75,14 +75,13 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
DialogChooseArtsFromListaArtsLayoutBinding binding = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_arts_from_lista_arts_layout, null, false);
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_arts_from_lista_arts_layout, null, false);
|
||||||
|
|
||||||
binding.setFilterStatus(filterStatus);
|
mBindings.emptyView.setVisibility(listaMtbColr != null && listaMtbColr.size() > 0 ? View.GONE : View.VISIBLE);
|
||||||
binding.emptyView.setVisibility(listaMtbColr != null && listaMtbColr.size() > 0 ? View.GONE : View.VISIBLE);
|
|
||||||
|
|
||||||
|
|
||||||
mDialog = new Dialog(context);
|
mDialog = new Dialog(context);
|
||||||
mDialog.setContentView(binding.getRoot());
|
mDialog.setContentView(mBindings.getRoot());
|
||||||
mDialog.setCanceledOnTouchOutside(false);
|
mDialog.setCanceledOnTouchOutside(false);
|
||||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
@ -93,38 +92,114 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
UtilityDialog.setTo90PercentWidth(context, mDialog);
|
UtilityDialog.setTo90PercentWidth(context, mDialog);
|
||||||
|
|
||||||
|
|
||||||
initRecyclerView(binding);
|
initRecyclerView();
|
||||||
|
|
||||||
initRemoveFilterButton(binding);
|
initFilter();
|
||||||
|
|
||||||
setupBarcode();
|
setupBarcode();
|
||||||
|
|
||||||
binding.positiveButton.setOnClickListener(v -> {
|
mBindings.positiveButton.setOnClickListener(v -> {
|
||||||
mDialog.dismiss();
|
mDialog.dismiss();
|
||||||
onPositiveClick();
|
onPositiveClick();
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.negativeButton.setOnClickListener(v -> {
|
mBindings.negativeButton.setOnClickListener(v -> {
|
||||||
mDialog.dismiss();
|
mDialog.dismiss();
|
||||||
onNegativeClick();
|
onNegativeClick();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initRecyclerView(DialogChooseArtsFromListaArtsLayoutBinding binding) {
|
private void initRecyclerView() {
|
||||||
binding.dialogChooseArtsFromListaArtMainList.setNestedScrollingEnabled(false);
|
mBindings.dialogChooseArtsFromListaArtMainList.setNestedScrollingEnabled(false);
|
||||||
|
|
||||||
binding.dialogChooseArtsFromListaArtMainList.setHasFixedSize(true);
|
mBindings.dialogChooseArtsFromListaArtMainList.setHasFixedSize(true);
|
||||||
|
|
||||||
binding.dialogChooseArtsFromListaArtMainList.setLayoutManager(new LinearLayoutManager(currentContext));
|
mBindings.dialogChooseArtsFromListaArtMainList.setLayoutManager(new LinearLayoutManager(currentContext));
|
||||||
|
|
||||||
currentAdapter = new DialogChooseArtsFromListaArtsAdapter(currentContext, mDataset);
|
currentAdapter = new DialogChooseArtsFromListaArtsAdapter(currentContext, mDataset);
|
||||||
binding.dialogChooseArtsFromListaArtMainList.setAdapter(currentAdapter);
|
mBindings.dialogChooseArtsFromListaArtMainList.setAdapter(currentAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initRemoveFilterButton(DialogChooseArtsFromListaArtsLayoutBinding binding) {
|
private void initFilter() {
|
||||||
binding.buttonRemoveFilter.setOnClickListener(v -> {
|
mBindings.mainSearch.setOnCloseListener(() -> {
|
||||||
|
this.removeListFilter();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
mBindings.mainSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onQueryTextSubmit(String query) {
|
||||||
|
// removeListFilter();
|
||||||
|
//
|
||||||
|
// if (!UtilityString.isNullOrEmpty(query) && query.trim().length() > 3) {
|
||||||
|
// List<DialogChooseArtsFromListaArtsItemModel> foundRowsList = Stream.of(mDataset)
|
||||||
|
// .filter(x -> {
|
||||||
|
// String codMart = x.getMtbColr().getMtbAart().getCodMart();
|
||||||
|
// String descrizioneArt = x.getMtbColr().getMtbAart().getDescrizioneEstesa();
|
||||||
|
// String diacod = x.getMtbColr().getMtbAart().getDiacod();
|
||||||
|
//
|
||||||
|
// return ((codMart.startsWith(query) ||
|
||||||
|
// codMart.endsWith(query) ||
|
||||||
|
// codMart.contains(query) ||
|
||||||
|
// codMart.equalsIgnoreCase(query)) ||
|
||||||
|
// (descrizioneArt.startsWith(query) ||
|
||||||
|
// descrizioneArt.endsWith(query) ||
|
||||||
|
// descrizioneArt.contains(query) ||
|
||||||
|
// descrizioneArt.equalsIgnoreCase(query)) ||
|
||||||
|
// (diacod.startsWith(query) ||
|
||||||
|
// diacod.endsWith(query) ||
|
||||||
|
// diacod.contains(query) ||
|
||||||
|
// diacod.equalsIgnoreCase(query))) &&
|
||||||
|
// !x.isHidden();
|
||||||
|
// })
|
||||||
|
// .toList();
|
||||||
|
//
|
||||||
|
// for (int i = 0; i < mDataset.size(); i++) {
|
||||||
|
// mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onQueryTextChange(String newText) {
|
||||||
removeListFilter();
|
removeListFilter();
|
||||||
|
|
||||||
|
newText = newText.toLowerCase();
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(newText) && newText.trim().length() > 2) {
|
||||||
|
String finalNewText = newText;
|
||||||
|
List<DialogChooseArtsFromListaArtsItemModel> foundRowsList = Stream.of(mDataset)
|
||||||
|
.filter(x -> {
|
||||||
|
String codMart = x.getMtbColr().getMtbAart().getCodMart().toLowerCase();
|
||||||
|
String descrizioneArt = x.getMtbColr().getMtbAart().getDescrizioneEstesa().toLowerCase();
|
||||||
|
String diacod = x.getMtbColr().getMtbAart().getDiacod().toLowerCase();
|
||||||
|
|
||||||
|
return ((codMart.startsWith(finalNewText) ||
|
||||||
|
codMart.endsWith(finalNewText) ||
|
||||||
|
codMart.contains(finalNewText) ||
|
||||||
|
codMart.equalsIgnoreCase(finalNewText)) ||
|
||||||
|
(descrizioneArt.startsWith(finalNewText) ||
|
||||||
|
descrizioneArt.endsWith(finalNewText) ||
|
||||||
|
descrizioneArt.contains(finalNewText) ||
|
||||||
|
descrizioneArt.equalsIgnoreCase(finalNewText)) ||
|
||||||
|
(diacod.startsWith(finalNewText) ||
|
||||||
|
diacod.endsWith(finalNewText) ||
|
||||||
|
diacod.contains(finalNewText) ||
|
||||||
|
diacod.equalsIgnoreCase(finalNewText))) &&
|
||||||
|
!x.isHidden();
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
for (int i = 0; i < mDataset.size(); i++) {
|
||||||
|
mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +242,8 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||||
if(!UtilityString.isNullOrEmpty(ean128Model.Content)) barcodeProd = ean128Model.Content;
|
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||||
|
barcodeProd = ean128Model.Content;
|
||||||
|
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||||
@ -198,15 +274,16 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Dialog progressDialog) {
|
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Dialog progressDialog) {
|
||||||
if (barcodeProd.length() == 14) {
|
if (barcodeProd.length() == 14) {
|
||||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String finalBarcodeProd = barcodeProd;
|
||||||
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
|
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
|
||||||
|
|
||||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||||
|
this.mBindings.mainSearch.setQuery(finalBarcodeProd, false);
|
||||||
|
|
||||||
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
||||||
|
|
||||||
@ -243,24 +320,17 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
for (int i = 0; i < mDataset.size(); i++) {
|
for (int i = 0; i < mDataset.size(); i++) {
|
||||||
mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
filterStatus.set(true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void removeListFilter() {
|
private void removeListFilter() {
|
||||||
filterStatus.set(false);
|
|
||||||
for (DialogChooseArtsFromListaArtsItemModel itemModel : mDataset) {
|
for (DialogChooseArtsFromListaArtsItemModel itemModel : mDataset) {
|
||||||
itemModel.setHidden(false);
|
itemModel.setHidden(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void onPositiveClick() {
|
private void onPositiveClick() {
|
||||||
if (mOnItemsChoosed != null) {
|
if (mOnItemsChoosed != null) {
|
||||||
mOnItemsChoosed.run(currentAdapter.getSelectedItems());
|
mOnItemsChoosed.run(currentAdapter.getSelectedItems());
|
||||||
@ -273,5 +343,4 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,103 +3,54 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
<import type="android.view.View" />
|
<import type="android.view.View" />
|
||||||
|
|
||||||
<variable
|
|
||||||
name="filterStatus"
|
|
||||||
type="it.integry.integrywmsnative.core.di.BindableBoolean" />
|
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/base_root"
|
android:id="@+id/base_root"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
app:cardCornerRadius="12dp"
|
app:cardCornerRadius="12dp"
|
||||||
app:cardElevation="0dp">
|
app:cardElevation="0dp">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingTop="24dp"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:paddingEnd="8dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/buttons"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHeight_default="wrap"
|
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/title_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/TextViewMaterial.DialogTitle"
|
|
||||||
android:text="@string/dialog_choose_arts_from_lista_art"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/button_remove_filter"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
style="@style/Button.DangerOutline"
|
|
||||||
app:icon="@drawable/ic_clear_24dp"
|
|
||||||
app:strokeColor="@color/red_400"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:visibility="@{filterStatus.get() ? View.VISIBLE : View.GONE}"
|
|
||||||
android:text="@string/remove_filter_button"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/title_text"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:orientation="vertical"
|
||||||
app:layout_constraintTop_toBottomOf="@id/button_remove_filter"
|
android:paddingStart="8dp"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
android:paddingTop="24dp"
|
||||||
app:layout_constraintRight_toRightOf="parent">
|
android:paddingEnd="8dp"
|
||||||
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@id/buttons"
|
||||||
|
android:layout_below="@id/title_container"
|
||||||
|
android:paddingTop="8dp">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/empty_view"
|
android:id="@+id/empty_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
|
||||||
android:padding="16dp"
|
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginBottom="16dp">
|
android:layout_marginBottom="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/no_item_to_pick_text"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="@color/empty_view_gray"/>
|
android:text="@string/no_item_to_pick_text"
|
||||||
|
android:textColor="@color/empty_view_gray"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
@ -110,24 +61,68 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:id="@+id/title_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title_text"
|
||||||
|
style="@style/TextViewMaterial.DialogTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="@string/dialog_choose_arts_from_lista_art" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SearchView
|
||||||
|
android:id="@+id/main_search"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:iconifiedByDefault="true"
|
||||||
|
app:defaultQueryHint="@string/search"
|
||||||
|
app:iconifiedByDefault="false"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:tint="@android:color/black"/>
|
||||||
|
|
||||||
|
<!-- <com.google.android.material.button.MaterialButton-->
|
||||||
|
<!-- android:id="@+id/button_remove_filter"-->
|
||||||
|
<!-- style="@style/Button.DangerOutline"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_gravity="center_horizontal"-->
|
||||||
|
<!-- android:layout_marginTop="8dp"-->
|
||||||
|
<!-- android:text="@string/remove_filter_button"-->
|
||||||
|
<!-- android:visibility="@{filterStatus.get() ? View.VISIBLE : View.GONE}"-->
|
||||||
|
<!-- app:icon="@drawable/ic_clear_24dp"-->
|
||||||
|
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||||
|
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||||
|
<!-- app:strokeColor="@color/red_400" />-->
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/buttons"
|
android:id="@+id/buttons"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginEnd="4dp"
|
android:layout_marginEnd="4dp"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="8dp">
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
<androidx.constraintlayout.widget.Guideline
|
||||||
android:id="@+id/center_guideline"
|
android:id="@+id/center_guideline"
|
||||||
@ -139,35 +134,37 @@
|
|||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/negative_button"
|
android:id="@+id/negative_button"
|
||||||
|
style="@style/Button.PrimaryOutline"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/Button.PrimaryOutline"
|
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
|
android:text="@string/abort"
|
||||||
app:layout_constrainedHeight="true"
|
app:layout_constrainedHeight="true"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
||||||
android:text="@string/abort"/>
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/positive_button"
|
android:id="@+id/positive_button"
|
||||||
|
style="@style/Button.PrimaryFull"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/Button.PrimaryFull"
|
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
|
android:text="@string/confirm"
|
||||||
app:layout_constrainedHeight="true"
|
app:layout_constrainedHeight="true"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:text="@string/confirm"/>
|
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|||||||
10
build.gradle
10
build.gradle
@ -31,11 +31,11 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
// gradle.projectsEvaluated {
|
||||||
tasks.withType(JavaCompile) {
|
// tasks.withType(JavaCompile) {
|
||||||
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user