private void loadBills() { String paymentType = AppConfig.PAYABLE; Utilities.setAPIContext(getActivity()); APIConnect.GetBillsTask getBillsTask = new APIConnect.GetBillsTask(); getBillsTask.crdDelegate = this; getBillsTask.execute(paymentType); }
private void updateBill() { Utilities.setAPIContext(manage_bill.this); JSONObject updateBill = getUpdateDetails(); APIConnect.UpdateBillTask updateBillTask = new APIConnect.UpdateBillTask(); updateBillTask.cruBill = this; updateBillTask.execute(updateBill); }
@Override public void deleteBillTask(BillTaskResponse deleteResponse) { HttpStatus code = deleteResponse.code; if (StatusCode.isOk(code)) { loadBills(); } else if (StatusCode.isUnauthorised(code)) { Utilities.setAPIContext(getActivity()); new APIConnect.UpdateTokenTask().execute(); deleteBill(); } else if (StatusCode.isBadRequest(code)) { Toast.makeText(getActivity(), deleteResponse.error, Toast.LENGTH_SHORT).show(); } else if (StatusCode.isForbidden(code)) { Toast.makeText(getActivity(), AppConfig.FORBIDDEN, Toast.LENGTH_SHORT).show(); } }
@Override public void getBillTask(BillTaskResponse billTaskResponse) { HttpStatus code = billTaskResponse.code; if (StatusCode.isOk(code)) { Utilities.showRecycler(recyclerView, layoutNoContent); getBills = billTaskResponse.bills; adapter = new PayableAdapter(getActivity(), getBills); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); } else if (StatusCode.isUnauthorised(code)) { Utilities.setAPIContext(getActivity()); new APIConnect.UpdateTokenTask().execute(); loadBills(); } else if (StatusCode.isNoContent(code)) { Utilities.showNoContentLayout(recyclerView, layoutNoContent); } else if (StatusCode.isBadRequest(code)) { Toast.makeText(getActivity(), billTaskResponse.error, Toast.LENGTH_SHORT).show(); } }
private void restoreBill() { Utilities.setAPIContext(getActivity()); APIConnect.AddBillTask addBillTask = new APIConnect.AddBillTask(deletedBill); addBillTask.crdDelegate = this; addBillTask.execute(); }
private void deleteBill() { Utilities.setAPIContext(getActivity()); APIConnect.DeleteBillTask deleteTask = new APIConnect.DeleteBillTask(); deleteTask.crdDelegate = this; deleteTask.execute(billId); }
private void getSingleBill() { Utilities.setAPIContext(getActivity()); APIConnect.GetSingleBill getSingleBill = new APIConnect.GetSingleBill(); getSingleBill.crdDelegate = this; getSingleBill.execute(billId); }
private void checkForOverdueBills() { Utilities.setAPIContext(this); APIConnect.UpdatePayableToOverdue toOverdue = new APIConnect.UpdatePayableToOverdue(); toOverdue.delegate = this; toOverdue.execute(); }
public void prepareToModify() { Utilities.setAPIContext(this); APIConnect.GetSingleBill getSingleBill = new APIConnect.GetSingleBill(); getSingleBill.cruDelegate = this; getSingleBill.execute(billId); }