Пример #1
0
  @Override
  public void onCostResult(String cost) {

    model.cost = cost;

    Intent intent = new Intent(mContext, OrderConfirmActivity.class);
    intent.putExtra(Extras.BOOKING_TYPE, Constant.BOOK_TYPE_SHOPPING);
    intent.putExtra(Extras.BOOKING_INFO, model);
    startActivity(intent);
  }
Пример #2
0
  private boolean validInput() {

    model.shopDetails = edtShopDetails.getText().toString().trim();
    model.locationDetails = edtLocationDetails.getText().toString().trim();
    model.items = edtItems.getText().toString().trim();
    model.cost = edtCost.getText().toString().trim();
    if (model.driverToken == null || model.driverToken.isEmpty()) {
      model.driverToken = "";
    }

    if (model.latFrom == 0 || model.lngFrom == 0) {

      Snackbar.make(
              findViewById(R.id.tab_container),
              getString(R.string.snackbar_picklocationfrom),
              Snackbar.LENGTH_SHORT)
          .show();
      tvAddressFrom.setError("");
      return false;
    }
    if (model.latTo == 0 || model.lngTo == 0) {

      Snackbar.make(
              findViewById(R.id.tab_container),
              getString(R.string.snackbar_picklocationto),
              Snackbar.LENGTH_SHORT)
          .show();
      tvAddressTo.setError("");
      return false;
    }
    if (model.items.isEmpty()) {
      edtItems.setError(getText(R.string.error_itemsempty));
      return false;
    }
    if (model.cost.isEmpty()) {
      edtCost.setError(getText(R.string.error_costempty));
      return false;
    }

    return true;
  }