Esempio n. 1
0
  public static void loadTopic(int n2, final Callback<Topic> callback) {
    Topic.doGet(
        Topic.apiPath("/topics/%d.json", n2),
        new RestTaskCallback(callback) {

          @Override
          public void onComplete(JSONObject jSONObject) throws JSONException {
            callback.onModel(BaseModel.deserializeObject(jSONObject, "topic", Topic.class));
          }
        });
  }
Esempio n. 2
0
  public static void loadTopics(final Callback<List<Topic>> callback) {
    Topic.doGet(
        Topic.apiPath("/topics.json", new Object[0]),
        new RestTaskCallback(callback) {

          @Override
          public void onComplete(JSONObject object) throws JSONException {
            Object object2 = BaseModel.deserializeList((JSONObject) object, "topics", Topic.class);
            object = new ArrayList(object2.size());
            object2 = object2.iterator();
            while (object2.hasNext()) {
              Topic topic = (Topic) object2.next();
              if (topic.getNumberOfArticles() <= 0) continue;
              object.add(topic);
            }
            callback.onModel(object);
          }
        });
  }