refs #4632 cambiado el tipo de las imagenes a img/png

This commit is contained in:
Alexandre Riera 2023-03-09 08:42:44 +01:00
parent 6529423e2a
commit 29c49b3089
4 changed files with 11 additions and 10 deletions

View File

@ -423,7 +423,7 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
String token = Utils.getTokenUser(getApplicationContext());
File file = new File(data.getSign());
MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), RequestBody.create(MediaType.parse("image/*"), file));
MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), RequestBody.create(MediaType.parse("image/png"), file));
Map<String, String> queryMap = new HashMap<>();
queryMap.put("tickets", data.getTickets().toString());
queryMap.put("location", new Gson().toJson(data.getLocation()));
@ -449,15 +449,15 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
}else{
//Log.i("ERROR","error al guardar");
Utils.showErrorDialog(that,that.getResources().getString(R.string.error_conexion));
//Utils.showErrorDialog(that,response.message());
//Utils.showErrorDialog(that,that.getResources().getString(R.string.error_conexion));
Utils.showErrorDialog(that,response.message());
}
}
@Override
public void onFailure(Call<Void> call, Throwable t) {
Utils.progressBar.getDialog().dismiss();
Utils.showErrorDialog(that,that.getResources().getString(R.string.error_conexion));
Utils.showErrorDialog(that,t.getMessage());
}
});
}
@ -469,7 +469,7 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
final MainActivity that = this;
String token = Utils.getTokenUser(getApplicationContext());
File file = new File(data.getSign());
MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), RequestBody.create(MediaType.parse("image/*"), file));
MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), RequestBody.create(MediaType.parse("image/png"), file));
Map<String, String> queryMap = new HashMap<>();
queryMap.put("tickets", data.getTickets().toString());
queryMap.put("location", new Gson().toJson(data.getLocation()));
@ -486,7 +486,7 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
confirmSavePos(null);
} else {
Utils.showErrorDialog(that, that.getResources().getString(R.string.error_conexion));
Utils.showErrorDialog(that,response.message());
}
}
@ -494,7 +494,7 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
@Override
public void onFailure(Call<Void> call, Throwable t) {
Utils.progressBar.getDialog().dismiss();
Utils.showErrorDialog(that, that.getResources().getString(R.string.error_conexion));
Utils.showErrorDialog(that,t.getMessage());
}
});
}else{

View File

@ -68,7 +68,7 @@ public class NetworkStateReveiver extends BroadcastReceiver {
//Utils.progressBar.show(this, getResources().getString(R.string.please_wait));
String token = Utils.getTokenUser(this.context);
File file = new File(listData.get(pos).getSign());
MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), RequestBody.create(MediaType.parse("image/*"), file));
MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), RequestBody.create(MediaType.parse("image/png"), file));
Map<String, String> queryMap = new HashMap<>();
queryMap.put("tickets", listData.get(pos).getTickets().toString());
queryMap.put("location", new Gson().toJson(listData.get(pos).getLocation()));

View File

@ -250,7 +250,7 @@ public class SignActivity extends AppCompatActivity implements LocationListener{
String token = Utils.getTokenUser(getApplicationContext());
File file = new File(data.getSign());
MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), RequestBody.create(MediaType.parse("image/*"), file));
MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", file.getName(), RequestBody.create(MediaType.parse("image/png"), file));
Map<String, String> queryMap = new HashMap<>();
queryMap.put("tickets", data.getTickets().toString());
queryMap.put("location", new Gson().toJson(data.getLocation()));
@ -274,6 +274,7 @@ public class SignActivity extends AppCompatActivity implements LocationListener{
}else{
// Log.i("ERROR","error al guardar");
Utils.showErrorDialog(that,response.message());
saveLocal(data);
}
}

View File

@ -134,7 +134,6 @@ public class Tickets extends AppCompatActivity {
} else {
//Log.i("ERROR", "error al guardar");
Utils.showErrorDialog(that, that.getResources().getString(R.string.error_conexion));
getData(pos);
}
}
@ -143,6 +142,7 @@ public class Tickets extends AppCompatActivity {
public void onFailure(Call<Void> call, Throwable t) {
Utils.progressBar.getDialog().dismiss();
getData(pos);
Utils.showErrorDialog(that,t.getMessage());
}
});
} else {