Refactoring DialogChooseArtsFromMtbColr
This commit is contained in:
parent
92e9529cc5
commit
e25cc9e825
@ -60,8 +60,4 @@ public class CheckableMtbColr {
|
||||
this.hidden = hidden;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void toggleCheck() {
|
||||
this.checked.set(!this.checked.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,28 +1,27 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
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 androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.BR;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
@ -35,33 +34,34 @@ import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromMtbColrListLayoutBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import kotlin.Unit;
|
||||
|
||||
public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment {
|
||||
public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implements DialogInterface.OnShowListener {
|
||||
|
||||
@Inject
|
||||
DialogChooseArtsFromMtbColrListViewModel mViewModel;
|
||||
@Inject
|
||||
BarcodeRESTConsumer barcodeRESTConsumer;
|
||||
|
||||
@Inject
|
||||
ArticoloRESTConsumer articoloRESTConsumer;
|
||||
|
||||
private Context context;
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private final List<MtbColr> inputMtbColrList;
|
||||
private MtbAart selectedArt;
|
||||
private final RunnableArgs<List<MtbColr>> onConfirmed;
|
||||
private final Runnable onAbort;
|
||||
|
||||
|
||||
private DialogChooseArtsFromMtbColrListLayoutBinding mBindings;
|
||||
|
||||
private DialogChooseArtsFromMtbColrListAdapter currentAdapter;
|
||||
|
||||
private final RunnableArgs<List<MtbColr>> mOnItemsChoosed;
|
||||
private final Runnable mOnAbort;
|
||||
|
||||
private final List<DialogChooseArtsFromMtbColrListItemModel> mDataset;
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private MtbAart selectedArt;
|
||||
private List<DialogChooseArtsFromMtbColrListItemModel> mtbColrItemModels;
|
||||
private final MutableLiveData<List<DialogChooseArtsFromMtbColrListItemModel>> hiddenMtbColrItemModels = new MutableLiveData<>();
|
||||
private Context mContext;
|
||||
|
||||
public static DialogChooseArtsFromMtbColrList newInstance(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
return new DialogChooseArtsFromMtbColrList(listaMtbColr, onItemsChoosed, onAbort);
|
||||
@ -77,80 +77,99 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment {
|
||||
this.selectedArt = mtbAart;
|
||||
}
|
||||
|
||||
private DialogChooseArtsFromMtbColrList(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
private DialogChooseArtsFromMtbColrList(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onConfirmed, Runnable onAbort) {
|
||||
super();
|
||||
|
||||
mOnItemsChoosed = onItemsChoosed;
|
||||
mOnAbort = onAbort;
|
||||
this.inputMtbColrList = listaMtbColr;
|
||||
|
||||
mDataset = new ArrayList<>();
|
||||
this.onConfirmed = onConfirmed;
|
||||
this.onAbort = onAbort;
|
||||
|
||||
if (listaMtbColr != null) {
|
||||
for (MtbColr mtbColr : listaMtbColr) {
|
||||
if (UtilityString.isNullOrEmpty(mtbColr.getUntMis()) && mtbColr.getMtbAart() != null) {
|
||||
mtbColr.setUntMis(mtbColr.getMtbAart().getUntMis());
|
||||
}
|
||||
// mDataset = new ArrayList<>();
|
||||
|
||||
mDataset.add(new DialogChooseArtsFromMtbColrListItemModel().setMtbColr(mtbColr));
|
||||
}
|
||||
}
|
||||
// if (listaMtbColr != null) {
|
||||
// for (MtbColr mtbColr : listaMtbColr) {
|
||||
// if (UtilityString.isNullOrEmpty(mtbColr.getUntMis()) && mtbColr.getMtbAart() != null) {
|
||||
// mtbColr.setUntMis(mtbColr.getMtbAart().getUntMis());
|
||||
// }
|
||||
//
|
||||
// mDataset.add(new DialogChooseArtsFromMtbColrListItemModel().setMtbColr(mtbColr));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
this.context = getActivity();
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_arts_from_mtb_colr_list_layout, null, false);
|
||||
mBindings.setLifecycleOwner(getViewLifecycleOwner());
|
||||
mBindings = DialogChooseArtsFromMtbColrListLayoutBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogChooseArtsFromListaArtsComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
UtilityDialog.setTo90PercentWidth(context, this);
|
||||
var cancelable = false;
|
||||
|
||||
mBindings.emptyView.setVisibility(mDataset != null && mDataset.size() > 0 ? View.GONE : View.VISIBLE);
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(cancelable)
|
||||
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
||||
var selectedArts = Stream.of(this.mtbColrItemModels)
|
||||
.filter(x -> x.getChecked().get())
|
||||
.map(DialogChooseArtsFromMtbColrListItemModel::getMtbColr)
|
||||
.toList();
|
||||
|
||||
if (selectedArts.isEmpty()) {
|
||||
if (this.onAbort != null) this.onAbort.run();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.onConfirmed != null)
|
||||
this.onConfirmed.run(selectedArts);
|
||||
})
|
||||
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
if (this.onAbort != null) this.onAbort.run();
|
||||
})
|
||||
.create();
|
||||
|
||||
|
||||
initRecyclerView();
|
||||
initFilter();
|
||||
setupBarcode();
|
||||
|
||||
mBindings.positiveButton.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
onPositiveClick();
|
||||
});
|
||||
|
||||
mBindings.negativeButton.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
onNegativeClick();
|
||||
});
|
||||
|
||||
getDialog().setCanceledOnTouchOutside(false);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
return mBindings.getRoot();
|
||||
alertDialog.setOnShowListener(this);
|
||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
this.initList();
|
||||
this.initFilter();
|
||||
this.setupBarcode();
|
||||
|
||||
if (selectedArt != null) {
|
||||
this.loadArticolo(selectedArt.getBarCode(), null);
|
||||
}
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
mBindings.listaArts.setNestedScrollingEnabled(false);
|
||||
private void initList() {
|
||||
mBindings.listaArts.setHasFixedSize(true);
|
||||
mBindings.listaArts.setLayoutManager(new LinearLayoutManager(context));
|
||||
|
||||
currentAdapter = new DialogChooseArtsFromMtbColrListAdapter(context, mDataset);
|
||||
mBindings.listaArts.setAdapter(currentAdapter);
|
||||
this.mtbColrItemModels = Stream.of(this.inputMtbColrList)
|
||||
.map(x -> new DialogChooseArtsFromMtbColrListItemModel()
|
||||
.setMtbColr(x))
|
||||
.toList();
|
||||
|
||||
this.hiddenMtbColrItemModels.setValue(this.mtbColrItemModels);
|
||||
|
||||
new LiveAdapter(this.hiddenMtbColrItemModels, this, BR.item)
|
||||
.map(DialogChooseArtsFromMtbColrListItemModel.class, R.layout.dialog_choose_arts_from_mtb_colr_list__item_model)
|
||||
.onNoData(noData -> {
|
||||
mBindings.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
|
||||
return Unit.INSTANCE;
|
||||
})
|
||||
.into(this.mBindings.listaArts);
|
||||
}
|
||||
|
||||
|
||||
@ -163,97 +182,63 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment {
|
||||
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();
|
||||
|
||||
newText = newText.toLowerCase();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(newText) && newText.trim().length() > 2) {
|
||||
String finalNewText = newText;
|
||||
List<DialogChooseArtsFromMtbColrListItemModel> 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();
|
||||
if (!UtilityString.isNullOrEmpty(diacod)) {
|
||||
diacod = diacod.toLowerCase();
|
||||
}
|
||||
String finalNewText = newText;
|
||||
final List<DialogChooseArtsFromMtbColrListItemModel> filtered = Stream.of(mtbColrItemModels)
|
||||
.filter(x -> {
|
||||
String codMart = x.getMtbColr().getMtbAart().getCodMart().toLowerCase();
|
||||
String descrizioneArt = x.getMtbColr().getMtbAart().getDescrizioneEstesa().toLowerCase();
|
||||
String diacod = x.getMtbColr().getMtbAart().getDiacod();
|
||||
if (!UtilityString.isNullOrEmpty(diacod)) {
|
||||
diacod = diacod.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)) ||
|
||||
(!UtilityString.isNullOrEmpty(diacod) && (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 ((codMart.startsWith(finalNewText) ||
|
||||
codMart.endsWith(finalNewText) ||
|
||||
codMart.contains(finalNewText) ||
|
||||
codMart.equalsIgnoreCase(finalNewText)) ||
|
||||
(descrizioneArt.startsWith(finalNewText) ||
|
||||
descrizioneArt.endsWith(finalNewText) ||
|
||||
descrizioneArt.contains(finalNewText) ||
|
||||
descrizioneArt.equalsIgnoreCase(finalNewText)) ||
|
||||
(!UtilityString.isNullOrEmpty(diacod) && (diacod.startsWith(finalNewText) ||
|
||||
diacod.endsWith(finalNewText) ||
|
||||
diacod.contains(finalNewText) ||
|
||||
diacod.equalsIgnoreCase(finalNewText))));
|
||||
})
|
||||
.toList();
|
||||
|
||||
hiddenMtbColrItemModels.postValue(filtered);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void removeListFilter() {
|
||||
for (DialogChooseArtsFromMtbColrListItemModel itemModel : mtbColrItemModels) {
|
||||
itemModel.setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupBarcode() {
|
||||
BarcodeManager.enable();
|
||||
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(context, ex, false)));
|
||||
|
||||
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
this.mOnAbort.run();
|
||||
this.onAbort.run();
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
@ -290,18 +275,14 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment {
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin) || !UtilityString.isNullOrEmpty(ean128Model.Content)) {
|
||||
this.loadArticolo(barcodeProd, ean128Model);
|
||||
} else {
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
onLoadingEnded();
|
||||
});
|
||||
DialogCommon.showNoArtFoundDialog(mContext, this::onLoadingEnded);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
onLoadingEnded();
|
||||
});
|
||||
DialogCommon.showNoArtFoundDialog(mContext, this::onLoadingEnded);
|
||||
|
||||
}
|
||||
}, this::onError);
|
||||
@ -320,9 +301,7 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment {
|
||||
|
||||
} else {
|
||||
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
onLoadingEnded();
|
||||
});
|
||||
DialogCommon.showNoArtFoundDialog(mContext, this::onLoadingEnded);
|
||||
}
|
||||
|
||||
}, this::onError);
|
||||
@ -332,38 +311,20 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment {
|
||||
private void searchArtInList(MtbAart mtbAart, Ean128Model ean128Model) {
|
||||
removeListFilter();
|
||||
|
||||
List<DialogChooseArtsFromMtbColrListItemModel> foundRowsList = Stream.of(mDataset)
|
||||
List<DialogChooseArtsFromMtbColrListItemModel> foundRowsList = Stream.of(mtbColrItemModels)
|
||||
.filter(x -> x.getMtbColr().getMtbAart().getCodMart().equalsIgnoreCase(mtbAart.getCodMart()) &&
|
||||
!x.isHidden())
|
||||
.toList();
|
||||
|
||||
if (foundRowsList.size() == 0) {
|
||||
DialogCommon.showNoArtFoundDialog(context, null);
|
||||
DialogCommon.showNoArtFoundDialog(mContext, null);
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < mDataset.size(); i++) {
|
||||
mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
||||
for (int i = 0; i < mtbColrItemModels.size(); i++) {
|
||||
mtbColrItemModels.get(i).setHidden(!foundRowsList.contains(mtbColrItemModels.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void removeListFilter() {
|
||||
for (DialogChooseArtsFromMtbColrListItemModel itemModel : mDataset) {
|
||||
itemModel.setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onPositiveClick() {
|
||||
if (mOnItemsChoosed != null) {
|
||||
mOnItemsChoosed.run(currentAdapter.getSelectedItems());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onNegativeClick() {
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,131 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.Observable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.CheckableMtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromMtbColrListItemModelBinding;
|
||||
|
||||
public class DialogChooseArtsFromMtbColrListAdapter extends RecyclerView.Adapter<DialogChooseArtsFromMtbColrListAdapter.ViewHolder> {
|
||||
|
||||
protected Context mContext;
|
||||
|
||||
private List<CheckableMtbColr> mDataset;
|
||||
private HashMap<CheckableMtbColr, Integer> mDatasetPositions = new HashMap<>();
|
||||
|
||||
|
||||
public DialogChooseArtsFromMtbColrListAdapter(Context context, List<DialogChooseArtsFromMtbColrListItemModel> myDataset) {
|
||||
mContext = context;
|
||||
|
||||
if(myDataset != null) {
|
||||
mDataset = Stream.of(myDataset)
|
||||
.withoutNulls()
|
||||
.map(CheckableMtbColr::new).toList();
|
||||
|
||||
for(int i = 0; i < mDataset.size(); i++) {
|
||||
final CheckableMtbColr itemModel = mDataset.get(i);
|
||||
|
||||
mDatasetPositions.put(itemModel, i);
|
||||
|
||||
itemModel.getHidden().addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@Override
|
||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||
onItemHidden(itemModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onItemHidden(CheckableMtbColr itemModel) {
|
||||
if(itemModel.isHidden()) {
|
||||
mDataset.remove(itemModel);
|
||||
} else {
|
||||
mDataset.add(mDatasetPositions.get(itemModel) , itemModel);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private DialogChooseArtsFromMtbColrListItemModelBinding mViewDataBinding;
|
||||
|
||||
|
||||
public ViewHolder(DialogChooseArtsFromMtbColrListItemModelBinding v) {
|
||||
super(v.getRoot());
|
||||
mViewDataBinding = v;
|
||||
}
|
||||
|
||||
public void bind(CheckableMtbColr checkableMtbColr) {
|
||||
mViewDataBinding.setCheckableMtbColr(checkableMtbColr);
|
||||
|
||||
MtbColr mtbColr = checkableMtbColr.getItem().getMtbColr();
|
||||
|
||||
//Setting qty with unt_mis
|
||||
if(!SettingsManager.iDB().isFlagForceAllToColli() && (mtbColr.getMtbAart() == null || mtbColr.getMtbAart().isFlagQtaCnfFissaBoolean())){
|
||||
String text = UtilityNumber.decimalToString(mtbColr.getQtaCol());
|
||||
|
||||
|
||||
if(mtbColr.getMtbAart() != null) {
|
||||
text += !UtilityString.isNullOrEmpty(mtbColr.getMtbAart().getUntMis()) ? "\n" + mtbColr.getMtbAart().getUntMis() : "";
|
||||
}
|
||||
|
||||
mViewDataBinding.qtaTextview.setText(text);
|
||||
|
||||
|
||||
} else {
|
||||
mViewDataBinding.qtaTextview.setText(UtilityNumber.decimalToString(mtbColr.getNumCnf()) + "\n" + UtilityResources.getString(R.string.unt_mis_col));
|
||||
}
|
||||
|
||||
mViewDataBinding.executePendingBindings();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialogChooseArtsFromMtbColrListAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
// create a new view
|
||||
DialogChooseArtsFromMtbColrListItemModelBinding viewDataBinding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.dialog_choose_arts_from_mtb_colr_list__item_model, parent, false);
|
||||
|
||||
return new ViewHolder(viewDataBinding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(DialogChooseArtsFromMtbColrListAdapter.ViewHolder holder, int position) {
|
||||
CheckableMtbColr item = mDataset.get(position);
|
||||
holder.bind(item);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(DialogChooseArtsFromMtbColrListAdapter.ViewHolder holder) {
|
||||
super.onViewRecycled(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDataset.size();
|
||||
}
|
||||
|
||||
public List<MtbColr> getSelectedItems() {
|
||||
return Stream.of(mDataset)
|
||||
.filter(y -> y.getChecked().get())
|
||||
.map(x -> x.getItem().getMtbColr()).toList();
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,7 +6,8 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
public class DialogChooseArtsFromMtbColrListItemModel {
|
||||
|
||||
private MtbColr mtbColr;
|
||||
private BindableBoolean hidden = new BindableBoolean(false);
|
||||
private final BindableBoolean checked = new BindableBoolean(false);
|
||||
private final BindableBoolean hidden = new BindableBoolean(false);
|
||||
|
||||
public MtbColr getMtbColr() {
|
||||
return mtbColr;
|
||||
@ -17,6 +18,10 @@ public class DialogChooseArtsFromMtbColrListItemModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BindableBoolean getChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
return hidden.get();
|
||||
}
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module(subcomponents = DialogChooseArtsFromMtbColrListComponent.class)
|
||||
public class DialogChooseArtsFromMtbColrListModule {
|
||||
@Provides
|
||||
DialogChooseArtsFromMtbColrListViewModel providesDialogChooseArtsFromMtbColrListViewModel() {
|
||||
return new DialogChooseArtsFromMtbColrListViewModel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list;
|
||||
|
||||
public class DialogChooseArtsFromMtbColrListViewModel {
|
||||
}
|
||||
@ -46,8 +46,7 @@
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
|
||||
@ -27,13 +27,13 @@
|
||||
android:text="@string/dialog_choose_arts_from_lista_art" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/description_text"
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="Description here" />
|
||||
<!-- <androidx.appcompat.widget.AppCompatTextView-->
|
||||
<!-- android:id="@+id/description_text"-->
|
||||
<!-- style="@style/TextAppearance.Material3.BodyMedium"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:gravity="center_horizontal"-->
|
||||
<!-- android:text="Description here" />-->
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
@ -41,7 +41,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/dialog_choose_art_from_lista_art__item_model"/>
|
||||
tools:listitem="@layout/dialog_choose_arts_from_mtb_aart_list__item_model"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
@ -1,143 +1,152 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<import type="it.integry.integrywmsnative.R" />
|
||||
|
||||
<import type="android.view.View" />
|
||||
|
||||
<import type="it.integry.integrywmsnative.core.utility.UtilityString" />
|
||||
|
||||
<import type="it.integry.integrywmsnative.core.utility.UtilityNumber" />
|
||||
|
||||
<variable
|
||||
name="checkableMtbColr"
|
||||
type="it.integry.integrywmsnative.core.model.CheckableMtbColr"/>
|
||||
name="item"
|
||||
type="it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListItemModel" />
|
||||
</data>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginHorizontal="4dp"
|
||||
android:layout_marginVertical="2dp"
|
||||
android:background="@drawable/bg_checked_layout"
|
||||
app:backgroundTintResID="@{checkableMtbColr.checked.get() ? R.color.bg_checked_layout : android.R.color.transparent}"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:onClick="@{() -> checkableMtbColr.toggleCheck()}">
|
||||
android:onClick="@{() -> item.checked.toggle()}"
|
||||
android:orientation="horizontal"
|
||||
android:padding="4dp"
|
||||
app:backgroundTintResID="@{item.checked.get() ? R.color.bg_checked_layout : android.R.color.transparent}">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox
|
||||
android:id="@+id/checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_centerVertical="true"
|
||||
app:checked="@{checkableMtbColr.checked}"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_toEndOf="@id/checkbox"
|
||||
android:layout_toStartOf="@id/qta_box">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{checkableMtbColr.item.mtbColr.mtbAart.getCodMart()}"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="COD MART" />
|
||||
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{UtilityNumber.decimalToString(checkableMtbColr.item.mtbColr.qtaCol) + checkableMtbColr.item.mtbColr.mtbAart.untMis}"
|
||||
android:visibility="@{checkableMtbColr.item.mtbColr.mtbAart != null && !checkableMtbColr.item.mtbColr.mtbAart.flagQtaCnfFissaBoolean ? View.VISIBLE : View.GONE}"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:background="@drawable/badge_round_corner"
|
||||
android:backgroundTint="@color/orange_600"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_alignParentEnd="true"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
tools:text="PESO KG" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{checkableMtbColr.item.mtbColr.mtbAart.getDiacod()}"
|
||||
android:textColor="@color/red_600"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="@{UtilityString.isNullOrEmpty(checkableMtbColr.item.mtbColr.mtbAart.diacod) ? View.GONE : View.VISIBLE}"
|
||||
tools:text="DIACOD" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:text="@{checkableMtbColr.item.mtbColr.mtbAart.descrizioneEstesa}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp"
|
||||
tools:text="Descrizione lunga articolo" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="0dp"
|
||||
app:checked="@{item.checked}" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toStartOf="@id/qta_box"
|
||||
android:layout_toEndOf="@id/checkbox"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/qta_box"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="12dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/qta_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/badge_round_corner"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@android:color/white"
|
||||
android:text="@{item.mtbColr.mtbAart.getCodMart()}"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textAllCaps="true"
|
||||
tools:text="280.45\nCONF" />
|
||||
tools:text="COD MART" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@drawable/badge_round_corner"
|
||||
android:backgroundTint="@color/orange_600"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:text="@{UtilityNumber.decimalToString(item.mtbColr.qtaCol) + item.mtbColr.mtbAart.untMis}"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="@{item.mtbColr.mtbAart != null && !item.mtbColr.mtbAart.flagQtaCnfFissaBoolean ? View.VISIBLE : View.GONE}"
|
||||
tools:text="PESO KG" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.mtbColr.mtbAart.getDiacod()}"
|
||||
android:textColor="@color/red_600"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="@{UtilityString.isNullOrEmpty(item.mtbColr.mtbAart.diacod) ? View.GONE : View.VISIBLE}"
|
||||
tools:text="DIACOD" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:text="@{item.mtbColr.mtbAart.descrizioneEstesa}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp"
|
||||
tools:text="Descrizione lunga articolo" />
|
||||
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/qta_box"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:padding="6dp"
|
||||
android:background="@drawable/badge_round_corner"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="@{item.mtbColr.qtaCol != null ? View.VISIBLE : View.GONE}">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:gravity="center"
|
||||
android:text="@{UtilityNumber.decimalToString(item.mtbColr.qtaCol, 2)}"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="280.45" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@{item.mtbColr.untMis}"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="CONF" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</layout>
|
||||
@ -14,158 +14,68 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
android:paddingVertical="16dp">
|
||||
|
||||
<RelativeLayout
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/buttons"
|
||||
android:layout_below="@id/title_container"
|
||||
android:paddingTop="8dp">
|
||||
android:layout_marginBottom="16dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/dialog_choose_arts_from_lista_art" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/empty_view"
|
||||
|
||||
<androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/main_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="end"
|
||||
android:iconifiedByDefault="true"
|
||||
android:tint="@android:color/black"
|
||||
app:defaultQueryHint="@string/search"
|
||||
app:iconifiedByDefault="false" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/empty_view"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:gravity="center"
|
||||
android:padding="16dp">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:gravity="center"
|
||||
android:padding="16dp">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/no_item_to_pick_text"
|
||||
android:textColor="@color/empty_view_gray"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/lista_arts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:listitem="@layout/dialog_choose_art_from_lista_art__item_model"/>
|
||||
android:text="@string/no_item_to_pick_text"
|
||||
android:textColor="@color/empty_view_gray"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/title_container"
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/lista_arts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:nestedScrollingEnabled="false"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:itemCount="4"
|
||||
tools:listitem="@layout/dialog_choose_arts_from_mtb_colr_list__item_model" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/dialog_choose_arts_from_lista_art" />
|
||||
|
||||
|
||||
<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
|
||||
android:id="@+id/buttons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/center_guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/negative_button"
|
||||
style="@style/Button.PrimaryOutline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:text="@string/abort"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/positive_button"
|
||||
style="@style/Button.PrimaryFull"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:text="@string/confirm"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user