package com.moms.android.client.net;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
public class MomsSearchMember
{
private Context mContext = null;
private JSONObject jsonObj = null;
public MomsSearchMember(Context context)
{
mContext = context;
}
public void setJson(JSONObject jsonObj)
{
this.jsonObj = jsonObj;
}
public String getId() throws JSONException
{
return jsonObj.getString("list_id");
}
public String getNickname() throws JSONException
{
return jsonObj.getString("list_nick");
}
public byte[] getProfile() throws JSONException
{
String profileImageName = null;
profileImageName = jsonObj.getString("list_profile");
if(profileImageName==null) {
return null;
}
//
if(profileImageName.equals("")) {
return null;
} else {
return downloadProfileImageNoSave(profileImageName);
}
}
public byte[] downloadProfileImageNoSave(String filename)
{
byte[] bytes = null;
try
{
URL profile_image_url = null;
ImageManager im = new ImageManager(mContext);
String imageDir = "http://www.moms.kr"+filename;
profile_image_url = new URL(imageDir);
String[] values = filename.split("/");
if (filename.equals("") || values.length < 1)
{
bytes = null;
}
else
{
bytes = im.DownloadByteFromUrlNoSave(profile_image_url, values[values.length - 1]);
if (bytes == null)
{
bytes = im.loadSavedProfileImageBytes(values[values.length - 1]);
}
}
}
catch (MalformedURLException e)
{
bytes = null;
}
catch (IOException e)
{
bytes = null;
}
return bytes;
}
public String getIntro() throws JSONException
{
return jsonObj.getString("intro");
}
public int getTalkCount() throws JSONException
{
return jsonObj.getInt("talk_count");
}
public int getFriendCount() throws JSONException
{
return jsonObj.getInt("fri_count");
}
public int getRelation() throws JSONException
{
return jsonObj.getInt("relation");
}
public int getTimeStamp() throws JSONException
{
return jsonObj.getInt("reg_ts");
}
}
|