コード例 #1
0
 private void search() {
   Long id = null;
   if (selectedEventType != null) id = selectedEventType.getId();
   InTouchServerEvent.search(
       checkSearchAdditionalField(R.id.event_city),
       checkSearchField(),
       id,
       onSearchInTouchCallback());
   ((SwipeRefreshLayout) rootView.findViewById(R.id.events_refresh_layout)).setRefreshing(true);
 }
コード例 #2
0
  private void downloadEventTypes() {
    InTouchServerEvent.getTypes(
        new InTouchCallback() {
          @Override
          public void onSuccess(JsonObject result) {
            Gson gson = new Gson();
            JsonArray eventTypesJsonElements =
                gson.fromJson(result.get("EventTypes").getAsString(), JsonArray.class);
            for (int i = 0; i < eventTypesJsonElements.size(); i++)
              eventTypes.add(
                  gson.fromJson(eventTypesJsonElements.get(i).getAsJsonObject(), EventType.class));
          }

          @Override
          public void onError(String error) {
            Toast.makeText(
                    InTouchApi.getContext(), "Cant load event types:" + error, Toast.LENGTH_SHORT)
                .show();
          }
        });
  }