use of de.tum.in.tumcampusapp.component.tumui.feedback.model.Success in project TumCampusApp by TCA-Team.
the class FeedbackActivity method sendFeedback.
public void sendFeedback(View view) {
sentCount = 0;
stopListeningForLocation();
if (includeEmail.isChecked() && Strings.isNullOrEmpty(lrzId) && !isValidEmail()) {
return;
}
showProgressBarDialog();
TUMCabeClient client = TUMCabeClient.getInstance(this);
client.sendFeedback(getFeedback(), picPaths.toArray(new String[picPaths.size()]), new Callback<Success>() {
@Override
public void onResponse(Call<Success> call, Response<Success> response) {
Success success = response.body();
if (success != null && success.wasSuccessfullySent()) {
sentCount++;
Utils.log(success.getSuccess());
if (sentCount == picPaths.size() + 1) {
progress.cancel();
finish();
Toast.makeText(feedbackView.getContext(), R.string.feedback_send_success, Toast.LENGTH_SHORT).show();
}
Utils.log("sent " + sentCount + " of " + (picPaths.size() + 1) + " message parts");
} else {
showErrorDialog();
}
}
@Override
public void onFailure(Call<Success> call, Throwable t) {
showErrorDialog();
}
});
}
Aggregations