Пример #1
0
  public static void loadPageForTopic(int n2, int n3, final Callback<List<Article>> callback) {
    HashMap<String, String> hashMap = new HashMap<String, String>();
    hashMap.put("sort", "ordered");
    hashMap.put("per_page", "50");
    hashMap.put("page", String.valueOf(n3));
    Article.doGet(
        Article.apiPath("/topics/%d/articles.json", n2),
        hashMap,
        new RestTaskCallback(callback) {

          @Override
          public void onComplete(JSONObject jSONObject) throws JSONException {
            callback.onModel(BaseModel.deserializeList(jSONObject, "articles", Article.class));
          }
        });
  }
Пример #2
0
  public static RestTask loadInstantAnswers(
      String string2, final Callback<List<BaseModel>> callback) {
    HashMap<String, String> hashMap = new HashMap<String, String>();
    hashMap.put("per_page", "3");
    hashMap.put("forum_id", String.valueOf(Article.getConfig().getForumId()));
    hashMap.put("query", string2);
    if (Article.getConfig().getTopicId() != -1) {
      hashMap.put("topic_id", String.valueOf(Article.getConfig().getTopicId()));
    }
    return Article.doGet(
        Article.apiPath("/instant_answers/search.json", new Object[0]),
        hashMap,
        new RestTaskCallback(callback) {

          @Override
          public void onComplete(JSONObject jSONObject) throws JSONException {
            callback.onModel(BaseModel.deserializeHeterogenousList(jSONObject, "instant_answers"));
          }
        });
  }