This commit is contained in:
Sergio De la torre 2023-04-24 12:50:41 +02:00
parent 84c64551a8
commit a447d8cb70
1 changed files with 20 additions and 21 deletions

View File

@ -105,10 +105,8 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
@Override @Override
protected void onRestart() { protected void onRestart() {
getRoutes(null);
getPending(); getPending();
getPengingExpeditions(); getPengingExpeditions();
super.onRestart(); super.onRestart();
} }
@ -392,8 +390,9 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
// startActivity(new Intent(this,InfoActivity.class)); // startActivity(new Intent(this,InfoActivity.class));
Utils.startPicking(this, "info"); Utils.startPicking(this, "info");
} }
public void goToFound(View v){
startActivity(new Intent(this,ExpeditionScanActivity.class)); public void goToFound(View v) {
startActivity(new Intent(this, ExpeditionScanActivity.class));
} }
/* public void goToLoaders(int pos){ /* public void goToLoaders(int pos){
Intent i = new Intent(this,LoadersActivity.class); Intent i = new Intent(this,LoadersActivity.class);
@ -422,36 +421,36 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
@Override @Override
public void onResponse(Call<Void> call, Response<Void> response) { public void onResponse(Call<Void> call, Response<Void> response) {
Utils.progressBar.getDialog().dismiss(); Utils.progressBar.getDialog().dismiss();
if(response.isSuccessful()){ if (response.isSuccessful()) {
// if (response.body().equals("OK")){ // if (response.body().equals("OK")){
ArrayList<SignDataUpload> listAux = new ArrayList<>(); ArrayList<SignDataUpload> listAux = new ArrayList<>();
listaPendientes.remove(data); listaPendientes.remove(data);
LocalStorage.udpatePendingSigns(that,listaPendientes); LocalStorage.udpatePendingSigns(that, listaPendientes);
getPending(); getPending();
/* }else{ /* }else{
Utils.showErrorDialog(that,that.getResources().getString(R.string.error_conexion)); Utils.showErrorDialog(that,that.getResources().getString(R.string.error_conexion));
}*/ }*/
}else{ } else {
//Log.i("ERROR","error al guardar"); //Log.i("ERROR","error al guardar");
//Utils.showErrorDialog(that,that.getResources().getString(R.string.error_conexion)); //Utils.showErrorDialog(that,that.getResources().getString(R.string.error_conexion));
Utils.showErrorDialog(that,response.message()); Utils.showErrorDialog(that, response.message());
} }
} }
@Override @Override
public void onFailure(Call<Void> call, Throwable t) { public void onFailure(Call<Void> call, Throwable t) {
Utils.progressBar.getDialog().dismiss(); Utils.progressBar.getDialog().dismiss();
Utils.showErrorDialog(that,t.getMessage()); Utils.showErrorDialog(that, t.getMessage());
} }
}); });
} }
public void confirmSavePos(View v){ public void confirmSavePos(View v) {
if (listaPendientes.size() > 0) { if (listaPendientes.size() > 0) {
Utils.progressBar.show(this, getResources().getString(R.string.please_wait)); Utils.progressBar.show(this, getResources().getString(R.string.please_wait));
final SignDataUpload data = listaPendientes.get(0); final SignDataUpload data = listaPendientes.get(0);
@ -470,20 +469,20 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
if (response.isSuccessful()) { if (response.isSuccessful()) {
listaPendientes.remove(data); listaPendientes.remove(data);
LocalStorage.udpatePendingSigns(that, listaPendientes); LocalStorage.udpatePendingSigns(that, listaPendientes);
confirmSavePos(null); confirmSavePos(null);
} else { } else {
Utils.showErrorDialog(that,response.message()); Utils.showErrorDialog(that, response.message());
} }
} }
@Override @Override
public void onFailure(Call<Void> call, Throwable t) { public void onFailure(Call<Void> call, Throwable t) {
Utils.progressBar.getDialog().dismiss(); Utils.progressBar.getDialog().dismiss();
Utils.showErrorDialog(that,t.getMessage()); Utils.showErrorDialog(that, t.getMessage());
} }
}); });
} else { } else {