@Override public void getSingleBillTask(BillTaskResponse singleBillResponse) { HttpStatus code = singleBillResponse.code; String error = singleBillResponse.error; if (StatusCode.isOk(code)) { bill = singleBillResponse.bills; etTitle.setText(bill[0].getTitle()); etAmount.setText(bill[0].getAmount()); etDate.setText(bill[0].getDate()); etNotes.setText(bill[0].getNotes()); for (int i = 0; i < categories.length; i++) { if (bill[0].getCategory().equals(categories[i])) { spCategory.setSelection(i); break; } } paymentType = bill[0].getPaymentType(); setPaymentType(paymentType); } else if (StatusCode.isUnauthorised(code)) { APIConnect.UpdateToken(this); prepareToModify(); } else if (StatusCode.isBadRequest(code)) { Toast.makeText(manage_bill.this, error, Toast.LENGTH_SHORT).show(); } }
@Override public void setBillToOverdue(BillTaskResponse updateToOverdue) { HttpStatus code = updateToOverdue.code; String error = updateToOverdue.error; if (StatusCode.isUnauthorised(code)) { APIConnect.UpdateToken(this); checkForOverdueBills(); } else if (StatusCode.isBadRequest(code)) { Toast.makeText(this, error, Toast.LENGTH_SHORT).show(); } }
@Override public void updateBillTask(BillTaskResponse updateTaskResponse) { HttpStatus code = updateTaskResponse.code; String error = updateTaskResponse.error; if (StatusCode.isOk(code)) { Toast.makeText(manage_bill.this, AppConfig.BILL_UPDATED, Toast.LENGTH_SHORT).show(); finish(); } else if (StatusCode.isUnauthorised(code)) { APIConnect.UpdateToken(this); updateBill(); } else if (StatusCode.isBadRequest(code)) { Toast.makeText(manage_bill.this, error, Toast.LENGTH_SHORT).show(); } }