Advertisement
adamdv91

Untitled

Feb 25th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. public void getShops(final String cityName, final String mallName, final SolidCallback<List<Shops>> callback){
  2. SolidClient solidClient = new SolidClient();
  3. solidClient.getShops(new Callback<GetListOfMallsResponse>() {
  4. @Override
  5. public void onResponse(Call<GetListOfMallsResponse> call, Response<GetListOfMallsResponse> response) {
  6. List<Shops> shops = new ArrayList<>();
  7. if (response.isSuccessful()) {
  8.  
  9. for(int i = 0; i < response.body().getCities().size(); i++){
  10. if(response.body().getCities().get(i).getName().equals(cityName)){
  11.  
  12. for(int j = 0; j < response.body().getCities().get(i).getMalls().size(); j++){
  13. if (response.body().getCities().get(i).getMalls().get(j).getName().equals(mallName)) {
  14. shops.addAll(response.body().getCities().get(i).getMalls().get(j).getShops());
  15. }
  16. }
  17. }
  18. }
  19. }
  20.  
  21. callback.onSuccess(shops);
  22. }
  23.  
  24. @Override
  25. public void onFailure(Call<GetListOfMallsResponse> call, Throwable t) {
  26. callback.onFailure(t);
  27. }
  28. });
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement