Aggiunto fab button in accettazione ordine inevaso
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
@@ -9,13 +10,18 @@ import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.clans.fab.FloatingActionButton;
|
||||
import com.github.clans.fab.FloatingActionMenu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.AccettazioneOrdineInevasoHelper;
|
||||
@@ -29,6 +35,10 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
private MainListOrdineAccettazioneAdapter mAdapter;
|
||||
private RecyclerView.LayoutManager mLayoutManager;
|
||||
@@ -49,8 +59,7 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
List<OrdineAccettazioneDTO> orders = new ArrayList<OrdineAccettazioneDTO>();
|
||||
orders = (ArrayList<OrdineAccettazioneDTO>)getIntent().getSerializableExtra("key");
|
||||
List<OrdineAccettazioneDTO> orders = (ArrayList<OrdineAccettazioneDTO>)getIntent().getSerializableExtra("key");
|
||||
|
||||
setTitle(orders);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
@@ -65,7 +74,6 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini);
|
||||
|
||||
initRecyclerView(groupedRighe);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -124,8 +132,6 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void showOrderDialog() {
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(this)
|
||||
@@ -146,8 +152,6 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void refreshOrderBy(){
|
||||
switch (currentOrderBy){
|
||||
case COD_ART_FOR:
|
||||
@@ -166,15 +170,32 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
try {
|
||||
mRecyclerView.setAdapter(helper.getRightListAdapter(currentOrderBy, groupedRighe));
|
||||
mRecyclerView.invalidate();
|
||||
|
||||
// mAdapter = helper.getRightListAdapter(currentOrderBy, groupedRighe);
|
||||
// mAdapter.notifyDataSetChanged();
|
||||
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);
|
||||
|
||||
// Snackbar.make(AccettazioneOrdineInevasoActivity.this, "Creato nuovo collo", 3000).show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Al click di "Mostra UL già create"
|
||||
@OnClick(R.id.accettazione_ordine_inevaso_fab_item1)
|
||||
public void onItem1Click(View view) {
|
||||
|
||||
fab.close(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public MainListOrdineAccettazioneAdapter getRightListAdapter(AccettazioneOrdineInevasoOrderBy.Enum orderByEnum, List<List<OrdineAccettazioneDTO.Riga>> mDataset) throws Exception {
|
||||
|
||||
List<AccettazioneOrdineInevasoListViewModel> listViewModels = null;
|
||||
@@ -55,6 +53,28 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerCodArtForn(List<OrdineAccettazioneDTO.Riga> mDataset){
|
||||
List<String> codArtForns = new ArrayList<>();
|
||||
@@ -136,8 +156,6 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerRagSocCommessa(List<OrdineAccettazioneDTO.Riga> mDataset) {
|
||||
List<RaggruppaPerCommessaUtilDTO> commessaList = new ArrayList<>();
|
||||
|
||||
//ragSocList.add(mContext.getText(R.string.stock).toString());
|
||||
|
||||
for(int i = 0; i < mDataset.size(); i++){
|
||||
boolean alreadyExists = false;
|
||||
|
||||
@@ -157,8 +175,8 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
|
||||
Collections.sort(commessaList, new Comparator<RaggruppaPerCommessaUtilDTO>() {
|
||||
public int compare(RaggruppaPerCommessaUtilDTO dto1, RaggruppaPerCommessaUtilDTO dto2) {
|
||||
if(dto1.ragSocCom == null) return -1;
|
||||
if(dto2.ragSocCom == null) return 1;
|
||||
if(dto1.ragSocCom == null || dto2.codJcom.equalsIgnoreCase("MAG")) return -1;
|
||||
if(dto2.ragSocCom == null || dto1.codJcom.equalsIgnoreCase("MAG")) return 1;
|
||||
|
||||
return dto1.ragSocCom.compareToIgnoreCase(dto2.ragSocCom);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,11 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
||||
mDataset = myDataset;
|
||||
}
|
||||
|
||||
public void updateDataset(List<AccettazioneOrdineInevasoListViewModel> myDataset){
|
||||
mDataset = myDataset;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MainListOrdineAccettazioneAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
|
||||
Reference in New Issue
Block a user