| 198 | } |
| 199 | |
| 200 | private List<Item> getList(String id, boolean filter) { |
| 201 | try { |
| 202 | String key = id.contains("/") ? id.substring(0, id.indexOf("/")) : id; |
| 203 | String path = id.contains("/") ? id.substring(id.indexOf("/")) : ""; |
| 204 | Drive drive = getDrive(key); |
| 205 | path = path.startsWith(drive.getPath()) ? path : drive.getPath() + path; |
| 206 | JSONObject params = new JSONObject(); |
| 207 | params.put("path", path); |
| 208 | params.put("password", drive.findPass(path)); |
| 209 | String response = post(drive, drive.listApi(), params.toString()); |
| 210 | List<Item> items = Item.arrayFrom(getListJson(drive.isNew(), response)); |
| 211 | Iterator<Item> iterator = items.iterator(); |
| 212 | if (filter) while (iterator.hasNext()) if (iterator.next().ignore(drive.isNew())) iterator.remove(); |
| 213 | return items; |
| 214 | } catch (Exception e) { |
| 215 | return Collections.emptyList(); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | private String getListJson(boolean isNew, String response) throws JSONException { |
| 220 | if (isNew) { |