Search in sources :

Example 1 with ResponseData

use of com.ichi2.anki.multimediacard.googleimagesearch.json.ResponseData in project Anki-Android by Ramblurr.

the class SearchImageActivity method postFinished.

public void postFinished(ImageSearchResponse response) {
    ArrayList<String> theImages = new ArrayList<String>();
    // No loop, just a good construct to break out from
    do {
        if (response == null)
            break;
        if (response.getOk() == false)
            break;
        ResponseData rdata = response.getResponseData();
        if (rdata == null)
            break;
        List<Result> results = rdata.getResults();
        if (results == null)
            break;
        for (Result result : results) {
            if (result == null) {
                continue;
            }
            String url = result.getUrl();
            if (url != null) {
                theImages.add(url);
            }
        }
        if (theImages.size() == 0)
            break;
        proceedWithImages(theImages);
        return;
    } while (false);
    returnFailure(gtxt(R.string.multimedia_editor_imgs_no_results));
}
Also used : ResponseData(com.ichi2.anki.multimediacard.googleimagesearch.json.ResponseData) ArrayList(java.util.ArrayList) Result(com.ichi2.anki.multimediacard.googleimagesearch.json.Result)

Aggregations

ResponseData (com.ichi2.anki.multimediacard.googleimagesearch.json.ResponseData)1 Result (com.ichi2.anki.multimediacard.googleimagesearch.json.Result)1 ArrayList (java.util.ArrayList)1