Android Open Source - isidore Droplet Image






From Project

Back to project page isidore.

License

The source code is released under:

GNU General Public License

If you think the Android project isidore 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.tbardici.isidore;
/*w  w w  .ja  v a 2 s . com*/
import java.util.ArrayList;

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

/**
 * 
 * @author Teo
 *
 */
public class DropletImage {
  
  public final int id;
  public final String name;
  public final String distribution;
  public final boolean is_public; 
  
  private static ArrayList<DropletImage> images = new ArrayList<DropletImage>();
  private static String rawJson;
  
  public DropletImage(JSONObject from) throws JSONException{
    this.id =         from.getInt("id");
    this.name =       from.getString("name");
    this.distribution =   from.getString("distribution");
    this.is_public =     from.getBoolean("public");
  }
  
  public static void initialize(JSONObject obj) throws JSONException{
    DropletImage.images = new ArrayList<DropletImage>();
    if (obj != null){
      DropletImage.rawJson = obj.toString();
      JSONArray array = obj.getJSONArray("images");
      
      for (int i = 0; i < array.length(); i++){
        DropletImage.images.add(new DropletImage(array.getJSONObject(i)));
      }
    }
  }
  
  public static DropletImage getWithId(int id){
    for (int i = 0; i < DropletImage.images.size(); i++){
      if (DropletImage.images.get(i).id == id){
        return DropletImage.images.get(i);
      }
    }
    return null;
  }
  
  public static ArrayList<DropletImage> getImages(){
    return DropletImage.images;
  }
  
  public static String getRawJson(){
    return DropletImage.rawJson;
  }
  
  @Override
  public String toString() {
    // TODO Auto-generated method stub
    return name;
  }
}




Java Source Code List

com.tbardici.isidore.CallDOApiAsync.java
com.tbardici.isidore.CreateDropletActivity.java
com.tbardici.isidore.DCConfirmDialogFragment.java
com.tbardici.isidore.DOApi.java
com.tbardici.isidore.DrawablePreviewActivity.java
com.tbardici.isidore.DropletImage.java
com.tbardici.isidore.DropletListAdapter.java
com.tbardici.isidore.DropletType.java
com.tbardici.isidore.IsidoreSettings.java
com.tbardici.isidore.ItemDetailActivity.java
com.tbardici.isidore.ItemDetailFragment.java
com.tbardici.isidore.ItemListActivity.java
com.tbardici.isidore.ItemListFragment.java
com.tbardici.isidore.LoadDropletsAsync.java
com.tbardici.isidore.LongDurationCall.java
com.tbardici.isidore.MainActivity.java
com.tbardici.isidore.Region.java
com.tbardici.isidore.droplet.MyDroplets.java