vario
This commit is contained in:
@@ -17,7 +17,7 @@ public class MainApplication extends Application {
|
||||
super.onCreate();
|
||||
Stash.init(this);
|
||||
|
||||
SettingsManager.init();
|
||||
SettingsManager.init(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,11 @@ public class CommonConst {
|
||||
public static class Login {
|
||||
|
||||
public static class Azienda {
|
||||
public static String host = "192.168.2.13";
|
||||
public static int port = 8080;
|
||||
// public static String host = "192.168.2.13";
|
||||
// public static int port = 8080;
|
||||
|
||||
public static String host = "www2.studioml.it";
|
||||
public static int port = 80;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.util.Log;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.REST.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.REST.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.REST.model.EsitoType;
|
||||
import it.integry.integrywmsnative.core.REST.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@@ -56,4 +57,50 @@ public class SystemRESTConsumer {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void getAvailableCodMdeps(final ISimpleOperationCallback<List<AvailableCodMdepsDTO>> callback){
|
||||
|
||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.getAvailableCodMdeps().enqueue(new Callback<ServiceRESTResponse<List<AvailableCodMdepsDTO>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, Response<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
|
||||
if(response.body() != null) {
|
||||
if(response.body().getEsito() == EsitoType.OK) {
|
||||
callback.onSuccess(response.body().getDto());
|
||||
} else {
|
||||
Log.e("CodMdepsAvailable", response.body().getErrorMessage());
|
||||
callback.onFailed(new Exception(response.body().getErrorMessage()));
|
||||
}
|
||||
} else {
|
||||
Log.e("CodMdepsAvailable", response.message());
|
||||
callback.onFailed(new Exception(response.message()));
|
||||
}
|
||||
} else {
|
||||
Log.e("CodMdepsAvailable", "Status " + response.code() + ": " + response.message());
|
||||
callback.onFailed(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, final Throwable t) {
|
||||
|
||||
Log.e("CodMdepsAvailable", t.toString());
|
||||
callback.onFailed(new Exception(t));
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package it.integry.integrywmsnative.core.REST.consumers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.REST.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.REST.model.ServiceRESTResponse;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
@@ -13,4 +13,7 @@ public interface SystemRESTConsumerService {
|
||||
@GET("getAvailableProfiles")
|
||||
Call<ServiceRESTResponse<List<String>>> getAvailableProfiles(@Query("username") String username, @Query("password") String password);
|
||||
|
||||
@GET("getAvailableCodMdepsForUser")
|
||||
Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> getAvailableCodMdeps();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.core.REST.model;
|
||||
|
||||
public class AvailableCodMdepsDTO {
|
||||
|
||||
private String codMdep;
|
||||
private String descrizione;
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.di;
|
||||
|
||||
/**
|
||||
* Created by GiuseppeS on 06/03/2018.
|
||||
*/
|
||||
|
||||
public class AppComponent {
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package it.integry.integrywmsnative.core.di.binders;
|
||||
|
||||
import android.databinding.BindingAdapter;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RecyclerViewAdapterBinders {
|
||||
|
||||
|
||||
|
||||
// @BindingAdapter("app:adapter")
|
||||
// public static void setItems(RecyclerView recyclerView, Class clazz) {
|
||||
// setItems(recyclerView, null, clazz);
|
||||
// }
|
||||
//
|
||||
// @BindingAdapter("app:items")
|
||||
// public static <T> void setItems(RecyclerView recyclerView, ObservableArrayList<T> entries) {
|
||||
// setItems(recyclerView, entries, null);
|
||||
// }
|
||||
//
|
||||
// @BindingAdapter({"app:items", "app:adapter"})
|
||||
// public static <T> void setItems(RecyclerView recyclerView,
|
||||
// ObservableArrayList<T> entries, Class clazz) {
|
||||
//
|
||||
//// recyclerView.removeAllViews();
|
||||
//// if (entries != null) {
|
||||
//// LayoutInflater inflater = (LayoutInflater)
|
||||
//// viewGroup.getContext()
|
||||
//// .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
//// for (int i = 0; i < entries.size(); i++) {
|
||||
//// T entry = entries.get(i);
|
||||
//// ViewDataBinding binding = DataBindingUtil
|
||||
//// .inflate(inflater, layoutId, viewGroup, true);
|
||||
//// binding.setVariable(BR.data, entry);
|
||||
//// }
|
||||
//// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
package it.integry.integrywmsnative.core.di.binders.recyclerview;
|
||||
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.databinding.ObservableList;
|
||||
import android.databinding.ViewDataBinding;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Collection;
|
||||
|
||||
public class BindingRecyclerViewAdapter<T> extends RecyclerView.Adapter<BindingRecyclerViewAdapter.ViewHolder> implements View.OnClickListener, View.OnLongClickListener
|
||||
{
|
||||
private static final int ITEM_MODEL = -124;
|
||||
private final WeakReferenceOnListChangedCallback onListChangedCallback;
|
||||
private final ItemBinder<T> itemBinder;
|
||||
private ObservableList<T> items;
|
||||
private LayoutInflater inflater;
|
||||
private ClickHandler<T> clickHandler;
|
||||
private LongClickHandler<T> longClickHandler;
|
||||
|
||||
public BindingRecyclerViewAdapter(ItemBinder<T> itemBinder, @Nullable Collection<T> items)
|
||||
{
|
||||
this.itemBinder = itemBinder;
|
||||
this.onListChangedCallback = new WeakReferenceOnListChangedCallback<>(this);
|
||||
setItems(items);
|
||||
}
|
||||
|
||||
public ObservableList<T> getItems()
|
||||
{
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(@Nullable Collection<T> items)
|
||||
{
|
||||
if (this.items == items)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.items != null)
|
||||
{
|
||||
this.items.removeOnListChangedCallback(onListChangedCallback);
|
||||
notifyItemRangeRemoved(0, this.items.size());
|
||||
}
|
||||
|
||||
if (items instanceof ObservableList)
|
||||
{
|
||||
this.items = (ObservableList<T>) items;
|
||||
notifyItemRangeInserted(0, this.items.size());
|
||||
this.items.addOnListChangedCallback(onListChangedCallback);
|
||||
}
|
||||
else if (items != null)
|
||||
{
|
||||
this.items = new ObservableArrayList<>();
|
||||
this.items.addOnListChangedCallback(onListChangedCallback);
|
||||
this.items.addAll(items);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.items = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromRecyclerView(RecyclerView recyclerView)
|
||||
{
|
||||
if (items != null)
|
||||
{
|
||||
items.removeOnListChangedCallback(onListChangedCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int layoutId)
|
||||
{
|
||||
if (inflater == null)
|
||||
{
|
||||
inflater = LayoutInflater.from(viewGroup.getContext());
|
||||
}
|
||||
|
||||
ViewDataBinding binding = DataBindingUtil.inflate(inflater, layoutId, viewGroup, false);
|
||||
return new ViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder viewHolder, int position)
|
||||
{
|
||||
final T item = items.get(position);
|
||||
viewHolder.binding.setVariable(itemBinder.getBindingVariable(item), item);
|
||||
viewHolder.binding.getRoot().setTag(ITEM_MODEL, item);
|
||||
viewHolder.binding.getRoot().setOnClickListener(this);
|
||||
viewHolder.binding.getRoot().setOnLongClickListener(this);
|
||||
viewHolder.binding.executePendingBindings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position)
|
||||
{
|
||||
return itemBinder.getLayoutRes(items.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount()
|
||||
{
|
||||
return items == null ? 0 : items.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
if (clickHandler != null)
|
||||
{
|
||||
T item = (T) v.getTag(ITEM_MODEL);
|
||||
clickHandler.onClick(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v)
|
||||
{
|
||||
if (longClickHandler != null)
|
||||
{
|
||||
T item = (T) v.getTag(ITEM_MODEL);
|
||||
longClickHandler.onLongClick(item);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
final ViewDataBinding binding;
|
||||
|
||||
ViewHolder(ViewDataBinding binding)
|
||||
{
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
}
|
||||
|
||||
private static class WeakReferenceOnListChangedCallback<T> extends ObservableList.OnListChangedCallback
|
||||
{
|
||||
|
||||
private final WeakReference<BindingRecyclerViewAdapter<T>> adapterReference;
|
||||
|
||||
public WeakReferenceOnListChangedCallback(BindingRecyclerViewAdapter<T> bindingRecyclerViewAdapter)
|
||||
{
|
||||
this.adapterReference = new WeakReference<>(bindingRecyclerViewAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(ObservableList sender)
|
||||
{
|
||||
RecyclerView.Adapter adapter = adapterReference.get();
|
||||
if (adapter != null)
|
||||
{
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeChanged(ObservableList sender, int positionStart, int itemCount)
|
||||
{
|
||||
RecyclerView.Adapter adapter = adapterReference.get();
|
||||
if (adapter != null)
|
||||
{
|
||||
adapter.notifyItemRangeChanged(positionStart, itemCount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeInserted(ObservableList sender, int positionStart, int itemCount)
|
||||
{
|
||||
RecyclerView.Adapter adapter = adapterReference.get();
|
||||
if (adapter != null)
|
||||
{
|
||||
adapter.notifyItemRangeInserted(positionStart, itemCount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeMoved(ObservableList sender, int fromPosition, int toPosition, int itemCount)
|
||||
{
|
||||
RecyclerView.Adapter adapter = adapterReference.get();
|
||||
if (adapter != null)
|
||||
{
|
||||
adapter.notifyItemMoved(fromPosition, toPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeRemoved(ObservableList sender, int positionStart, int itemCount)
|
||||
{
|
||||
RecyclerView.Adapter adapter = adapterReference.get();
|
||||
if (adapter != null)
|
||||
{
|
||||
adapter.notifyItemRangeRemoved(positionStart, itemCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setClickHandler(ClickHandler<T> clickHandler)
|
||||
{
|
||||
this.clickHandler = clickHandler;
|
||||
}
|
||||
|
||||
public void setLongClickHandler(LongClickHandler<T> clickHandler)
|
||||
{
|
||||
this.longClickHandler = clickHandler;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.di.binders.recyclerview;
|
||||
|
||||
public interface ClickHandler<T>
|
||||
{
|
||||
void onClick(T viewModel);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.di.binders.recyclerview;
|
||||
|
||||
public interface ItemBinder<T>
|
||||
{
|
||||
int getLayoutRes(T model);
|
||||
int getBindingVariable(T model);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package it.integry.integrywmsnative.core.di.binders.recyclerview;
|
||||
|
||||
public class ItemBinderBase<T> implements ItemBinder<T>
|
||||
{
|
||||
protected final int bindingVariable;
|
||||
protected final int layoutId;
|
||||
|
||||
public ItemBinderBase(int bindingVariable, int layoutId)
|
||||
{
|
||||
this.bindingVariable = bindingVariable;
|
||||
this.layoutId = layoutId;
|
||||
}
|
||||
|
||||
public int getLayoutRes(T model)
|
||||
{
|
||||
return layoutId;
|
||||
}
|
||||
|
||||
public int getBindingVariable(T model)
|
||||
{
|
||||
return bindingVariable;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.di.binders.recyclerview;
|
||||
|
||||
public interface LongClickHandler<T>
|
||||
{
|
||||
void onLongClick(T viewModel);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package it.integry.integrywmsnative.core.di.binders.recyclerview;
|
||||
|
||||
import android.databinding.BindingAdapter;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class RecyclerViewBindings {
|
||||
|
||||
private static final int KEY_ITEMS = -123;
|
||||
private static final int KEY_CLICK_HANDLER = -124;
|
||||
private static final int KEY_LONG_CLICK_HANDLER = -125;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@BindingAdapter("items")
|
||||
public static <T> void setItems(RecyclerView recyclerView, Collection<T> items)
|
||||
{
|
||||
BindingRecyclerViewAdapter<T> adapter = (BindingRecyclerViewAdapter<T>) recyclerView.getAdapter();
|
||||
if (adapter != null)
|
||||
{
|
||||
adapter.setItems(items);
|
||||
}
|
||||
else
|
||||
{
|
||||
recyclerView.setTag(KEY_ITEMS, items);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@BindingAdapter("clickHandler")
|
||||
public static <T> void setHandler(RecyclerView recyclerView, ClickHandler<T> handler)
|
||||
{
|
||||
BindingRecyclerViewAdapter<T> adapter = (BindingRecyclerViewAdapter<T>) recyclerView.getAdapter();
|
||||
if (adapter != null)
|
||||
{
|
||||
adapter.setClickHandler(handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
recyclerView.setTag(KEY_CLICK_HANDLER, handler);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@BindingAdapter("longClickHandler")
|
||||
public static <T> void setHandler(RecyclerView recyclerView, LongClickHandler<T> handler)
|
||||
{
|
||||
BindingRecyclerViewAdapter<T> adapter = (BindingRecyclerViewAdapter<T>) recyclerView.getAdapter();
|
||||
if (adapter != null)
|
||||
{
|
||||
adapter.setLongClickHandler(handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
recyclerView.setTag(KEY_LONG_CLICK_HANDLER, handler);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@BindingAdapter("itemViewBinder")
|
||||
public static <T> void setItemViewBinder(RecyclerView recyclerView, ItemBinder<T> itemViewMapper)
|
||||
{
|
||||
Collection<T> items = (Collection<T>) recyclerView.getTag(KEY_ITEMS);
|
||||
ClickHandler<T> clickHandler = (ClickHandler<T>) recyclerView.getTag(KEY_CLICK_HANDLER);
|
||||
BindingRecyclerViewAdapter<T> adapter = new BindingRecyclerViewAdapter<>(itemViewMapper, items);
|
||||
if(clickHandler != null)
|
||||
{
|
||||
adapter.setClickHandler(clickHandler);
|
||||
}
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class MtbColr extends EntityBase{
|
||||
|
||||
|
||||
private Date dataCollo;
|
||||
private String gestione;
|
||||
private String serCollo;
|
||||
private Integer numCollo;
|
||||
private Integer riga;
|
||||
private Integer rigaOrd;
|
||||
private String codMart;
|
||||
private String codBarre;
|
||||
private String codCol;
|
||||
private String codTagl;
|
||||
private String partitaMag;
|
||||
private String gestioneRif;
|
||||
private String serColloRif;
|
||||
private String note;
|
||||
private Date dataOrd;
|
||||
private Date dataColloRif;
|
||||
private BigDecimal qtaCnf;
|
||||
private BigDecimal qtaCol;
|
||||
private Integer numOrd;
|
||||
private Integer numEtich;
|
||||
private Integer numColloRif;
|
||||
private Date datetimeRow;
|
||||
private String codJcom;
|
||||
private BigDecimal numCnf;
|
||||
private String insPartitaMag;
|
||||
private String mtbPartitaMag_descrizione;
|
||||
private Date dataScadPartita;
|
||||
private String descrizione;
|
||||
|
||||
|
||||
public MtbColr() {
|
||||
type = "mtb_colr";
|
||||
}
|
||||
|
||||
public Date getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public MtbColr setDataCollo(Date dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public MtbColr setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public MtbColr setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public MtbColr setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getRiga() {
|
||||
return riga;
|
||||
}
|
||||
|
||||
public MtbColr setRiga(Integer riga) {
|
||||
this.riga = riga;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getRigaOrd() {
|
||||
return rigaOrd;
|
||||
}
|
||||
|
||||
public MtbColr setRigaOrd(Integer rigaOrd) {
|
||||
this.rigaOrd = rigaOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public MtbColr setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodBarre() {
|
||||
return codBarre;
|
||||
}
|
||||
|
||||
public MtbColr setCodBarre(String codBarre) {
|
||||
this.codBarre = codBarre;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCol() {
|
||||
return codCol;
|
||||
}
|
||||
|
||||
public MtbColr setCodCol(String codCol) {
|
||||
this.codCol = codCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodTagl() {
|
||||
return codTagl;
|
||||
}
|
||||
|
||||
public MtbColr setCodTagl(String codTagl) {
|
||||
this.codTagl = codTagl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public MtbColr setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestioneRif() {
|
||||
return gestioneRif;
|
||||
}
|
||||
|
||||
public MtbColr setGestioneRif(String gestioneRif) {
|
||||
this.gestioneRif = gestioneRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerColloRif() {
|
||||
return serColloRif;
|
||||
}
|
||||
|
||||
public MtbColr setSerColloRif(String serColloRif) {
|
||||
this.serColloRif = serColloRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public MtbColr setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public MtbColr setDataOrd(Date dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataColloRif() {
|
||||
return dataColloRif;
|
||||
}
|
||||
|
||||
public MtbColr setDataColloRif(Date dataColloRif) {
|
||||
this.dataColloRif = dataColloRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public MtbColr setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCol() {
|
||||
return qtaCol;
|
||||
}
|
||||
|
||||
public MtbColr setQtaCol(BigDecimal qtaCol) {
|
||||
this.qtaCol = qtaCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
public MtbColr setNumOrd(Integer numOrd) {
|
||||
this.numOrd = numOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumEtich() {
|
||||
return numEtich;
|
||||
}
|
||||
|
||||
public MtbColr setNumEtich(Integer numEtich) {
|
||||
this.numEtich = numEtich;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumColloRif() {
|
||||
return numColloRif;
|
||||
}
|
||||
|
||||
public MtbColr setNumColloRif(Integer numColloRif) {
|
||||
this.numColloRif = numColloRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDatetimeRow() {
|
||||
return datetimeRow;
|
||||
}
|
||||
|
||||
public MtbColr setDatetimeRow(Date datetimeRow) {
|
||||
this.datetimeRow = datetimeRow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public MtbColr setCodJcom(String codJcom) {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public MtbColr setNumCnf(BigDecimal numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getInsPartitaMag() {
|
||||
return insPartitaMag;
|
||||
}
|
||||
|
||||
public MtbColr setInsPartitaMag(String insPartitaMag) {
|
||||
this.insPartitaMag = insPartitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMtbPartitaMag_descrizione() {
|
||||
return mtbPartitaMag_descrizione;
|
||||
}
|
||||
|
||||
public MtbColr setMtbPartitaMag_descrizione(String mtbPartitaMag_descrizione) {
|
||||
this.mtbPartitaMag_descrizione = mtbPartitaMag_descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataScadPartita() {
|
||||
return dataScadPartita;
|
||||
}
|
||||
|
||||
public MtbColr setDataScadPartita(Date dataScadPartita) {
|
||||
this.dataScadPartita = dataScadPartita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public MtbColr setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import android.databinding.ObservableArrayList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
|
||||
@@ -46,6 +49,17 @@ public class MtbColt extends EntityBase{
|
||||
private BigDecimal larghezzaCm;
|
||||
private BigDecimal altezzaCm;
|
||||
|
||||
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
||||
|
||||
public ObservableArrayList<MtbColr> getMtbColr() {
|
||||
return mtbColr;
|
||||
}
|
||||
|
||||
public MtbColt setMtbColr(ObservableArrayList<MtbColr> mtbColr) {
|
||||
this.mtbColr = mtbColr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColt(){
|
||||
type = "mtb_colt";
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ package it.integry.integrywmsnative.core.settings;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.REST.model.AvailableCodMdepsDTO;
|
||||
|
||||
public class DBSettingsModel {
|
||||
|
||||
private List<String> availableProfiles = null;
|
||||
private List<String> availableCodMdep = null;
|
||||
private List<AvailableCodMdepsDTO> availableCodMdep = null;
|
||||
|
||||
public List<String> getAvailableProfiles() {
|
||||
return availableProfiles;
|
||||
@@ -15,11 +17,11 @@ public class DBSettingsModel {
|
||||
this.availableProfiles = availableProfiles;
|
||||
}
|
||||
|
||||
public List<String> getAvailableCodMdep() {
|
||||
public List<AvailableCodMdepsDTO> getAvailableCodMdep() {
|
||||
return availableCodMdep;
|
||||
}
|
||||
|
||||
public void setAvailableCodMdep(List<String> availableCodMdep) {
|
||||
public void setAvailableCodMdep(List<AvailableCodMdepsDTO> availableCodMdep) {
|
||||
this.availableCodMdep = availableCodMdep;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package it.integry.integrywmsnative.core.settings;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.REST.model.AvailableCodMdepsDTO;
|
||||
|
||||
public class SettingsManager {
|
||||
|
||||
@@ -14,7 +18,11 @@ public class SettingsManager {
|
||||
|
||||
private static boolean firstStart = false;
|
||||
|
||||
public static void init(){
|
||||
private static Context mContext;
|
||||
|
||||
public static void init(Context context){
|
||||
mContext = context;
|
||||
|
||||
settingsModelIstance = (SettingsModel) Stash.getObject(TAG, SettingsModel.class);
|
||||
|
||||
if(settingsModelIstance == null) {
|
||||
@@ -48,13 +56,62 @@ public class SettingsManager {
|
||||
Stash.put(TAG, settingsModelIstance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void reloadDBVariables(final ISimpleOperationCallback callback){
|
||||
dbSettingsModelIstance = new DBSettingsModel();
|
||||
|
||||
loadAvailableProfiles(callback);
|
||||
}
|
||||
|
||||
private static void loadAvailableProfiles(final ISimpleOperationCallback callback){
|
||||
SystemRESTConsumer.getAvailableProfiles(new ISimpleOperationCallback<List<String>>() {
|
||||
@Override
|
||||
public void onSuccess(List<String> availableProfiles) {
|
||||
dbSettingsModelIstance.setAvailableProfiles(availableProfiles);
|
||||
|
||||
loadAvailableCodMdeps(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
//BOH
|
||||
if(callback != null) callback.onFailed(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void loadAvailableCodMdeps(final ISimpleOperationCallback callback) {
|
||||
SystemRESTConsumer.getAvailableCodMdeps(new ISimpleOperationCallback<List<AvailableCodMdepsDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(List<AvailableCodMdepsDTO> availableCodMdeps) {
|
||||
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
||||
|
||||
if(availableCodMdeps == null || availableCodMdeps.size() == 0) {
|
||||
callback.onFailed(new Exception(mContext.getText(R.string.no_codmdep_available).toString()));
|
||||
return;
|
||||
}
|
||||
|
||||
boolean codMdepExistsAnymore = false;
|
||||
|
||||
if(settingsModelIstance.userSession.codMdep != null && !settingsModelIstance.userSession.codMdep.isEmpty()){
|
||||
for(AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps){
|
||||
//Controllo se il codMdep salvato esiste ancora
|
||||
if(availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.userSession.codMdep)) {
|
||||
codMdepExistsAnymore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!codMdepExistsAnymore){
|
||||
settingsModelIstance.userSession.codMdep = availableCodMdeps.get(0).getCodMdep();
|
||||
}
|
||||
|
||||
if(callback != null) callback.onSuccess(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.app.Fragment;
|
||||
@@ -29,6 +30,7 @@ import it.integry.integrywmsnative.core.REST.CommonRESTException;
|
||||
import it.integry.integrywmsnative.core.coollection.Coollection;
|
||||
import it.integry.integrywmsnative.core.interfaces.ICheckBoxCallback;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainAccettazioneBinding;
|
||||
import it.integry.integrywmsnative.gest.accettazione.core.AccettazioneHelper;
|
||||
import it.integry.integrywmsnative.gest.accettazione.core.MainListAccettazioneAdapter;
|
||||
import it.integry.integrywmsnative.gest.accettazione.core.interfaces.ILoadOrdiniCallback;
|
||||
@@ -42,17 +44,14 @@ import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||
|
||||
public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallback, SearchView.OnQueryTextListener, ITitledFragment {
|
||||
|
||||
|
||||
@BindView(R.id.accettazione_main_fab) FloatingActionButton mFab;
|
||||
|
||||
@BindView(R.id.accettazione_main_list) RecyclerView mRecyclerView;
|
||||
|
||||
private MainListAccettazioneAdapter mAdapter;
|
||||
private RecyclerView.LayoutManager mLayoutManager;
|
||||
|
||||
private FragmentMainAccettazioneBinding mBinding;
|
||||
|
||||
private AccettazioneHelper helper;
|
||||
|
||||
private List<OrdineAccettazioneGroupedInevasoDTO> groupedOrdiniInevasi;
|
||||
private MainListAccettazioneAdapter mAdapter;
|
||||
|
||||
|
||||
|
||||
|
||||
public MainAccettazioneFragment() {
|
||||
@@ -79,6 +78,7 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
||||
// mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -86,24 +86,22 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View layout = inflater.inflate(R.layout.fragment_main_accettazione, container, false);
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_main_accettazione, container, false);
|
||||
|
||||
ButterKnife.bind(this, layout);
|
||||
mBinding.setView(this);
|
||||
mBinding.accettazioneMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
mBinding.accettazioneMainFab.hide();
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
ButterKnife.bind(this, mBinding.getRoot());
|
||||
|
||||
mLayoutManager = new LinearLayoutManager(getActivity());
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
|
||||
mFab.hide();
|
||||
|
||||
return layout;
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void init(){
|
||||
|
||||
final ProgressDialog progress = ProgressDialog.show(getActivity(), getText(R.string.waiting),
|
||||
getText(R.string.loading) + " ...", true);
|
||||
|
||||
@@ -113,7 +111,7 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
||||
@Override
|
||||
public void onLoadSuccess(List<OrdineAccettazioneInevasoDTO> ordini) {
|
||||
Toast.makeText(getActivity(), "Caricati " + ordini.size() + " ordini", Toast.LENGTH_LONG).show();
|
||||
groupOrdini(ordini);
|
||||
groupOrdiniAndMakeRecycler(ordini);
|
||||
progress.dismiss();
|
||||
}
|
||||
|
||||
@@ -131,7 +129,7 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
||||
}
|
||||
|
||||
|
||||
private void groupOrdini(List<OrdineAccettazioneInevasoDTO> ordini){
|
||||
private void groupOrdiniAndMakeRecycler(List<OrdineAccettazioneInevasoDTO> ordini){
|
||||
|
||||
String prevCodAnag = "";
|
||||
|
||||
@@ -212,6 +210,7 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
||||
cliente.descrCom = filteredByCodAnagAndDateAndNumberOrders.get(k).descrizioneCom;
|
||||
cliente.dataCons = filteredByCodAnagAndDateAndNumberOrders.get(k).dataCons;
|
||||
cliente.numCnf = filteredByCodAnagAndDateAndNumberOrders.get(k).numCnf;
|
||||
cliente.rifOrd = filteredByCodAnagAndDateAndNumberOrders.get(k).rifOrd;
|
||||
|
||||
rigaOrdine.clienti.add(cliente);
|
||||
}
|
||||
@@ -223,9 +222,10 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
||||
groupedOrdiniInevasi.add(groupedOrdine);
|
||||
}
|
||||
|
||||
|
||||
mAdapter = new MainListAccettazioneAdapter(getActivity(), groupedOrdiniInevasi, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
// mAdapter.setHasStableIds(true);
|
||||
mBinding.accettazioneMainList.setAdapter(mAdapter);
|
||||
//mRecyclerView.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
@OnClick(R.id.accettazione_main_fab)
|
||||
@@ -292,8 +292,8 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
||||
|
||||
@Override
|
||||
public void onToggle(boolean newValue) {
|
||||
if(helper.getSelectedOrders(groupedOrdiniInevasi).size() > 0) mFab.show();
|
||||
else mFab.hide();
|
||||
if(helper.getSelectedOrders(groupedOrdiniInevasi).size() > 0) mBinding.accettazioneMainFab.show();
|
||||
else mBinding.accettazioneMainFab.hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
|
||||
// each data item is just a string in this case
|
||||
private TextView mTextViewGroupHeader;
|
||||
private LinearLayout mLinearLayoutGroupItemContainer;
|
||||
|
||||
private List<View> views = new ArrayList<>();
|
||||
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
}
|
||||
@@ -52,14 +55,12 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
|
||||
View v = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.accettazione_main_list_model, parent, false);
|
||||
|
||||
v.setHasTransientState(true);
|
||||
|
||||
ViewHolder vh = new ViewHolder(v);
|
||||
|
||||
TextView groupHeader = (TextView) v.findViewById(R.id.accettazione_main_list_group_header);
|
||||
TextView groupHeader = v.findViewById(R.id.accettazione_main_list_group_header);
|
||||
vh.mTextViewGroupHeader = groupHeader;
|
||||
|
||||
LinearLayout groupItemContainer = (LinearLayout) v.findViewById(R.id.accettazione_main_list_group_item_container);
|
||||
LinearLayout groupItemContainer = v.findViewById(R.id.accettazione_main_list_group_item_container);
|
||||
vh.mLinearLayoutGroupItemContainer = groupItemContainer;
|
||||
|
||||
return vh;
|
||||
@@ -91,17 +92,31 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
for(int i = 0; i < subGroup.size(); i++){
|
||||
for (int i = 0; i < subGroup.size(); i++) {
|
||||
final OrdineAccettazioneGroupedInevasoDTO.Ordine ordine = subGroup.get(i);
|
||||
View groupModelView = LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.accettazione_main_list_group_model, holder.mLinearLayoutGroupItemContainer, false);
|
||||
|
||||
if(i % 2 == 1){
|
||||
//if(i == 0) {
|
||||
ordine.checkBoxCallback = new ArrayList<>();
|
||||
//}
|
||||
|
||||
boolean isCreatedNew = false;
|
||||
|
||||
if(holder.views.size() <= i){
|
||||
holder.views.add(LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.accettazione_main_list_group_model, holder.mLinearLayoutGroupItemContainer, false));
|
||||
isCreatedNew = true;
|
||||
}
|
||||
|
||||
|
||||
View groupModelView = holder.views.get(i);
|
||||
|
||||
groupModelView.setVisibility(View.VISIBLE);
|
||||
|
||||
if (i % 2 == 1) {
|
||||
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
||||
}
|
||||
|
||||
final CheckBox checkBox = (CheckBox) groupModelView.findViewById(R.id.accettazione_main_list_group_item_container_checkBox);
|
||||
final CheckBox checkBox = groupModelView.findViewById(R.id.accettazione_main_list_group_item_container_checkBox);
|
||||
checkBox.setChecked(ordine.checkBox);
|
||||
|
||||
ordine.checkBoxCallback.add(new ICheckBoxCallback() {
|
||||
@@ -120,24 +135,27 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
|
||||
}
|
||||
});
|
||||
|
||||
TextView testataOrdTextView = (TextView) groupModelView.findViewById(R.id.accettazione_main_list_group_item_container_testata_ord);
|
||||
TextView testataOrdTextView = groupModelView.findViewById(R.id.accettazione_main_list_group_item_container_testata_ord);
|
||||
String testataOrdString = String.format(mContext.getString(R.string.ord_acq_testata), String.valueOf(ordine.numero), UtilityDate.formatDate(ordine.getData(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||
testataOrdTextView.setText(Html.fromHtml(testataOrdString));
|
||||
|
||||
LinearLayout clientLinearLayout = (LinearLayout) groupModelView.findViewById(R.id.accettazione_main_list_group_item_container_clienti_ord) ;
|
||||
LinearLayout clientLinearLayout = groupModelView.findViewById(R.id.accettazione_main_list_group_item_container_clienti_ord);
|
||||
List<OrdineAccettazioneGroupedInevasoDTO.Cliente> subGroupClienti = ordine.clienti;
|
||||
|
||||
for(int k = 0; k < subGroupClienti.size(); k++){
|
||||
clientLinearLayout.removeAllViews();
|
||||
|
||||
for (int k = 0; k < subGroupClienti.size(); k++) {
|
||||
View groupClienteModelView = LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.accettazione_main_list_group_clienti, clientLinearLayout, false);
|
||||
|
||||
TextView clienteComm = (TextView) groupClienteModelView.findViewById(R.id.accettazione_main_list_group_clienti_comm);
|
||||
TextView clienteComm = groupClienteModelView.findViewById(R.id.accettazione_main_list_group_clienti_comm);
|
||||
String clienteText;
|
||||
clienteText = subGroupClienti.get(k).codJcom + " - " + subGroupClienti.get(k).descrCom;
|
||||
// clienteText = subGroupClienti.get(k).codJcom + " - " + subGroupClienti.get(k).descrCom;
|
||||
clienteText = subGroupClienti.get(k).rifOrd;
|
||||
clienteComm.setText(clienteText);
|
||||
|
||||
TextView dataCons = (TextView) groupClienteModelView.findViewById(R.id.accettazione_main_list_group_clienti_datacons);
|
||||
if(subGroupClienti.get(k).getDataCons() != null) {
|
||||
TextView dataCons = groupClienteModelView.findViewById(R.id.accettazione_main_list_group_clienti_datacons);
|
||||
if (subGroupClienti.get(k).getDataCons() != null) {
|
||||
dataCons.setText(UtilityDate.formatDate(subGroupClienti.get(k).getDataCons(), UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH));
|
||||
} else {
|
||||
dataCons.setText("");
|
||||
@@ -146,7 +164,13 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
|
||||
clientLinearLayout.addView(groupClienteModelView);
|
||||
}
|
||||
|
||||
holder.mLinearLayoutGroupItemContainer.addView(groupModelView);
|
||||
if(isCreatedNew) {
|
||||
holder.mLinearLayoutGroupItemContainer.addView(groupModelView);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = subGroup.size(); i < holder.views.size(); i++){
|
||||
holder.views.get(i).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ public class OrdineAccettazioneGroupedInevasoDTO implements Cloneable, Serializa
|
||||
public String dataCons;
|
||||
public Integer numCnf;
|
||||
public String descrCom;
|
||||
public String rifOrd;
|
||||
|
||||
public Date getDataCons(){
|
||||
try {
|
||||
@@ -147,6 +148,7 @@ public class OrdineAccettazioneGroupedInevasoDTO implements Cloneable, Serializa
|
||||
dataCons = in.readString();
|
||||
numCnf = in.readByte() == 0x00 ? null : in.readInt();
|
||||
descrCom = in.readString();
|
||||
rifOrd = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,6 +169,7 @@ public class OrdineAccettazioneGroupedInevasoDTO implements Cloneable, Serializa
|
||||
dest.writeInt(numCnf);
|
||||
}
|
||||
dest.writeString(descrCom);
|
||||
dest.writeString(rifOrd);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -6,6 +6,7 @@ import it.integry.integrywmsnative.core.REST.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
@@ -15,10 +16,10 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface OrdiniAccettazioneRESTConsumerService {
|
||||
|
||||
@POST("SM2GetOrdiniAccettazioneInevasi")
|
||||
@GET("SM2GetOrdiniAccettazioneInevasi")
|
||||
Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> listOrdiniInevasi();
|
||||
|
||||
@POST("WMSGetPickingListAccettazione")
|
||||
@GET("WMSGetPickingListAccettazione")
|
||||
Call<ServiceRESTResponse<List<OrdineAccettazioneDTO>>> pickingListAccettazione(@Query("codBarreBancale") String codBarreBacale);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,103 +1,44 @@
|
||||
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.support.design.widget.BottomSheetBehavior;
|
||||
import android.support.design.widget.BottomSheetDialog;
|
||||
import android.support.v4.widget.NestedScrollView;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.SpannableString;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.clans.fab.FloatingActionButton;
|
||||
import com.github.clans.fab.FloatingActionMenu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.REST.CommonRESTException;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
|
||||
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsModel;
|
||||
import it.integry.integrywmsnative.databinding.ActivityAccettazioneOrdineInevasoBinding;
|
||||
import it.integry.integrywmsnative.databinding.FragmentArticoliInColloBottomSheetBinding;
|
||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.AccettazioneOrdineInevasoHelper;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.MainListOrdineAccettazioneAdapter;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.AccettazioneOrdineInevasoOrderBy;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.views.NoteAggiuntiveNuovaULDialog;
|
||||
import it.integry.integrywmsnative.view.ArticoliInColloBottomSheetHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.viewmodel.AccettazioneOrdineInevasoViewModel;
|
||||
import it.integry.integrywmsnative.view.bottomsheet.viewmodel.ArticoliInColloBottomSheetViewModel;
|
||||
|
||||
public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
|
||||
@BindView(R.id.toolbar) Toolbar toolbar;
|
||||
public ActivityAccettazioneOrdineInevasoBinding bindings;
|
||||
private AccettazioneOrdineInevasoViewModel mAccettazioneOrdineInevasoViewModel;
|
||||
|
||||
@BindView(R.id.accettazione_ordine_main_list) RecyclerView mRecyclerView;
|
||||
|
||||
@BindView(R.id.accettazione_ordine_inevaso_fab) FloatingActionMenu fab;
|
||||
@BindView(R.id.accettazione_ordine_inevaso_fab_item1) FloatingActionButton fabItem1;
|
||||
@BindView(R.id.accettazione_ordine_inevaso_fab_item2) FloatingActionButton fabItem2;
|
||||
|
||||
@BindView(R.id.bottom_sheet1) View layoutBottomSheet;
|
||||
|
||||
|
||||
private MainListOrdineAccettazioneAdapter mAdapter;
|
||||
private RecyclerView.LayoutManager mLayoutManager;
|
||||
|
||||
private List<List<OrdineAccettazioneDTO.Riga>> groupedRighe;
|
||||
private List<OrdineAccettazioneDTO.Riga> groupedOrdini;
|
||||
|
||||
private AccettazioneOrdineInevasoHelper helper;
|
||||
|
||||
private AccettazioneOrdineInevasoOrderBy.Enum currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.COD_ART_FOR;
|
||||
|
||||
|
||||
private Context mContext = this;
|
||||
private ArticoliInColloBottomSheetHelper mArticoliInColloBottomSheetHelper;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_accettazione_ordine_inevaso);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
bindings = DataBindingUtil.setContentView(this, R.layout.activity_accettazione_ordine_inevaso);
|
||||
FragmentArticoliInColloBottomSheetBinding bindings = this.bindings.bottomSheetInclude;
|
||||
ArticoliInColloBottomSheetViewModel mArticoliInColloBottomSheetViewModel = new ArticoliInColloBottomSheetViewModel(this, bindings);
|
||||
|
||||
List<OrdineAccettazioneDTO> orders = (ArrayList<OrdineAccettazioneDTO>)getIntent().getSerializableExtra("key");
|
||||
mAccettazioneOrdineInevasoViewModel = new AccettazioneOrdineInevasoViewModel(
|
||||
this, mArticoliInColloBottomSheetViewModel, orders);
|
||||
|
||||
setSupportActionBar(this.bindings.toolbar);
|
||||
|
||||
setTitle(orders);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
groupedOrdini = new ArrayList<>();
|
||||
for (OrdineAccettazioneDTO ordine : orders){
|
||||
groupedOrdini.addAll(ordine.ordini);
|
||||
}
|
||||
|
||||
helper = new AccettazioneOrdineInevasoHelper(this);
|
||||
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini);
|
||||
|
||||
initRecyclerView(groupedRighe);
|
||||
|
||||
initBottomDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,7 +59,7 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
// Handle item selection
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_filter:
|
||||
this.showOrderDialog();
|
||||
mAccettazioneOrdineInevasoViewModel.showOrderDialog();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
@@ -138,126 +79,6 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void initRecyclerView(List<List<OrdineAccettazioneDTO.Riga>> groupedRighe){
|
||||
//RecyclerView setup
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
|
||||
try {
|
||||
mAdapter = helper.getRightListAdapter(AccettazioneOrdineInevasoOrderBy.Enum.COD_ART_FOR, groupedRighe);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(this, new SpannableString(e.toString()), null, null).show();
|
||||
}
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
private void initBottomDialog(){
|
||||
|
||||
mArticoliInColloBottomSheetHelper = new ArticoliInColloBottomSheetHelper(this, layoutBottomSheet);
|
||||
}
|
||||
|
||||
|
||||
private void showOrderDialog() {
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(this)
|
||||
.setTitle(AccettazioneOrdineInevasoActivity.this.getText(R.string.action_orderBy))
|
||||
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, currentOrderBy.getVal(), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which);
|
||||
}
|
||||
})
|
||||
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
refreshOrderBy();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void refreshOrderBy(){
|
||||
switch (currentOrderBy){
|
||||
case COD_ART_FOR:
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini);
|
||||
break;
|
||||
case DESCR_ART:
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerDescrArt(groupedOrdini);
|
||||
break;
|
||||
|
||||
case RAG_SOC_COM:
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerRagSocCommessa(groupedOrdini);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
mAdapter.updateDataset(helper.getRightListViewModel(currentOrderBy, groupedRighe));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(this, e.getMessage().toString(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Al click di "Crea nuova UL"
|
||||
@OnClick(R.id.accettazione_ordine_inevaso_fab_item2)
|
||||
public void onItem2Click(View view) {
|
||||
|
||||
fab.close(true);
|
||||
|
||||
NoteAggiuntiveNuovaULDialog.show(this, new NoteAggiuntiveNuovaULDialog.Callback() {
|
||||
@Override
|
||||
public void onSuccess(String noteString) {
|
||||
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt .setDataCollo(new Date())
|
||||
.setGestione(GestioneEnum.ACQUISTO)
|
||||
.setCodMdep(SettingsManager.i().userSession.codMdep)
|
||||
.setPreparatoDa(SettingsManager.i().user.username)
|
||||
.setOraInizPrep(new Date())
|
||||
.setAnnotazioni(noteString)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
|
||||
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveCollo(mtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
mArticoliInColloBottomSheetHelper.initCollo(value);
|
||||
DialogSimpleMessageHelper.makeInfoDialog(mContext, "Creazione UL",new SpannableString("Salvataggio collo avvenuto con successo"), null, null).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||
|
||||
if(errorMessage == null) errorMessage = ex.getMessage();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(mContext, new SpannableString(errorMessage), null, null).show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Al click di "Mostra UL già create"
|
||||
@OnClick(R.id.accettazione_ordine_inevaso_fab_item1)
|
||||
public void onItem1Click(View view) {
|
||||
|
||||
fab.close(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SyncRequest;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.util.Log;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@@ -27,52 +28,34 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private ObservableArrayList<AccettazioneOrdineInevasoListViewModel> mListViewModels = new ObservableArrayList<>();
|
||||
|
||||
public AccettazioneOrdineInevasoHelper(Context context){
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public MainListOrdineAccettazioneAdapter getRightListAdapter(AccettazioneOrdineInevasoOrderBy.Enum orderByEnum, List<List<OrdineAccettazioneDTO.Riga>> mDataset) throws Exception {
|
||||
|
||||
List<AccettazioneOrdineInevasoListViewModel> listViewModels = null;
|
||||
|
||||
switch (orderByEnum){
|
||||
case COD_ART_FOR:
|
||||
case DESCR_ART:
|
||||
listViewModels = getListViewModelPerArtForn(mDataset);
|
||||
break;
|
||||
|
||||
case RAG_SOC_COM:
|
||||
listViewModels = getListViewModelPerRagSocCommessa(mDataset);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Cannot find right list adapter: " + orderByEnum.toString());
|
||||
}
|
||||
|
||||
return new MainListOrdineAccettazioneAdapter(mContext, listViewModels);
|
||||
|
||||
public MainListOrdineAccettazioneAdapter getRightListAdapter() {
|
||||
return new MainListOrdineAccettazioneAdapter(mContext, mListViewModels);
|
||||
}
|
||||
|
||||
public List<AccettazioneOrdineInevasoListViewModel> getRightListViewModel(AccettazioneOrdineInevasoOrderBy.Enum orderByEnum, List<List<OrdineAccettazioneDTO.Riga>> mDataset) throws Exception {
|
||||
public void updateListModel(AccettazioneOrdineInevasoOrderBy.Enum orderByEnum, List<List<OrdineAccettazioneDTO.Riga>> mDataset) throws Exception {
|
||||
|
||||
List<AccettazioneOrdineInevasoListViewModel> listViewModels = null;
|
||||
mListViewModels.clear();
|
||||
|
||||
switch (orderByEnum){
|
||||
case COD_ART_FOR:
|
||||
case DESCR_ART:
|
||||
listViewModels = getListViewModelPerArtForn(mDataset);
|
||||
mListViewModels.addAll(getListViewModelPerArtForn(mDataset));
|
||||
break;
|
||||
|
||||
case RAG_SOC_COM:
|
||||
listViewModels = getListViewModelPerRagSocCommessa(mDataset);
|
||||
mListViewModels.addAll(getListViewModelPerRagSocCommessa(mDataset));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Cannot find right list adapter: " + orderByEnum.toString());
|
||||
}
|
||||
|
||||
return listViewModels;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -149,16 +132,22 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
|
||||
|
||||
private class RaggruppaPerCommessaUtilDTO {
|
||||
public String codJcom;
|
||||
public String ragSocCom;
|
||||
public String codJcom = "";
|
||||
public String ragSocCom = "";
|
||||
}
|
||||
|
||||
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerRagSocCommessa(List<OrdineAccettazioneDTO.Riga> mDataset) {
|
||||
List<RaggruppaPerCommessaUtilDTO> commessaList = new ArrayList<>();
|
||||
|
||||
commessaList.add(new RaggruppaPerCommessaUtilDTO());
|
||||
|
||||
for(int i = 0; i < mDataset.size(); i++){
|
||||
boolean alreadyExists = false;
|
||||
|
||||
if(mDataset.get(i).codJcom == null) mDataset.get(i).codJcom = "N/A";
|
||||
if(mDataset.get(i).ragSocCom == null) mDataset.get(i).ragSocCom = mContext.getText(R.string.stock).toString().toUpperCase();
|
||||
|
||||
|
||||
for(int k = 0; k < commessaList.size(); k++){
|
||||
if(commessaList.get(k).codJcom.equalsIgnoreCase(mDataset.get(i).codJcom)){
|
||||
alreadyExists = true;
|
||||
@@ -208,11 +197,6 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
|
||||
}
|
||||
|
||||
//Raggruppo tutti quelli per il magazzino e li aggiungo alla fine
|
||||
|
||||
List<OrdineAccettazioneDTO.Riga> tmpList = Coollection.from(mDataset)
|
||||
.where("ragSocCom", Coollection.eqIgnoreCase("MAG")).all();
|
||||
|
||||
return groupedRighe;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core;
|
||||
|
||||
import android.content.Context;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.databinding.ObservableList;
|
||||
import android.graphics.Color;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -24,7 +26,7 @@ import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.Accettaz
|
||||
public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<MainListOrdineAccettazioneAdapter.ViewHolder> {
|
||||
|
||||
protected Context mContext;
|
||||
protected List<AccettazioneOrdineInevasoListViewModel> mDataset;
|
||||
protected ObservableArrayList<AccettazioneOrdineInevasoListViewModel> mDataset;
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
// each data item is just a string in this case
|
||||
@@ -35,15 +37,39 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
||||
}
|
||||
}
|
||||
|
||||
public MainListOrdineAccettazioneAdapter(Context context, List<AccettazioneOrdineInevasoListViewModel> myDataset) {
|
||||
public MainListOrdineAccettazioneAdapter(Context context, ObservableArrayList<AccettazioneOrdineInevasoListViewModel> myDataset) {
|
||||
mContext = context;
|
||||
mDataset = myDataset;
|
||||
|
||||
myDataset.addOnListChangedCallback(onListChangedCallback);
|
||||
}
|
||||
|
||||
public void updateDataset(List<AccettazioneOrdineInevasoListViewModel> myDataset){
|
||||
mDataset = myDataset;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
private ObservableList.OnListChangedCallback onListChangedCallback = new ObservableList.OnListChangedCallback<ObservableList<AccettazioneOrdineInevasoListViewModel>>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<AccettazioneOrdineInevasoListViewModel> sender) {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeChanged(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int positionStart, int itemCount) {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeInserted(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int positionStart, int itemCount) {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeMoved(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int fromPosition, int toPosition, int itemCount) {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeRemoved(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int positionStart, int itemCount) {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
@@ -56,10 +82,10 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
||||
|
||||
ViewHolder vh = new ViewHolder(v);
|
||||
|
||||
TextView descrizioneArtForn = (TextView) v.findViewById(R.id.accettazione_ordine_inevaso_main_list_descrArtFor);
|
||||
TextView descrizioneArtForn = v.findViewById(R.id.accettazione_ordine_inevaso_main_list_descrArtFor);
|
||||
vh.mGroupTitle = descrizioneArtForn;
|
||||
|
||||
LinearLayout groupItemContainer = (LinearLayout) v.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_container);
|
||||
LinearLayout groupItemContainer = v.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_container);
|
||||
vh.mLinearLayoutGroupItemContainer = groupItemContainer;
|
||||
|
||||
return vh;
|
||||
@@ -85,17 +111,19 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
||||
|
||||
if(i % 2 == 1){
|
||||
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
||||
} else {
|
||||
groupModelView.setBackgroundColor(Color.WHITE);
|
||||
}
|
||||
|
||||
|
||||
final TextView badge1 = (TextView) groupModelView.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_badge1);
|
||||
final TextView badge1 = groupModelView.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_badge1);
|
||||
badge1.setText(rowItem.badge1);
|
||||
|
||||
final TextView badge2 = (TextView) groupModelView.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_badge2);
|
||||
final TextView badge2 = groupModelView.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_badge2);
|
||||
badge2.setText(rowItem.badge2);
|
||||
|
||||
|
||||
final TextView descrizione = (TextView) groupModelView.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_descrizione);
|
||||
final TextView descrizione = groupModelView.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_descrizione);
|
||||
|
||||
String descrizioneString = rowItem.descrizione;
|
||||
int descrizioneColor = Color.BLACK;
|
||||
@@ -110,10 +138,10 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
||||
descrizione.setText(descrizioneString);
|
||||
descrizione.setTextColor(descrizioneColor);
|
||||
|
||||
final TextView qtaEvasa = (TextView) groupModelView.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_qta_evasa);
|
||||
final TextView qtaEvasa = groupModelView.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_qta_evasa);
|
||||
qtaEvasa.setText(rowItem.qtaRiservata);
|
||||
|
||||
final TextView qtaTot = (TextView) groupModelView.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_qta_tot);
|
||||
final TextView qtaTot = groupModelView.findViewById(R.id.accettazione_ordine_inevaso_main_list_group_item_qta_tot);
|
||||
qtaTot.setText(rowItem.qtaOrdinata);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.viewmodel;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.databinding.ObservableField;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.text.SpannableString;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.BR;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.REST.CommonRESTException;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.AccettazioneOrdineInevasoActivity;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.AccettazioneOrdineInevasoHelper;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.MainListOrdineAccettazioneAdapter;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.AccettazioneOrdineInevasoOrderBy;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.views.NoteAggiuntiveNuovaULDialog;
|
||||
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnColloClosedCallback;
|
||||
import it.integry.integrywmsnative.view.bottomsheet.viewmodel.ArticoliInColloBottomSheetViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||
|
||||
public class AccettazioneOrdineInevasoViewModel implements IOnColloClosedCallback {
|
||||
|
||||
public ObservableField<Boolean> isFabVisible = new ObservableField<>();
|
||||
|
||||
private final AccettazioneOrdineInevasoActivity mActivity;
|
||||
private final ArticoliInColloBottomSheetViewModel mArticoliInColloBottomSheetViewModel;
|
||||
private final List<OrdineAccettazioneDTO> mOrders;
|
||||
|
||||
private List<List<OrdineAccettazioneDTO.Riga>> groupedRighe;
|
||||
private List<OrdineAccettazioneDTO.Riga> groupedOrdini;
|
||||
|
||||
private AccettazioneOrdineInevasoHelper helper;
|
||||
|
||||
private AccettazioneOrdineInevasoOrderBy.Enum currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.COD_ART_FOR;
|
||||
private MainListOrdineAccettazioneAdapter mAdapter;
|
||||
|
||||
public AccettazioneOrdineInevasoViewModel(AccettazioneOrdineInevasoActivity activity, ArticoliInColloBottomSheetViewModel articoliInColloBottomSheetViewModel, List<OrdineAccettazioneDTO> orders) {
|
||||
this.mActivity = activity;
|
||||
this.mArticoliInColloBottomSheetViewModel = articoliInColloBottomSheetViewModel;
|
||||
this.mOrders = orders;
|
||||
|
||||
this.isFabVisible.set(true);
|
||||
|
||||
this.mActivity.bindings.setVariable(BR.viewmodel, this);
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
|
||||
private void init(){
|
||||
mArticoliInColloBottomSheetViewModel.setOnCloseColloCallbackListener(this);
|
||||
|
||||
groupedOrdini = new ArrayList<>();
|
||||
for (OrdineAccettazioneDTO ordine : mOrders){
|
||||
groupedOrdini.addAll(ordine.ordini);
|
||||
}
|
||||
|
||||
helper = new AccettazioneOrdineInevasoHelper(mActivity);
|
||||
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini);
|
||||
|
||||
initRecyclerView(groupedRighe);
|
||||
}
|
||||
|
||||
|
||||
private void initRecyclerView(List<List<OrdineAccettazioneDTO.Riga>> groupedRighe){
|
||||
//RecyclerView setup
|
||||
mActivity.bindings.accettazioneOrdineMainList.setHasFixedSize(true);
|
||||
|
||||
mActivity.bindings.accettazioneOrdineMainList.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||
|
||||
try {
|
||||
mAdapter = helper.getRightListAdapter();
|
||||
helper.updateListModel(AccettazioneOrdineInevasoOrderBy.Enum.COD_ART_FOR, groupedRighe);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(mActivity, new SpannableString(e.toString()), null, null).show();
|
||||
}
|
||||
mActivity.bindings.accettazioneOrdineMainList.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
private void refreshOrderBy(){
|
||||
switch (currentOrderBy){
|
||||
case COD_ART_FOR:
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini);
|
||||
break;
|
||||
case DESCR_ART:
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerDescrArt(groupedOrdini);
|
||||
break;
|
||||
|
||||
case RAG_SOC_COM:
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerRagSocCommessa(groupedOrdini);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
helper.updateListModel(currentOrderBy, groupedRighe);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(mActivity, e.getMessage().toString(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
public void showOrderDialog() {
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(mActivity)
|
||||
.setTitle(mActivity.getText(R.string.action_orderBy))
|
||||
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, currentOrderBy.getVal(), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which);
|
||||
}
|
||||
})
|
||||
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
refreshOrderBy();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
public void createNewUL() {
|
||||
|
||||
mActivity.bindings.accettazioneOrdineInevasoFab.close(true);
|
||||
|
||||
NoteAggiuntiveNuovaULDialog.show(mActivity, new NoteAggiuntiveNuovaULDialog.Callback() {
|
||||
@Override
|
||||
public void onSuccess(String noteString) {
|
||||
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt .setDataCollo(new Date())
|
||||
.setGestione(GestioneEnum.ACQUISTO)
|
||||
.setCodMdep(SettingsManager.i().userSession.codMdep)
|
||||
.setPreparatoDa(SettingsManager.i().user.username)
|
||||
.setOraInizPrep(new Date())
|
||||
.setAnnotazioni(noteString)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
|
||||
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveCollo(mtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
// mArticoliInColloBottomSheetHelper.initCollo(value);
|
||||
value.setMtbColr(new ObservableArrayList<MtbColr>());
|
||||
|
||||
|
||||
mArticoliInColloBottomSheetViewModel.mtbColt.set(value);
|
||||
|
||||
|
||||
for(int i = 0; i < 10; i++){
|
||||
value.getMtbColr().add(new MtbColr().setCodMart("ABCICCIO").setDescrizione("DESCRCICCIO"));
|
||||
}
|
||||
|
||||
|
||||
DialogSimpleMessageHelper.makeInfoDialog(mActivity, "Creazione UL",new SpannableString("Salvataggio collo avvenuto con successo"), null, null).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||
|
||||
if(errorMessage == null) errorMessage = ex.getMessage();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(mActivity, new SpannableString(errorMessage), null, null).show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Al click di "Mostra UL già create"
|
||||
public void showCreatedUL() {
|
||||
mActivity.bindings.accettazioneOrdineInevasoFab.close(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onColloClosed() {
|
||||
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
ActivityLoginBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_login);
|
||||
LoginViewModel loginViewModel = new LoginViewModel(this);
|
||||
binding.setVariable(BR.loginViewModel, loginViewModel);
|
||||
binding.setLoginViewModel(loginViewModel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ public class LoginViewModel {
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
onLoginFailed(Html.fromHtml(String.format(mActivity.getText(R.string.server_cod_azienda_not_valid).toString(), codAzienda)));
|
||||
onLoginFailed(Html.fromHtml(String.format(mActivity.getText(R.string.server_cod_azienda_not_valid).toString(), codAzienda.get())));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -160,7 +160,7 @@ public class LoginViewModel {
|
||||
|
||||
private void onLoginFailed(final Spanned message){
|
||||
mProgress.dismiss();
|
||||
loginButtonEnabled.set(false);
|
||||
loginButtonEnabled.set(true);
|
||||
mActivity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.integry.integrywmsnative.view;
|
||||
package it.integry.integrywmsnative.view.bottomsheet;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
@@ -19,19 +19,15 @@ import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.databinding.FragmentArticoliInColloBottomSheetBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||
|
||||
|
||||
public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.BottomSheetCallback {
|
||||
|
||||
private AppCompatActivity mActivity;
|
||||
private FragmentArticoliInColloBottomSheetBinding mBinding;
|
||||
|
||||
@BindView(R.id.articoli_in_collo_sheet_button) AppCompatButton mSheetButtonToggle;
|
||||
@BindView(R.id.articoli_in_collo_close_collo) AppCompatButton mCloseULButton;
|
||||
@BindView(R.id.articoli_in_collo_title) AppCompatTextView mTitleTextView;
|
||||
@BindView(R.id.articoli_in_collo_details_date) AppCompatTextView mDetailDateTextView;
|
||||
@BindView(R.id.articoli_in_collo_details_posizione) AppCompatTextView mDetailPosizioneTextView;
|
||||
@BindView(R.id.articoli_in_collo_details_preparatoDa) AppCompatTextView mDetailPreparatoDaTextView;
|
||||
|
||||
@BindView(R.id.appbar_bottom_sheet) AppBarLayout appBarLayoutBottomSheet;
|
||||
@BindView(R.id.toolbar_bottom_sheet) Toolbar toolbarBottomSheet;
|
||||
@@ -39,14 +35,14 @@ public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.Bottom
|
||||
@BindView(R.id.tap_action_layout) RelativeLayout tapActionLayout;
|
||||
private BottomSheetBehavior mBottomSheetBehavior;
|
||||
|
||||
private MtbColt mMtbColt;
|
||||
|
||||
public ArticoliInColloBottomSheetHelper(AppCompatActivity context, View rootView){
|
||||
public ArticoliInColloBottomSheetHelper(AppCompatActivity context, FragmentArticoliInColloBottomSheetBinding binding){
|
||||
mActivity = context;
|
||||
mBinding = binding;
|
||||
|
||||
ButterKnife.bind(this, rootView);
|
||||
ButterKnife.bind(this, mBinding.getRoot());
|
||||
|
||||
mBottomSheetBehavior = BottomSheetBehavior.from(rootView);
|
||||
mBottomSheetBehavior = BottomSheetBehavior.from(mBinding.getRoot());
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
mBottomSheetBehavior.setBottomSheetCallback(this);
|
||||
|
||||
@@ -70,31 +66,29 @@ public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.Bottom
|
||||
});
|
||||
|
||||
|
||||
mCloseULButton.setText(mActivity.getText(R.string.action_close_ul) + " ");
|
||||
mBinding.articoliInColloCloseCollo.setText(mActivity.getText(R.string.action_close_ul) + " ");
|
||||
updateRigheNumber(0);
|
||||
|
||||
}
|
||||
|
||||
public void initCollo(MtbColt mtbColt){
|
||||
this.mMtbColt = mtbColt;
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy");
|
||||
|
||||
mTitleTextView.setText(String.format(mActivity.getText(R.string.articoli_in_collo_sheet_title).toString(), mtbColt.getNumCollo()));
|
||||
mBinding.articoliInColloTitle.setText(String.format(mActivity.getText(R.string.articoli_in_collo_sheet_title).toString(), mtbColt.getNumCollo()));
|
||||
try {
|
||||
mDetailDateTextView.setText(sdf.format(mtbColt.getDataColloD()));
|
||||
mBinding.articoliInColloDetailsDate.setText(sdf.format(mtbColt.getDataColloD()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(mActivity, new SpannableString(e.toString()), null, null).show();
|
||||
}
|
||||
|
||||
mDetailPosizioneTextView.setText(mtbColt.getPosizione() != null ? mtbColt.getPosizione() : "N/A");
|
||||
mDetailPreparatoDaTextView.setText(mtbColt.getPreparatoDa() != null ? mtbColt.getPreparatoDa() : "N/A");
|
||||
mBinding.articoliInColloDetailsPosizione.setText(mtbColt.getPosizione() != null ? mtbColt.getPosizione() : "N/A");
|
||||
// bindings.articoliInColloDetailsPreparatoDa.setText(mtbColt.getPreparatoDa() != null ? mtbColt.getPreparatoDa() : "N/A");
|
||||
|
||||
}
|
||||
|
||||
public void updateRigheNumber(int newRigheNumber){
|
||||
mSheetButtonToggle.setText(" " + newRigheNumber + " " + mActivity.getResources().getQuantityString(R.plurals.articles, newRigheNumber));
|
||||
mBinding.articoliInColloSheetButton.setText(" " + newRigheNumber + " " + mActivity.getResources().getQuantityString(R.plurals.articles, newRigheNumber));
|
||||
}
|
||||
|
||||
@OnClick(R.id.articoli_in_collo_sheet_button)
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.view.bottomsheet.interfaces;
|
||||
|
||||
public interface IOnColloClosedCallback {
|
||||
|
||||
void onColloClosed();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package it.integry.integrywmsnative.view.bottomsheet.viewmodel;
|
||||
|
||||
import android.content.Context;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.databinding.Observable;
|
||||
import android.databinding.ObservableField;
|
||||
import android.databinding.ObservableList;
|
||||
import android.databinding.ViewDataBinding;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import it.integry.integrywmsnative.BR;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.databinding.FragmentArticoliInColloBottomSheetBinding;
|
||||
import it.integry.integrywmsnative.view.bottomsheet.ArticoliInColloBottomSheetHelper;
|
||||
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnColloClosedCallback;
|
||||
|
||||
public class ArticoliInColloBottomSheetViewModel {
|
||||
|
||||
public ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
||||
|
||||
private Context mContext;
|
||||
private ArticoliInColloBottomSheetHelper mArticoliInColloBottomSheetHelper;
|
||||
|
||||
private IOnColloClosedCallback onCloseColloCallback;
|
||||
|
||||
|
||||
public ArticoliInColloBottomSheetViewModel(AppCompatActivity context, final FragmentArticoliInColloBottomSheetBinding mBindings){
|
||||
mContext = context;
|
||||
mArticoliInColloBottomSheetHelper = new ArticoliInColloBottomSheetHelper(context, mBindings);
|
||||
|
||||
mBindings.setViewModel(this);
|
||||
|
||||
mtbColt.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@Override
|
||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||
mBindings.linearListview.setAdapter(new ArticoliInColloBottomSheetMtbColrAdapter());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void setOnCloseColloCallbackListener(final IOnColloClosedCallback onCloseColloCallback){
|
||||
this.onCloseColloCallback = onCloseColloCallback;
|
||||
}
|
||||
|
||||
|
||||
public void closeCurrentUL(){
|
||||
if(onCloseColloCallback != null) onCloseColloCallback.onColloClosed();
|
||||
}
|
||||
|
||||
|
||||
public class ArticoliInColloBottomSheetMtbColrAdapter extends BaseAdapter {
|
||||
|
||||
|
||||
private final WeakReferenceOnListChangedCallback onListChangedCallback;
|
||||
|
||||
public ArticoliInColloBottomSheetMtbColrAdapter() {
|
||||
super();
|
||||
this.onListChangedCallback = new WeakReferenceOnListChangedCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||
|
||||
ViewDataBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_articoli_in_collo_bottom_sheet__mtbcolr_item, parent, false);
|
||||
|
||||
final MtbColr item = mtbColt.get().getMtbColr().get(position);
|
||||
binding.setVariable(BR.mtbColr, item);
|
||||
// viewHolder.binding.getRoot().setTag(ITEM_MODEL, item);
|
||||
// viewHolder.binding.getRoot().setOnClickListener(this);
|
||||
binding.executePendingBindings();
|
||||
|
||||
if(position % 2 == 1) binding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
if(mtbColt.get() != null && mtbColt.get().getMtbColr() != null) {
|
||||
mtbColt.get().getMtbColr().addOnListChangedCallback(onListChangedCallback);
|
||||
return mtbColt.get().getMtbColr().size();
|
||||
} else return 0;
|
||||
}
|
||||
|
||||
|
||||
public class WeakReferenceOnListChangedCallback extends ObservableList.OnListChangedCallback {
|
||||
|
||||
private final WeakReference<BaseAdapter> adapterReference;
|
||||
|
||||
public WeakReferenceOnListChangedCallback(BaseAdapter baseAdapter) {
|
||||
this.adapterReference = new WeakReference<>(baseAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(ObservableList sender) {
|
||||
BaseAdapter adapter = adapterReference.get();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeChanged(ObservableList sender, int positionStart, int itemCount) {
|
||||
BaseAdapter adapter = adapterReference.get();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeInserted(ObservableList sender, int positionStart, int itemCount) {
|
||||
BaseAdapter adapter = adapterReference.get();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeMoved(ObservableList sender, int fromPosition, int toPosition, int itemCount) {
|
||||
BaseAdapter adapter = adapterReference.get();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeRemoved(ObservableList sender, int positionStart, int itemCount) {
|
||||
BaseAdapter adapter = adapterReference.get();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class DialogSimpleMessageHelper {
|
||||
switch (type){
|
||||
case INFO:
|
||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.colorPrimary);
|
||||
titleIconRes = mContext.getResources().getDrawable(R.drawable.ic_info_24dp);
|
||||
titleIconRes = mContext.getResources().getDrawable(R.drawable.ic_info_78dp);
|
||||
break;
|
||||
|
||||
case SUCCESS:
|
||||
|
||||
Reference in New Issue
Block a user