Android Open Source - GridImageSearch Image Result






From Project

Back to project page GridImageSearch.

License

The source code is released under:

Copyright (c) 2014 Keithen Hayenga Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the So...

If you think the Android project GridImageSearch listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.codepath.gridimagesearch;
/*from  ww  w  . ja  va 2 s  . c o  m*/
import java.io.Serializable;
import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class ImageResult implements Serializable {
  /**
   * 
   */
  private static final long serialVersionUID = 882762501437330508L;
  // This will contain the images we want to display.
  // Also the routines to get JSON search results and convert to images.
  private String fullURL;
  private String thumbURL;
  
  public ImageResult(JSONObject json) {
    try {
      this.fullURL = json.getString("url");
      this.thumbURL = json.getString("tbUrl");
    } catch (JSONException e) {
      this.fullURL = null;
      this.thumbURL = null;      
    }
  }
  
  public String getFullURL() {
    return fullURL;
  }
  
  public String getThumbURL() {
    return thumbURL;
  }
  
  public String toString() {
    return this.thumbURL;
  }

  public static ArrayList<ImageResult> fromJSONArray(
      JSONArray array) {
    ArrayList<ImageResult> results = new ArrayList<ImageResult>();
    for (int x = 0; x < array.length(); x++) {
      try {
        results.add(new ImageResult(array.getJSONObject(x)));
      } catch (JSONException e) {
        e.printStackTrace();
      }
    }
    return results;
  }

}




Java Source Code List

com.codepath.gridimagesearch.EndlessScrollListener.java
com.codepath.gridimagesearch.GridSearchPrefs.java
com.codepath.gridimagesearch.ImageDisplayActivity.java
com.codepath.gridimagesearch.ImageResultArrayAdapter.java
com.codepath.gridimagesearch.ImageResult.java
com.codepath.gridimagesearch.SearchActivity.java
com.codepath.gridimagesearch.SearchOptionsActivity.java