Android Open Source - android_google_image_searcher Image Util






From Project

Back to project page android_google_image_searcher.

License

The source code is released under:

GNU General Public License

If you think the Android project android_google_image_searcher 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.github.snambi.googleimagesearcher;
/*from  ww  w  .  ja  va 2s .  co  m*/
import org.json.JSONException;
import org.json.JSONObject;

public class ImageUtil {
  
  public static Image convertJsonToImage( JSONObject json ) throws JSONException{
    Image image = new Image();
    
    if( json != null ){
      if( !json.isNull("content")){
        image.setContent(json.getString("content"));
      }
      if( !json.isNull("contentNoFormatting")){
        image.setContentNoFormatting(json.getString("contentNoFormatting"));
      }
      if( !json.isNull("url")){
        image.setUrl( json.getString("url"));
      }
      if( !json.isNull("height")){
        image.setHeight(json.getInt("height"));
      }
      if( !json.isNull("imageId")){
        image.setId(json.getString("imageId"));
      }
      if( !json.isNull("tbHeight")){
        image.setThumbHeight(json.getInt("tbHeight"));
      }
      if( !json.isNull("tbUrl")){
        image.setThumbUrl(json.getString("tbUrl"));
      }
      if( !json.isNull("tbWidth")){
        image.setThumbWidth(json.getInt("tbWidth"));
      }
      if( !json.isNull("title")){
        image.setTitle( json.getString("title"));
      }
      if( !json.isNull("titleNoFormatting")){
        image.setTitleNoFormatting(json.getString("titleNoFormatting"));
      }
      if( !json.isNull("unescapedUrl")){
        image.setUnescapedUrl(json.getString("unescapedUrl"));
      }
      if( !json.isNull("visibleUrl")){
        image.setVisibleUrl(json.getString("visibleUrl"));
      }
      if( !json.isNull("width")){
        image.setWidth(json.getInt("width"));
      }
    }
    return image;
  }

}




Java Source Code List

com.github.snambi.googleimagesearcher.AndroidUtils.java
com.github.snambi.googleimagesearcher.EndlessScrollListener.java
com.github.snambi.googleimagesearcher.FullScreenActivity.java
com.github.snambi.googleimagesearcher.GoogleImageAdapter.java
com.github.snambi.googleimagesearcher.GoogleImageClient.java
com.github.snambi.googleimagesearcher.ImageUtil.java
com.github.snambi.googleimagesearcher.Image.java
com.github.snambi.googleimagesearcher.SearchActivity.java
com.github.snambi.googleimagesearcher.SettingsActivity.java
com.github.snambi.googleimagesearcher.SettingsDialog.java
com.github.snambi.googleimagesearcher.SettingsFragmentActivity.java
com.github.snambi.googleimagesearcher.SquareImage.java