public static void fillChapters(MangaSeries series) throws IOException, MangaException { if (series == null) return; final String response = Http.get(CHAPTER_LIST_URL + series.id); try { series.fromJson(new JSONObject(response)); } catch (JSONException e) { throw new MangaException(e); } }
public static List<MangaSeries> getMangaSeries() throws IOException, MangaException { final String response = Http.get(MANGA_LIST_URL); try { JSONArray series = new JSONObject(response).getJSONArray(KEY_MANGA); if (series != null && series.length() > 0) { final List<MangaSeries> retval = new ArrayList<MangaSeries>(series.length()); for (int i = 0, len = series.length(); i < len; i++) { MangaSeries mangaSeries = new MangaSeries(); mangaSeries.fromJson(series.getJSONObject(i)); retval.add(mangaSeries); } return retval; } } catch (JSONException e) { throw new MangaException(e); } return null; }