package com.jiuqi.njt.util;
import android.app.Activity;
import android.content.Context;
import android.view.View.OnClickListener;
import com.amap.api.search.core.LatLonPoint;
import com.jiuqi.mobile.nigo.comeclose.bean.app.file.CollectionBean;
import com.jiuqi.njt.R;
import com.jiuqi.njt.data.MyApp;
import com.jiuqi.njt.model.TableRawItem;
public class TableRawUtils {
/**
* 创建一个TableRawItem(不带图片)
* @param strLable
* @param strContent
* @return
*/
public static TableRawItem newTableRawItemWithOutDraw(String strLable,String strContent){
TableRawItem tableRawItem= new TableRawItem(null==strLable?"":strLable, null==strContent?"":strContent, false, 0, null);
return tableRawItem;
}
/**
* 创建一个TableRawItem(带图片)
* @param strLable
* @param strContent
* @param leftDrawable
* @param onLeftClickListener
* @return
*/
public static TableRawItem newTableRawItemWithDraw(String strLable,String strContent, int leftDrawable,
OnClickListener onLeftClickListener){
TableRawItem tableRawItem= new TableRawItem(null==strLable?"":strLable, null==strContent?"":strContent, true, leftDrawable, onLeftClickListener);
return tableRawItem;
}
/**
* 创建一个TableRawItem(带电话按钮和事件)
* @param context
* @param strLable
* @param strContent
* @param phoneNumber
* @return
*/
public static TableRawItem newTableRawItemWithPhoneDraw(Context context,String strLable,String strContent){
TableRawItem tableRawItem= new TableRawItem(null==strLable?"":strLable, null==strContent?"":strContent, true, R.drawable.poi_phone_new, new PoneImageClick(context, null==strContent?"":strContent));
return tableRawItem;
}
/**
* 创建一个TableRawItem(带导航按钮和事件)
* @param context
* @param strLable
* @param strContent
* @param startPoint
* @param endPoint
* @return
*/
public static TableRawItem newTableRawItemWithMapDraw(Context context,String strLable,String strContent,LatLonPoint startPoint,LatLonPoint endPoint){
TableRawItem tableRawItem= new TableRawItem(null==strLable?"":strLable, null==strContent?"":strContent, true,R.drawable.poi_daohang_new, new NavigationImageClick(context, startPoint, endPoint));
return tableRawItem;
}
/**
* 创建一个TableRawItem(带收藏按钮和事件)
* @param context
* @param strLable
* @param strContent
* @param bean
* @return
*/
public static TableRawItem newTableRawItemWithAddFavorDraw(Activity context,String strLable,String strContent,Boolean favorOrNot ,CollectionBean bean){
TableRawItem tableRawItem = null;
if(((MyApp) context.getApplication()).getIsLogin()) //先判断用户是否登陆
{
tableRawItem= new TableRawItem(null==strLable?"":strLable, null==strContent?"":strContent,true,favorOrNot == true ?R.drawable.poi_shoucang_new_pressed:R.drawable.poi_shoucang_new, new FavorImageClick(context, bean,favorOrNot));
}
else
{
tableRawItem= new TableRawItem(null==strLable?"":strLable, null==strContent?"":strContent, false,R.drawable.shoucang, new FavorImageClick(context, bean,favorOrNot));
}
return tableRawItem;
}
}