Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void getShops(final String cityName, final String mallName, final SolidCallback<List<Shops>> callback){
- SolidClient solidClient = new SolidClient();
- solidClient.getShops(new Callback<GetListOfMallsResponse>() {
- @Override
- public void onResponse(Call<GetListOfMallsResponse> call, Response<GetListOfMallsResponse> response) {
- List<Shops> shops = new ArrayList<>();
- if (response.isSuccessful()) {
- for(int i = 0; i < response.body().getCities().size(); i++){
- if(response.body().getCities().get(i).getName().equals(cityName)){
- for(int j = 0; j < response.body().getCities().get(i).getMalls().size(); j++){
- if (response.body().getCities().get(i).getMalls().get(j).getName().equals(mallName)) {
- shops.addAll(response.body().getCities().get(i).getMalls().get(j).getShops());
- }
- }
- }
- }
- }
- callback.onSuccess(shops);
- }
- @Override
- public void onFailure(Call<GetListOfMallsResponse> call, Throwable t) {
- callback.onFailure(t);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement