package com.mzeat.ui.adapter; import java.util.ArrayList; import java.util.Map; import com.mzeat.R; import com.mzeat.util.SmileyParser.Smileys; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; public class FaceGridViewAdapter extends BaseAdapter { private Context xContext; int[] faces ; public static final int DEFAULT_SMILEY_TEXTS = R.array.default_smiley_texts; protected ArrayList<Map<String,Integer>> mDatas; public FaceGridViewAdapter(Context c) { this.xContext = c; mInflater = (LayoutInflater) c .getSystemService(Context.LAYOUT_INFLATER_SERVICE); faces = Smileys.sIconIds; } private LayoutInflater mInflater; @Override public int getCount() { return faces.length; } @Override public Object getItem(int position) { return faces[position]; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { GridHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.team_layout_single_expression_cell, null); holder = new GridHolder(); holder.cImage = (ImageView) convertView.findViewById(R.id.image); convertView.setTag(holder); } else { holder = (GridHolder) convertView.getTag(); } holder.cImage.setBackgroundResource(faces[position]); return convertView; } private class GridHolder { ImageView cImage; } }