Exemplo n.º 1
0
  public void sendRideRequest() {
    try {
      homeCallbacks.showProgress(true, R.string.loading_loading);
      // showProgress(true, R.string.loading_loading);
      // AppTripsSet tripsSet = DataStore.getInstance().getSearchTripSet();

      AppArea orig = DataStore.getInstance().getAreaById(trip.getOriginId());
      AppArea dest = DataStore.getInstance().getAreaById(trip.getDestId());
      String destId = "-1";
      String origId = "-1";
      if (orig != null) origId = orig.getId();
      if (dest != null) destId = dest.getId();

      // if(tripsSet != null){
      destId = trip.getDestId(); // tripsSet.getToAreaSet();
      origId = trip.getOriginId(); // tripsSet.getFromAreaSet();
      // }

      DataStore.getInstance().sendRideRequest(origId, destId, trip.getId(), callbackRequestRide);
      //			Intent i = new Intent(this, ConversationActivity.class);
      //			i.putExtra("contact", trip.getUser().getJsonString());
      //			startActivity(i);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
        @Override
        public void onDataReady(ServerResult data, boolean success) {
          homeCallbacks.showProgress(false, 0);
          if (success) {
            if (data.getFlag().equals("0")) {
              // btnSendRequest.setVisibility(View.GONE);
              btnSendRequest.setAlpha(0.4f);
              btnSendRequest.setEnabled(false);
              homeCallbacks.showToast(getString(R.string.main_ride_request_sent_successfuly));

            } else if (data.getFlag().equals(ServerAccess.ERROR_CODE_BOOKKED_BEFORE))
              homeCallbacks.showToast(getString(R.string.main_ride_request_sent_before));

          } else {
            homeCallbacks.showToast(getString(R.string.error_connection_failed));
          }
        }