Creata classe custom per confrontare la chiave dell'ordine
This commit is contained in:
parent
836a5c186b
commit
381c67196d
@ -79,7 +79,7 @@ public class MainListVenditaAdapterNew extends SectionedRecyclerViewAdapter<Main
|
||||
.forEach(x -> {
|
||||
|
||||
//if(!mCheckBoxes.containsKey(key)) {
|
||||
mCheckBoxes.put((OrdineListModel)x, false);
|
||||
mCheckBoxes.put(OrdineListModel.fromOrdine(x), false);
|
||||
//} else {
|
||||
//mCheckBoxes.get(key) = false;
|
||||
//}
|
||||
@ -141,7 +141,7 @@ public class MainListVenditaAdapterNew extends SectionedRecyclerViewAdapter<Main
|
||||
holder.binding.venditaMainListGroupItemContainerCheckBox.setChecked(mCheckBoxes.get(ordine));
|
||||
|
||||
holder.binding.venditaMainListGroupItemContainerCheckBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
mCheckBoxes.put((OrdineListModel) ordine, isChecked);
|
||||
mCheckBoxes.put(OrdineListModel.fromOrdine(ordine), isChecked);
|
||||
});
|
||||
}
|
||||
|
||||
@ -167,10 +167,54 @@ public class MainListVenditaAdapterNew extends SectionedRecyclerViewAdapter<Main
|
||||
}
|
||||
|
||||
|
||||
private static class OrdineListModel extends OrdineVenditaInevasoDTO {
|
||||
private static class OrdineListModel {
|
||||
private String data;
|
||||
private Integer numero;
|
||||
private String gestione;
|
||||
private String dataCons;
|
||||
|
||||
protected OrdineListModel(Parcel in) {
|
||||
super(in);
|
||||
public static OrdineListModel fromOrdine(OrdineVenditaInevasoDTO ordine) {
|
||||
return new OrdineListModel()
|
||||
.setData(ordine.getDataOrdS())
|
||||
.setDataCons(ordine.getDataConsS())
|
||||
.setGestione(ordine.getGestione())
|
||||
.setNumero(ordine.getNumOrd());
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public OrdineListModel setData(String data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumero() {
|
||||
return numero;
|
||||
}
|
||||
|
||||
public OrdineListModel setNumero(Integer numero) {
|
||||
this.numero = numero;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public OrdineListModel setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataCons() {
|
||||
return dataCons;
|
||||
}
|
||||
|
||||
public OrdineListModel setDataCons(String dataCons) {
|
||||
this.dataCons = dataCons;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -178,20 +222,20 @@ public class MainListVenditaAdapterNew extends SectionedRecyclerViewAdapter<Main
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
OrdineVenditaInevasoDTO that = (OrdineVenditaInevasoDTO) o;
|
||||
OrdineListModel that = (OrdineListModel) o;
|
||||
|
||||
if (!getDataOrdS().equals(that.getDataOrdS())) return false;
|
||||
if (!getNumOrd().equals(that.getNumOrd())) return false;
|
||||
if (!getData().equals(that.getData())) return false;
|
||||
if (!getNumero().equals(that.getNumero())) return false;
|
||||
if (!getGestione().equals(that.getGestione())) return false;
|
||||
return getDataConsS().equals(that.getDataConsS());
|
||||
return getDataCons() != null ? getDataCons().equals(that.getDataCons()) : that.getDataCons() == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = getDataOrdS().hashCode();
|
||||
result = 31 * result + getNumOrd().hashCode();
|
||||
int result = getData().hashCode();
|
||||
result = 31 * result + getNumero().hashCode();
|
||||
result = 31 * result + getGestione().hashCode();
|
||||
result = 31 * result + getDataConsS().hashCode();
|
||||
result = 31 * result + (getDataCons() != null ? getDataCons().hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user