vario
This commit is contained in:
parent
5ada26ace0
commit
5bcbfaf206
6
.idea/assetWizardSettings.xml
generated
6
.idea/assetWizardSettings.xml
generated
@ -18,7 +18,7 @@
|
|||||||
<PersistentState>
|
<PersistentState>
|
||||||
<option name="values">
|
<option name="values">
|
||||||
<map>
|
<map>
|
||||||
<entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/action/ic_exit_to_app_black_24dp.xml" />
|
<entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/action/ic_info_black_24dp.xml" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
</PersistentState>
|
</PersistentState>
|
||||||
@ -29,9 +29,11 @@
|
|||||||
<option name="values">
|
<option name="values">
|
||||||
<map>
|
<map>
|
||||||
<entry key="color" value="ffffff" />
|
<entry key="color" value="ffffff" />
|
||||||
<entry key="outputName" value="ic_logout_24dp" />
|
<entry key="height" value="78" />
|
||||||
|
<entry key="outputName" value="ic_info_78dp" />
|
||||||
<entry key="overrideSize" value="true" />
|
<entry key="overrideSize" value="true" />
|
||||||
<entry key="sourceFile" value="C:\Users\GiuseppeS" />
|
<entry key="sourceFile" value="C:\Users\GiuseppeS" />
|
||||||
|
<entry key="width" value="78" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
</PersistentState>
|
</PersistentState>
|
||||||
|
|||||||
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@ -10,6 +10,7 @@
|
|||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
<option value="$PROJECT_DIR$/pointmobilescannerlibrary" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
|
|||||||
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@ -4,6 +4,7 @@
|
|||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/IntegryWMSNative.iml" filepath="$PROJECT_DIR$/IntegryWMSNative.iml" />
|
<module fileurl="file://$PROJECT_DIR$/IntegryWMSNative.iml" filepath="$PROJECT_DIR$/IntegryWMSNative.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/pointmobilescannerlibrary/pointmobilescannerlibrary.iml" filepath="$PROJECT_DIR$/pointmobilescannerlibrary/pointmobilescannerlibrary.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@ -32,7 +32,7 @@ dependencies {
|
|||||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
implementation 'com.android.support:support-v4:27.1.1'
|
implementation 'com.android.support:support-v4:27.1.1'
|
||||||
implementation 'com.android.support:design:27.1.1'
|
implementation 'com.android.support:design:27.1.1'
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
||||||
implementation 'com.android.support:cardview-v7:27.1.1'
|
implementation 'com.android.support:cardview-v7:27.1.1'
|
||||||
implementation 'com.android.support:recyclerview-v7:27.1.1'
|
implementation 'com.android.support:recyclerview-v7:27.1.1'
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ dependencies {
|
|||||||
implementation 'com.fxn769:stash:1.2'
|
implementation 'com.fxn769:stash:1.2'
|
||||||
|
|
||||||
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
|
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
|
||||||
|
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
|
||||||
|
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
|
|||||||
@ -17,7 +17,7 @@ public class MainApplication extends Application {
|
|||||||
super.onCreate();
|
super.onCreate();
|
||||||
Stash.init(this);
|
Stash.init(this);
|
||||||
|
|
||||||
SettingsManager.init();
|
SettingsManager.init(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,11 @@ public class CommonConst {
|
|||||||
public static class Login {
|
public static class Login {
|
||||||
|
|
||||||
public static class Azienda {
|
public static class Azienda {
|
||||||
public static String host = "192.168.2.13";
|
// public static String host = "192.168.2.13";
|
||||||
public static int port = 8080;
|
// 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 java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.REST.RESTBuilder;
|
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.EsitoType;
|
||||||
import it.integry.integrywmsnative.core.REST.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.REST.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
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 java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.REST.model.AvailableCodMdepsDTO;
|
||||||
import it.integry.integrywmsnative.core.REST.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.REST.model.ServiceRESTResponse;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
@ -13,4 +13,7 @@ public interface SystemRESTConsumerService {
|
|||||||
@GET("getAvailableProfiles")
|
@GET("getAvailableProfiles")
|
||||||
Call<ServiceRESTResponse<List<String>>> getAvailableProfiles(@Query("username") String username, @Query("password") String password);
|
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;
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
|
import android.databinding.ObservableArrayList;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
|
|
||||||
@ -46,6 +49,17 @@ public class MtbColt extends EntityBase{
|
|||||||
private BigDecimal larghezzaCm;
|
private BigDecimal larghezzaCm;
|
||||||
private BigDecimal altezzaCm;
|
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(){
|
public MtbColt(){
|
||||||
type = "mtb_colt";
|
type = "mtb_colt";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,10 +2,12 @@ package it.integry.integrywmsnative.core.settings;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.REST.model.AvailableCodMdepsDTO;
|
||||||
|
|
||||||
public class DBSettingsModel {
|
public class DBSettingsModel {
|
||||||
|
|
||||||
private List<String> availableProfiles = null;
|
private List<String> availableProfiles = null;
|
||||||
private List<String> availableCodMdep = null;
|
private List<AvailableCodMdepsDTO> availableCodMdep = null;
|
||||||
|
|
||||||
public List<String> getAvailableProfiles() {
|
public List<String> getAvailableProfiles() {
|
||||||
return availableProfiles;
|
return availableProfiles;
|
||||||
@ -15,11 +17,11 @@ public class DBSettingsModel {
|
|||||||
this.availableProfiles = availableProfiles;
|
this.availableProfiles = availableProfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getAvailableCodMdep() {
|
public List<AvailableCodMdepsDTO> getAvailableCodMdep() {
|
||||||
return availableCodMdep;
|
return availableCodMdep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAvailableCodMdep(List<String> availableCodMdep) {
|
public void setAvailableCodMdep(List<AvailableCodMdepsDTO> availableCodMdep) {
|
||||||
this.availableCodMdep = availableCodMdep;
|
this.availableCodMdep = availableCodMdep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
package it.integry.integrywmsnative.core.settings;
|
package it.integry.integrywmsnative.core.settings;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
|
import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
|
||||||
import it.integry.integrywmsnative.core.REST.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.REST.consumers.SystemRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.REST.model.AvailableCodMdepsDTO;
|
||||||
|
|
||||||
public class SettingsManager {
|
public class SettingsManager {
|
||||||
|
|
||||||
@ -14,7 +18,11 @@ public class SettingsManager {
|
|||||||
|
|
||||||
private static boolean firstStart = false;
|
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);
|
settingsModelIstance = (SettingsModel) Stash.getObject(TAG, SettingsModel.class);
|
||||||
|
|
||||||
if(settingsModelIstance == null) {
|
if(settingsModelIstance == null) {
|
||||||
@ -48,13 +56,62 @@ public class SettingsManager {
|
|||||||
Stash.put(TAG, settingsModelIstance);
|
Stash.put(TAG, settingsModelIstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void reloadDBVariables(final ISimpleOperationCallback callback){
|
public static void reloadDBVariables(final ISimpleOperationCallback callback){
|
||||||
dbSettingsModelIstance = new DBSettingsModel();
|
dbSettingsModelIstance = new DBSettingsModel();
|
||||||
|
|
||||||
|
loadAvailableProfiles(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void loadAvailableProfiles(final ISimpleOperationCallback callback){
|
||||||
SystemRESTConsumer.getAvailableProfiles(new ISimpleOperationCallback<List<String>>() {
|
SystemRESTConsumer.getAvailableProfiles(new ISimpleOperationCallback<List<String>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<String> availableProfiles) {
|
public void onSuccess(List<String> availableProfiles) {
|
||||||
dbSettingsModelIstance.setAvailableProfiles(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);
|
if(callback != null) callback.onSuccess(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import android.app.ProgressDialog;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.databinding.DataBindingUtil;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.app.Fragment;
|
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.coollection.Coollection;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ICheckBoxCallback;
|
import it.integry.integrywmsnative.core.interfaces.ICheckBoxCallback;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
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.AccettazioneHelper;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.core.MainListAccettazioneAdapter;
|
import it.integry.integrywmsnative.gest.accettazione.core.MainListAccettazioneAdapter;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.core.interfaces.ILoadOrdiniCallback;
|
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 {
|
public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallback, SearchView.OnQueryTextListener, ITitledFragment {
|
||||||
|
|
||||||
|
private FragmentMainAccettazioneBinding mBinding;
|
||||||
@BindView(R.id.accettazione_main_fab) FloatingActionButton mFab;
|
|
||||||
|
|
||||||
@BindView(R.id.accettazione_main_list) RecyclerView mRecyclerView;
|
|
||||||
|
|
||||||
private MainListAccettazioneAdapter mAdapter;
|
|
||||||
private RecyclerView.LayoutManager mLayoutManager;
|
|
||||||
|
|
||||||
|
|
||||||
private AccettazioneHelper helper;
|
private AccettazioneHelper helper;
|
||||||
|
|
||||||
private List<OrdineAccettazioneGroupedInevasoDTO> groupedOrdiniInevasi;
|
private List<OrdineAccettazioneGroupedInevasoDTO> groupedOrdiniInevasi;
|
||||||
|
private MainListAccettazioneAdapter mAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MainAccettazioneFragment() {
|
public MainAccettazioneFragment() {
|
||||||
@ -79,6 +78,7 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
|||||||
// mParam2 = getArguments().getString(ARG_PARAM2);
|
// mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,24 +86,22 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
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());
|
return mBinding.getRoot();
|
||||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
|
||||||
|
|
||||||
mFab.hide();
|
|
||||||
|
|
||||||
return layout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void init(){
|
private void init(){
|
||||||
|
|
||||||
final ProgressDialog progress = ProgressDialog.show(getActivity(), getText(R.string.waiting),
|
final ProgressDialog progress = ProgressDialog.show(getActivity(), getText(R.string.waiting),
|
||||||
getText(R.string.loading) + " ...", true);
|
getText(R.string.loading) + " ...", true);
|
||||||
|
|
||||||
@ -113,7 +111,7 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
|||||||
@Override
|
@Override
|
||||||
public void onLoadSuccess(List<OrdineAccettazioneInevasoDTO> ordini) {
|
public void onLoadSuccess(List<OrdineAccettazioneInevasoDTO> ordini) {
|
||||||
Toast.makeText(getActivity(), "Caricati " + ordini.size() + " ordini", Toast.LENGTH_LONG).show();
|
Toast.makeText(getActivity(), "Caricati " + ordini.size() + " ordini", Toast.LENGTH_LONG).show();
|
||||||
groupOrdini(ordini);
|
groupOrdiniAndMakeRecycler(ordini);
|
||||||
progress.dismiss();
|
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 = "";
|
String prevCodAnag = "";
|
||||||
|
|
||||||
@ -212,6 +210,7 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
|||||||
cliente.descrCom = filteredByCodAnagAndDateAndNumberOrders.get(k).descrizioneCom;
|
cliente.descrCom = filteredByCodAnagAndDateAndNumberOrders.get(k).descrizioneCom;
|
||||||
cliente.dataCons = filteredByCodAnagAndDateAndNumberOrders.get(k).dataCons;
|
cliente.dataCons = filteredByCodAnagAndDateAndNumberOrders.get(k).dataCons;
|
||||||
cliente.numCnf = filteredByCodAnagAndDateAndNumberOrders.get(k).numCnf;
|
cliente.numCnf = filteredByCodAnagAndDateAndNumberOrders.get(k).numCnf;
|
||||||
|
cliente.rifOrd = filteredByCodAnagAndDateAndNumberOrders.get(k).rifOrd;
|
||||||
|
|
||||||
rigaOrdine.clienti.add(cliente);
|
rigaOrdine.clienti.add(cliente);
|
||||||
}
|
}
|
||||||
@ -223,9 +222,10 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
|||||||
groupedOrdiniInevasi.add(groupedOrdine);
|
groupedOrdiniInevasi.add(groupedOrdine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mAdapter = new MainListAccettazioneAdapter(getActivity(), groupedOrdiniInevasi, this);
|
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)
|
@OnClick(R.id.accettazione_main_fab)
|
||||||
@ -292,8 +292,8 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onToggle(boolean newValue) {
|
public void onToggle(boolean newValue) {
|
||||||
if(helper.getSelectedOrders(groupedOrdiniInevasi).size() > 0) mFab.show();
|
if(helper.getSelectedOrders(groupedOrdiniInevasi).size() > 0) mBinding.accettazioneMainFab.show();
|
||||||
else mFab.hide();
|
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
|
// each data item is just a string in this case
|
||||||
private TextView mTextViewGroupHeader;
|
private TextView mTextViewGroupHeader;
|
||||||
private LinearLayout mLinearLayoutGroupItemContainer;
|
private LinearLayout mLinearLayoutGroupItemContainer;
|
||||||
|
|
||||||
|
private List<View> views = new ArrayList<>();
|
||||||
|
|
||||||
public ViewHolder(View v) {
|
public ViewHolder(View v) {
|
||||||
super(v);
|
super(v);
|
||||||
}
|
}
|
||||||
@ -52,14 +55,12 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
|
|||||||
View v = LayoutInflater.from(parent.getContext())
|
View v = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(R.layout.accettazione_main_list_model, parent, false);
|
.inflate(R.layout.accettazione_main_list_model, parent, false);
|
||||||
|
|
||||||
v.setHasTransientState(true);
|
|
||||||
|
|
||||||
ViewHolder vh = new ViewHolder(v);
|
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;
|
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;
|
vh.mLinearLayoutGroupItemContainer = groupItemContainer;
|
||||||
|
|
||||||
return vh;
|
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);
|
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 == 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) {
|
if (i % 2 == 1) {
|
||||||
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
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);
|
checkBox.setChecked(ordine.checkBox);
|
||||||
|
|
||||||
ordine.checkBoxCallback.add(new ICheckBoxCallback() {
|
ordine.checkBoxCallback.add(new ICheckBoxCallback() {
|
||||||
@ -120,23 +135,26 @@ 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));
|
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));
|
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;
|
List<OrdineAccettazioneGroupedInevasoDTO.Cliente> subGroupClienti = ordine.clienti;
|
||||||
|
|
||||||
|
clientLinearLayout.removeAllViews();
|
||||||
|
|
||||||
for (int k = 0; k < subGroupClienti.size(); k++) {
|
for (int k = 0; k < subGroupClienti.size(); k++) {
|
||||||
View groupClienteModelView = LayoutInflater.from(mContext)
|
View groupClienteModelView = LayoutInflater.from(mContext)
|
||||||
.inflate(R.layout.accettazione_main_list_group_clienti, clientLinearLayout, false);
|
.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;
|
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);
|
clienteComm.setText(clienteText);
|
||||||
|
|
||||||
TextView dataCons = (TextView) groupClienteModelView.findViewById(R.id.accettazione_main_list_group_clienti_datacons);
|
TextView dataCons = groupClienteModelView.findViewById(R.id.accettazione_main_list_group_clienti_datacons);
|
||||||
if (subGroupClienti.get(k).getDataCons() != null) {
|
if (subGroupClienti.get(k).getDataCons() != null) {
|
||||||
dataCons.setText(UtilityDate.formatDate(subGroupClienti.get(k).getDataCons(), UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH));
|
dataCons.setText(UtilityDate.formatDate(subGroupClienti.get(k).getDataCons(), UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH));
|
||||||
} else {
|
} else {
|
||||||
@ -146,8 +164,14 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
|
|||||||
clientLinearLayout.addView(groupClienteModelView);
|
clientLinearLayout.addView(groupClienteModelView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isCreatedNew) {
|
||||||
holder.mLinearLayoutGroupItemContainer.addView(groupModelView);
|
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 String dataCons;
|
||||||
public Integer numCnf;
|
public Integer numCnf;
|
||||||
public String descrCom;
|
public String descrCom;
|
||||||
|
public String rifOrd;
|
||||||
|
|
||||||
public Date getDataCons(){
|
public Date getDataCons(){
|
||||||
try {
|
try {
|
||||||
@ -147,6 +148,7 @@ public class OrdineAccettazioneGroupedInevasoDTO implements Cloneable, Serializa
|
|||||||
dataCons = in.readString();
|
dataCons = in.readString();
|
||||||
numCnf = in.readByte() == 0x00 ? null : in.readInt();
|
numCnf = in.readByte() == 0x00 ? null : in.readInt();
|
||||||
descrCom = in.readString();
|
descrCom = in.readString();
|
||||||
|
rifOrd = in.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -167,6 +169,7 @@ public class OrdineAccettazioneGroupedInevasoDTO implements Cloneable, Serializa
|
|||||||
dest.writeInt(numCnf);
|
dest.writeInt(numCnf);
|
||||||
}
|
}
|
||||||
dest.writeString(descrCom);
|
dest.writeString(descrCom);
|
||||||
|
dest.writeString(rifOrd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@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.OrdineAccettazioneDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.POST;
|
import retrofit2.http.POST;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
@ -15,10 +16,10 @@ import retrofit2.http.Query;
|
|||||||
|
|
||||||
public interface OrdiniAccettazioneRESTConsumerService {
|
public interface OrdiniAccettazioneRESTConsumerService {
|
||||||
|
|
||||||
@POST("SM2GetOrdiniAccettazioneInevasi")
|
@GET("SM2GetOrdiniAccettazioneInevasi")
|
||||||
Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> listOrdiniInevasi();
|
Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> listOrdiniInevasi();
|
||||||
|
|
||||||
@POST("WMSGetPickingListAccettazione")
|
@GET("WMSGetPickingListAccettazione")
|
||||||
Call<ServiceRESTResponse<List<OrdineAccettazioneDTO>>> pickingListAccettazione(@Query("codBarreBancale") String codBarreBacale);
|
Call<ServiceRESTResponse<List<OrdineAccettazioneDTO>>> pickingListAccettazione(@Query("codBarreBancale") String codBarreBacale);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,103 +1,44 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso;
|
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.databinding.DataBindingUtil;
|
||||||
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.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
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.Menu;
|
||||||
import android.view.MenuItem;
|
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.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
import butterknife.OnClick;
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.REST.CommonRESTException;
|
import it.integry.integrywmsnative.databinding.ActivityAccettazioneOrdineInevasoBinding;
|
||||||
import it.integry.integrywmsnative.core.REST.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.databinding.FragmentArticoliInColloBottomSheetBinding;
|
||||||
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.gest.accettazione.dto.OrdineAccettazioneDTO;
|
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.viewmodel.AccettazioneOrdineInevasoViewModel;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.MainListOrdineAccettazioneAdapter;
|
import it.integry.integrywmsnative.view.bottomsheet.viewmodel.ArticoliInColloBottomSheetViewModel;
|
||||||
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;
|
|
||||||
|
|
||||||
public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_accettazione_ordine_inevaso);
|
|
||||||
|
|
||||||
ButterKnife.bind(this);
|
bindings = DataBindingUtil.setContentView(this, R.layout.activity_accettazione_ordine_inevaso);
|
||||||
|
FragmentArticoliInColloBottomSheetBinding bindings = this.bindings.bottomSheetInclude;
|
||||||
setSupportActionBar(toolbar);
|
ArticoliInColloBottomSheetViewModel mArticoliInColloBottomSheetViewModel = new ArticoliInColloBottomSheetViewModel(this, bindings);
|
||||||
|
|
||||||
List<OrdineAccettazioneDTO> orders = (ArrayList<OrdineAccettazioneDTO>)getIntent().getSerializableExtra("key");
|
List<OrdineAccettazioneDTO> orders = (ArrayList<OrdineAccettazioneDTO>)getIntent().getSerializableExtra("key");
|
||||||
|
mAccettazioneOrdineInevasoViewModel = new AccettazioneOrdineInevasoViewModel(
|
||||||
|
this, mArticoliInColloBottomSheetViewModel, orders);
|
||||||
|
|
||||||
|
setSupportActionBar(this.bindings.toolbar);
|
||||||
|
|
||||||
setTitle(orders);
|
setTitle(orders);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
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
|
@Override
|
||||||
@ -118,7 +59,7 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
|||||||
// Handle item selection
|
// Handle item selection
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.action_filter:
|
case R.id.action_filter:
|
||||||
this.showOrderDialog();
|
mAccettazioneOrdineInevasoViewModel.showOrderDialog();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
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.Context;
|
||||||
import android.content.SyncRequest;
|
import android.content.SyncRequest;
|
||||||
|
import android.databinding.ObservableArrayList;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@ -27,52 +28,34 @@ public class AccettazioneOrdineInevasoHelper {
|
|||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
|
private ObservableArrayList<AccettazioneOrdineInevasoListViewModel> mListViewModels = new ObservableArrayList<>();
|
||||||
|
|
||||||
public AccettazioneOrdineInevasoHelper(Context context){
|
public AccettazioneOrdineInevasoHelper(Context context){
|
||||||
mContext = context;
|
mContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainListOrdineAccettazioneAdapter getRightListAdapter(AccettazioneOrdineInevasoOrderBy.Enum orderByEnum, List<List<OrdineAccettazioneDTO.Riga>> mDataset) throws Exception {
|
public MainListOrdineAccettazioneAdapter getRightListAdapter() {
|
||||||
|
return new MainListOrdineAccettazioneAdapter(mContext, mListViewModels);
|
||||||
|
}
|
||||||
|
|
||||||
List<AccettazioneOrdineInevasoListViewModel> listViewModels = null;
|
public void updateListModel(AccettazioneOrdineInevasoOrderBy.Enum orderByEnum, List<List<OrdineAccettazioneDTO.Riga>> mDataset) throws Exception {
|
||||||
|
|
||||||
|
mListViewModels.clear();
|
||||||
|
|
||||||
switch (orderByEnum){
|
switch (orderByEnum){
|
||||||
case COD_ART_FOR:
|
case COD_ART_FOR:
|
||||||
case DESCR_ART:
|
case DESCR_ART:
|
||||||
listViewModels = getListViewModelPerArtForn(mDataset);
|
mListViewModels.addAll(getListViewModelPerArtForn(mDataset));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RAG_SOC_COM:
|
case RAG_SOC_COM:
|
||||||
listViewModels = getListViewModelPerRagSocCommessa(mDataset);
|
mListViewModels.addAll(getListViewModelPerRagSocCommessa(mDataset));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new Exception("Cannot find right list adapter: " + orderByEnum.toString());
|
throw new Exception("Cannot find right list adapter: " + orderByEnum.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MainListOrdineAccettazioneAdapter(mContext, listViewModels);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<AccettazioneOrdineInevasoListViewModel> getRightListViewModel(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 listViewModels;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -149,16 +132,22 @@ public class AccettazioneOrdineInevasoHelper {
|
|||||||
|
|
||||||
|
|
||||||
private class RaggruppaPerCommessaUtilDTO {
|
private class RaggruppaPerCommessaUtilDTO {
|
||||||
public String codJcom;
|
public String codJcom = "";
|
||||||
public String ragSocCom;
|
public String ragSocCom = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerRagSocCommessa(List<OrdineAccettazioneDTO.Riga> mDataset) {
|
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerRagSocCommessa(List<OrdineAccettazioneDTO.Riga> mDataset) {
|
||||||
List<RaggruppaPerCommessaUtilDTO> commessaList = new ArrayList<>();
|
List<RaggruppaPerCommessaUtilDTO> commessaList = new ArrayList<>();
|
||||||
|
|
||||||
|
commessaList.add(new RaggruppaPerCommessaUtilDTO());
|
||||||
|
|
||||||
for(int i = 0; i < mDataset.size(); i++){
|
for(int i = 0; i < mDataset.size(); i++){
|
||||||
boolean alreadyExists = false;
|
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++){
|
for(int k = 0; k < commessaList.size(); k++){
|
||||||
if(commessaList.get(k).codJcom.equalsIgnoreCase(mDataset.get(i).codJcom)){
|
if(commessaList.get(k).codJcom.equalsIgnoreCase(mDataset.get(i).codJcom)){
|
||||||
alreadyExists = true;
|
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;
|
return groupedRighe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core;
|
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.databinding.ObservableArrayList;
|
||||||
|
import android.databinding.ObservableList;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
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> {
|
public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<MainListOrdineAccettazioneAdapter.ViewHolder> {
|
||||||
|
|
||||||
protected Context mContext;
|
protected Context mContext;
|
||||||
protected List<AccettazioneOrdineInevasoListViewModel> mDataset;
|
protected ObservableArrayList<AccettazioneOrdineInevasoListViewModel> mDataset;
|
||||||
|
|
||||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
// each data item is just a string in this case
|
// each data item is just a string in this case
|
||||||
@ -35,16 +37,40 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainListOrdineAccettazioneAdapter(Context context, List<AccettazioneOrdineInevasoListViewModel> myDataset) {
|
public MainListOrdineAccettazioneAdapter(Context context, ObservableArrayList<AccettazioneOrdineInevasoListViewModel> myDataset) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDataset = myDataset;
|
mDataset = myDataset;
|
||||||
|
|
||||||
|
myDataset.addOnListChangedCallback(onListChangedCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDataset(List<AccettazioneOrdineInevasoListViewModel> myDataset){
|
private ObservableList.OnListChangedCallback onListChangedCallback = new ObservableList.OnListChangedCallback<ObservableList<AccettazioneOrdineInevasoListViewModel>>() {
|
||||||
mDataset = myDataset;
|
@Override
|
||||||
|
public void onChanged(ObservableList<AccettazioneOrdineInevasoListViewModel> sender) {
|
||||||
notifyDataSetChanged();
|
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
|
@Override
|
||||||
public MainListOrdineAccettazioneAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public MainListOrdineAccettazioneAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
@ -56,10 +82,10 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
|||||||
|
|
||||||
ViewHolder vh = new ViewHolder(v);
|
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;
|
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;
|
vh.mLinearLayoutGroupItemContainer = groupItemContainer;
|
||||||
|
|
||||||
return vh;
|
return vh;
|
||||||
@ -85,17 +111,19 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
|||||||
|
|
||||||
if(i % 2 == 1){
|
if(i % 2 == 1){
|
||||||
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
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);
|
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);
|
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;
|
String descrizioneString = rowItem.descrizione;
|
||||||
int descrizioneColor = Color.BLACK;
|
int descrizioneColor = Color.BLACK;
|
||||||
@ -110,10 +138,10 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
|||||||
descrizione.setText(descrizioneString);
|
descrizione.setText(descrizioneString);
|
||||||
descrizione.setTextColor(descrizioneColor);
|
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);
|
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);
|
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);
|
ActivityLoginBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_login);
|
||||||
LoginViewModel loginViewModel = new LoginViewModel(this);
|
LoginViewModel loginViewModel = new LoginViewModel(this);
|
||||||
binding.setVariable(BR.loginViewModel, loginViewModel);
|
binding.setLoginViewModel(loginViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -150,7 +150,7 @@ public class LoginViewModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed(Exception ex) {
|
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){
|
private void onLoginFailed(final Spanned message){
|
||||||
mProgress.dismiss();
|
mProgress.dismiss();
|
||||||
loginButtonEnabled.set(false);
|
loginButtonEnabled.set(true);
|
||||||
mActivity.runOnUiThread(new Runnable() {
|
mActivity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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.annotation.NonNull;
|
||||||
import android.support.design.widget.AppBarLayout;
|
import android.support.design.widget.AppBarLayout;
|
||||||
@ -19,19 +19,15 @@ import butterknife.ButterKnife;
|
|||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.databinding.FragmentArticoliInColloBottomSheetBinding;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||||
|
|
||||||
|
|
||||||
public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.BottomSheetCallback {
|
public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.BottomSheetCallback {
|
||||||
|
|
||||||
private AppCompatActivity mActivity;
|
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.appbar_bottom_sheet) AppBarLayout appBarLayoutBottomSheet;
|
||||||
@BindView(R.id.toolbar_bottom_sheet) Toolbar toolbarBottomSheet;
|
@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;
|
@BindView(R.id.tap_action_layout) RelativeLayout tapActionLayout;
|
||||||
private BottomSheetBehavior mBottomSheetBehavior;
|
private BottomSheetBehavior mBottomSheetBehavior;
|
||||||
|
|
||||||
private MtbColt mMtbColt;
|
|
||||||
|
|
||||||
public ArticoliInColloBottomSheetHelper(AppCompatActivity context, View rootView){
|
public ArticoliInColloBottomSheetHelper(AppCompatActivity context, FragmentArticoliInColloBottomSheetBinding binding){
|
||||||
mActivity = context;
|
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.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||||
mBottomSheetBehavior.setBottomSheetCallback(this);
|
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);
|
updateRigheNumber(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initCollo(MtbColt mtbColt){
|
public void initCollo(MtbColt mtbColt){
|
||||||
this.mMtbColt = mtbColt;
|
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy");
|
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 {
|
try {
|
||||||
mDetailDateTextView.setText(sdf.format(mtbColt.getDataColloD()));
|
mBinding.articoliInColloDetailsDate.setText(sdf.format(mtbColt.getDataColloD()));
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(mActivity, new SpannableString(e.toString()), null, null).show();
|
DialogSimpleMessageHelper.makeErrorDialog(mActivity, new SpannableString(e.toString()), null, null).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
mDetailPosizioneTextView.setText(mtbColt.getPosizione() != null ? mtbColt.getPosizione() : "N/A");
|
mBinding.articoliInColloDetailsPosizione.setText(mtbColt.getPosizione() != null ? mtbColt.getPosizione() : "N/A");
|
||||||
mDetailPreparatoDaTextView.setText(mtbColt.getPreparatoDa() != null ? mtbColt.getPreparatoDa() : "N/A");
|
// bindings.articoliInColloDetailsPreparatoDa.setText(mtbColt.getPreparatoDa() != null ? mtbColt.getPreparatoDa() : "N/A");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRigheNumber(int newRigheNumber){
|
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)
|
@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){
|
switch (type){
|
||||||
case INFO:
|
case INFO:
|
||||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.colorPrimary);
|
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;
|
break;
|
||||||
|
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<vector android:height="120dp" android:tint="#FFFFFF"
|
<vector android:height="78dp" android:tint="#FFFFFF"
|
||||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
android:width="120dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="78dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="#FF000000" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
<path android:fillColor="#FF000000" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
||||||
</vector>
|
</vector>
|
||||||
@ -1,3 +1,14 @@
|
|||||||
|
<layout>
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<import type="android.view.View" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="viewmodel"
|
||||||
|
type="it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.viewmodel.AccettazioneOrdineInevasoViewModel"/>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
|
||||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -80,7 +91,8 @@
|
|||||||
fab:menu_labels_showShadow="true"
|
fab:menu_labels_showShadow="true"
|
||||||
fab:menu_labels_position="left"
|
fab:menu_labels_position="left"
|
||||||
fab:menu_openDirection="up"
|
fab:menu_openDirection="up"
|
||||||
fab:menu_backgroundColor="@color/white_bg_alpha">
|
fab:menu_backgroundColor="@color/white_bg_alpha"
|
||||||
|
android:visibility="@{viewmodel.isFabVisible ? View.VISIBLE : View.GONE}">
|
||||||
|
|
||||||
<com.github.clans.fab.FloatingActionButton
|
<com.github.clans.fab.FloatingActionButton
|
||||||
android:id="@+id/accettazione_ordine_inevaso_fab_item1"
|
android:id="@+id/accettazione_ordine_inevaso_fab_item1"
|
||||||
@ -90,7 +102,8 @@
|
|||||||
app:fab_colorNormal="@color/white"
|
app:fab_colorNormal="@color/white"
|
||||||
app:fab_colorPressed="@color/white_pressed"
|
app:fab_colorPressed="@color/white_pressed"
|
||||||
app:fab_colorRipple="#66FFFFFF"
|
app:fab_colorRipple="#66FFFFFF"
|
||||||
fab:fab_label="@string/action_show_created_ul" />
|
fab:fab_label="@string/action_show_created_ul"
|
||||||
|
app:onClick="@{() -> viewmodel.showCreatedUL()}"/>
|
||||||
|
|
||||||
<com.github.clans.fab.FloatingActionButton
|
<com.github.clans.fab.FloatingActionButton
|
||||||
android:id="@+id/accettazione_ordine_inevaso_fab_item2"
|
android:id="@+id/accettazione_ordine_inevaso_fab_item2"
|
||||||
@ -100,7 +113,8 @@
|
|||||||
app:fab_colorNormal="@color/white"
|
app:fab_colorNormal="@color/white"
|
||||||
app:fab_colorPressed="@color/white_pressed"
|
app:fab_colorPressed="@color/white_pressed"
|
||||||
app:fab_colorRipple="#66FFFFFF"
|
app:fab_colorRipple="#66FFFFFF"
|
||||||
fab:fab_label="@string/action_create_ul" />
|
fab:fab_label="@string/action_create_ul"
|
||||||
|
app:onClick="@{() -> viewmodel.createNewUL()}" />
|
||||||
|
|
||||||
</com.github.clans.fab.FloatingActionMenu>
|
</com.github.clans.fab.FloatingActionMenu>
|
||||||
|
|
||||||
@ -108,6 +122,10 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<include layout="@layout/fragment_articoli_in_collo_bottom_sheet"></include>
|
<include
|
||||||
|
android:id="@+id/bottom_sheet_include"
|
||||||
|
layout="@layout/fragment_articoli_in_collo_bottom_sheet"></include>
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
|
||||||
|
</layout>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
android:layout_width="76dp"
|
android:layout_width="76dp"
|
||||||
android:layout_height="76dp"
|
android:layout_height="76dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/ic_info_24dp"
|
android:src="@drawable/ic_info_78dp"
|
||||||
android:tint="@color/green_500"/>
|
android:tint="@color/green_500"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
@ -1,4 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout>
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<variable
|
||||||
|
name="viewModel"
|
||||||
|
type="it.integry.integrywmsnative.view.bottomsheet.viewmodel.ArticoliInColloBottomSheetViewModel"
|
||||||
|
/>
|
||||||
|
<import type="android.view.View" />
|
||||||
|
</data>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
@ -6,7 +16,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/white"
|
android:background="@android:color/white"
|
||||||
android:fitsSystemWindows="false"
|
android:visibility="@{viewModel.mtbColt.get() != null ? View.VISIBLE : View.GONE}"
|
||||||
app:behavior_peekHeight="?attr/actionBarSize"
|
app:behavior_peekHeight="?attr/actionBarSize"
|
||||||
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
|
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
|
||||||
app:behavior_hideable="false">
|
app:behavior_hideable="false">
|
||||||
@ -19,13 +29,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:fitsSystemWindows="false">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@color/colorPrimaryDark">
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/tap_action_layout"
|
android:id="@+id/tap_action_layout"
|
||||||
@ -66,10 +70,10 @@
|
|||||||
android:elevation="0dp"
|
android:elevation="0dp"
|
||||||
android:theme="@style/white_button"
|
android:theme="@style/white_button"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:textSize="16sp"/>
|
android:textSize="16sp"
|
||||||
|
android:onClick="@{() -> viewModel.closeCurrentUL()}"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<android.support.v4.widget.NestedScrollView
|
<android.support.v4.widget.NestedScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -172,7 +176,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:layout_marginStart="0dp"
|
android:layout_marginStart="0dp"
|
||||||
android:text="TextView"
|
android:text="@{viewModel.mtbColt.posizione}"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
app:layout_constraintStart_toStartOf="@+id/guideline2"
|
app:layout_constraintStart_toStartOf="@+id/guideline2"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
@ -205,7 +209,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:layout_marginStart="0dp"
|
android:layout_marginStart="0dp"
|
||||||
android:text="TextView"
|
android:text="@{viewModel.mtbColt.preparatoDa}"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
app:layout_constraintStart_toStartOf="@+id/guideline3"
|
app:layout_constraintStart_toStartOf="@+id/guideline3"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
@ -241,152 +245,48 @@
|
|||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="QUICK ACTIONS"
|
android:text="@string/already_read_articles"
|
||||||
|
android:textAllCaps="true"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:padding="15dp"
|
android:orientation="vertical"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="14dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@drawable/circleshape"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="60dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:src="@drawable/ic_done_white_24dp"
|
|
||||||
android:scaleType="fitXY"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:visibility="@{viewModel.mtbColt == null || viewModel.mtbColt.mtbColr.size() == 0 ? View.VISIBLE : View.GONE}">
|
||||||
|
|
||||||
|
<android.support.v7.widget.AppCompatImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@android:color/darker_gray"
|
android:tint="@color/white_pressed"
|
||||||
android:text="Drive"/>
|
android:src="@drawable/ic_info_78dp"/>
|
||||||
|
|
||||||
|
<android.support.v7.widget.AppCompatTextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/empty_rows_in_mtbcolt"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/white_pressed"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<com.linearlistview.LinearListView
|
||||||
android:layout_weight="1"
|
android:id="@+id/linear_listview"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@drawable/circleshape"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="60dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:src="@drawable/ic_done_white_24dp"
|
|
||||||
android:scaleType="fitXY"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@android:color/darker_gray"
|
android:clickable="true"
|
||||||
android:text="Train or Bus"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="wrap_content"
|
app:dividerThickness="0dp" />
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@drawable/circleshape"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="60dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:src="@drawable/ic_done_white_24dp"
|
|
||||||
android:scaleType="fitXY"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="@android:color/darker_gray"
|
|
||||||
android:text="Walk"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:background="@drawable/circleshape"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="60dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:src="@drawable/ic_done_white_24dp"
|
|
||||||
android:layout_width="35dp"
|
|
||||||
android:layout_height="35dp"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="@android:color/darker_gray"
|
|
||||||
android:text="Cab"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -406,8 +306,7 @@
|
|||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:fitsSystemWindows="true">
|
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:id="@+id/appbar_bottom_sheet"
|
android:id="@+id/appbar_bottom_sheet"
|
||||||
@ -453,3 +352,4 @@
|
|||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</layout>
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<import type="android.view.View" />
|
||||||
|
<variable
|
||||||
|
name="mtbColr"
|
||||||
|
type="it.integry.integrywmsnative.core.model.MtbColr"/>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="3dp"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@{`Cod: ` + mtbColr.codMart}"
|
||||||
|
tools:text="Cod: 028650"/>
|
||||||
|
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@android:style/TextAppearance.Medium"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="@{mtbColr.descrizione}"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:layout_marginEnd="6dp"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/qta_textbox"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
tools:text="11719 - BESCIAMELLA CHEF 200ML FLASH CICCIO RICCIO" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/qta_textbox"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/badge1_round_corner"
|
||||||
|
android:backgroundTint="@color/green_600"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:paddingLeft="6dp"
|
||||||
|
android:paddingRight="6dp"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:text="@{`Qtà: ` + mtbColr.qtaCol}"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="Qtà: 100"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@{`Lotto: ` + mtbColr.partitaMag + (mtbColr.dataScadPartita != null ? `(` + mtbColr.dataScadPartita + `)` : ``)}"
|
||||||
|
tools:text="Lotto: 030716"
|
||||||
|
android:visibility="@{mtbColr.partitaMag == null ? View.GONE : View.VISIBLE}"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
||||||
@ -1,8 +1,16 @@
|
|||||||
<FrameLayout 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">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<import type="android.databinding.ObservableList"/>
|
||||||
|
<variable name="view" type="it.integry.integrywmsnative.gest.accettazione.MainAccettazioneFragment" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:fab="http://schemas.android.com/apk/res-auto"
|
xmlns:fab="http://schemas.android.com/apk/res-auto"
|
||||||
tools:context="it.integry.integrywmsnative.gest.accettazione.MainAccettazioneFragment">
|
tools:context="it.integry.integrywmsnative.gest.accettazione.MainAccettazioneFragment">
|
||||||
|
|
||||||
@ -27,3 +35,5 @@
|
|||||||
android:tint="@android:color/white"
|
android:tint="@android:color/white"
|
||||||
app:srcCompat="@drawable/ic_check_black_24dp" />
|
app:srcCompat="@drawable/ic_check_black_24dp" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
</layout>
|
||||||
@ -62,5 +62,10 @@
|
|||||||
<string name="server_port_error_not_valid">inserire una porta valida</string>
|
<string name="server_port_error_not_valid">inserire una porta valida</string>
|
||||||
<string name="server_cod_azienda_not_valid"><![CDATA[Il codice azienda <b>%s</b> non è valido. Controllalo e riprova]]></string>
|
<string name="server_cod_azienda_not_valid"><![CDATA[Il codice azienda <b>%s</b> non è valido. Controllalo e riprova]]></string>
|
||||||
<string name="server_not_reachable"><![CDATA[L\'host <b>%s</b> sulla porta <b>%d</b> non è al momento raggiungibile. Riprova più tardi]]></string>
|
<string name="server_not_reachable"><![CDATA[L\'host <b>%s</b> sulla porta <b>%d</b> non è al momento raggiungibile. Riprova più tardi]]></string>
|
||||||
|
<string name="no_codmdep_available">Nessun deposito trovato per l\'utente corrente</string>
|
||||||
<string name="action_choose_profile_db">Seleziona un database</string>
|
<string name="action_choose_profile_db">Seleziona un database</string>
|
||||||
|
|
||||||
|
<string name="empty_rows_in_mtbcolt">Nessuna riga presente nell\'Unità Logistica</string>
|
||||||
|
|
||||||
|
<string name="quantity_short">Qtà</string>
|
||||||
</resources>
|
</resources>
|
||||||
@ -69,7 +69,11 @@
|
|||||||
<string name="server_port_error_not_valid">enter a valid port</string>
|
<string name="server_port_error_not_valid">enter a valid port</string>
|
||||||
<string name="server_cod_azienda_not_valid"><![CDATA[Code <b>%s</b> is not valid. Check and retry later]]></string>
|
<string name="server_cod_azienda_not_valid"><![CDATA[Code <b>%s</b> is not valid. Check and retry later]]></string>
|
||||||
<string name="server_not_reachable"><![CDATA[The host <b>%s</b> on port <b>%d</b> is not reachable. Retry later]]></string>
|
<string name="server_not_reachable"><![CDATA[The host <b>%s</b> on port <b>%d</b> is not reachable. Retry later]]></string>
|
||||||
|
<string name="no_codmdep_available">No deposit available with current user</string>
|
||||||
<string name="action_choose_profile_db">Choose a database</string>
|
<string name="action_choose_profile_db">Choose a database</string>
|
||||||
|
|
||||||
|
<string name="empty_rows_in_mtbcolt">No rows found in LU</string>
|
||||||
|
|
||||||
|
<string name="quantity_short">Qty</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ buildscript {
|
|||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.1.1'
|
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|||||||
1
pointmobilescannerlibrary/.gitignore
vendored
Normal file
1
pointmobilescannerlibrary/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
34
pointmobilescannerlibrary/build.gradle
Normal file
34
pointmobilescannerlibrary/build.gradle
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 27
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 21
|
||||||
|
targetSdkVersion 27
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
|
testImplementation 'junit:junit:4.12'
|
||||||
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||||
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||||
|
}
|
||||||
21
pointmobilescannerlibrary/proguard-rules.pro
vendored
Normal file
21
pointmobilescannerlibrary/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package it.integry.pointmobilescannerlibrary;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.test.InstrumentationRegistry;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||||
|
|
||||||
|
assertEquals("it.integry.pointmobilescannerlibrary.test", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
||||||
2
pointmobilescannerlibrary/src/main/AndroidManifest.xml
Normal file
2
pointmobilescannerlibrary/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="it.integry.pointmobilescannerlibrary" />
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">PointMobileScannerLibrary</string>
|
||||||
|
</resources>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package it.integry.pointmobilescannerlibrary;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1 +1 @@
|
|||||||
include ':app'
|
include ':app', ':pointmobilescannerlibrary'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user