Ejemplo n.º 1
0
 private void loadBills() {
   String paymentType = AppConfig.PAYABLE;
   Utilities.setAPIContext(getActivity());
   APIConnect.GetBillsTask getBillsTask = new APIConnect.GetBillsTask();
   getBillsTask.crdDelegate = this;
   getBillsTask.execute(paymentType);
 }
Ejemplo n.º 2
0
 private void updateBill() {
   Utilities.setAPIContext(manage_bill.this);
   JSONObject updateBill = getUpdateDetails();
   APIConnect.UpdateBillTask updateBillTask = new APIConnect.UpdateBillTask();
   updateBillTask.cruBill = this;
   updateBillTask.execute(updateBill);
 }
Ejemplo n.º 3
0
  @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();
    }
  }
Ejemplo n.º 4
0
  @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();
    }
  }
Ejemplo n.º 5
0
 private void restoreBill() {
   Utilities.setAPIContext(getActivity());
   APIConnect.AddBillTask addBillTask = new APIConnect.AddBillTask(deletedBill);
   addBillTask.crdDelegate = this;
   addBillTask.execute();
 }
Ejemplo n.º 6
0
 private void deleteBill() {
   Utilities.setAPIContext(getActivity());
   APIConnect.DeleteBillTask deleteTask = new APIConnect.DeleteBillTask();
   deleteTask.crdDelegate = this;
   deleteTask.execute(billId);
 }
Ejemplo n.º 7
0
 private void getSingleBill() {
   Utilities.setAPIContext(getActivity());
   APIConnect.GetSingleBill getSingleBill = new APIConnect.GetSingleBill();
   getSingleBill.crdDelegate = this;
   getSingleBill.execute(billId);
 }
Ejemplo n.º 8
0
 private void checkForOverdueBills() {
   Utilities.setAPIContext(this);
   APIConnect.UpdatePayableToOverdue toOverdue = new APIConnect.UpdatePayableToOverdue();
   toOverdue.delegate = this;
   toOverdue.execute();
 }
Ejemplo n.º 9
0
 public void prepareToModify() {
   Utilities.setAPIContext(this);
   APIConnect.GetSingleBill getSingleBill = new APIConnect.GetSingleBill();
   getSingleBill.cruDelegate = this;
   getSingleBill.execute(billId);
 }