diff -r 4feced261c68 -r de822cd3df3a project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/TextImageAdapter.java --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/TextImageAdapter.java Tue Jan 21 22:38:13 2014 +0100 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/TextImageAdapter.java Tue Jan 21 22:43:06 2014 +0100 @@ -35,40 +35,40 @@ public class TextImageAdapter extends SimpleAdapter { - private Context context; - private ArrayList> data; - - public TextImageAdapter(Context _context, ArrayList> _data, int resource, String[] from, int[] to) { - super(_context, _data, resource, from, to); - context = _context; - data = _data; - } - - public static TextImageAdapter createAdapter(Context c, String[] txt, String[] img, String[] from, int[] to){ - if(txt.length != img.length) throw new IllegalArgumentException("txt and img parameters not equal"); - - ArrayList> data = new ArrayList>(txt.length); - - for(int i = 0; i < txt.length; i++){ - HashMap map = new HashMap(); - map.put("txt", txt[i]); - map.put("img", BitmapFactory.decodeFile(img[i])); - data.add(map); - } - return new TextImageAdapter(c, data, R.layout.spinner_textimg_entry, from, to); - } + private Context context; + private ArrayList> data; + + public TextImageAdapter(Context _context, ArrayList> _data, int resource, String[] from, int[] to) { + super(_context, _data, resource, from, to); + context = _context; + data = _data; + } + + public static TextImageAdapter createAdapter(Context c, String[] txt, String[] img, String[] from, int[] to){ + if(txt.length != img.length) throw new IllegalArgumentException("txt and img parameters not equal"); + + ArrayList> data = new ArrayList>(txt.length); - public View getView(int position, View convertView, ViewGroup parent){ - if(convertView == null){ - LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - convertView = inflater.inflate(R.layout.spinner_textimg_entry, parent); - } - TextView tv = (TextView) convertView.findViewById(R.id.spinner_txt); - ImageView img = (ImageView) convertView.findViewById(R.id.spinner_img); - - tv.setText((String)data.get(position).get("txt")); - img.setImageBitmap((Bitmap)data.get(position).get("img")); - - return convertView; - } + for(int i = 0; i < txt.length; i++){ + HashMap map = new HashMap(); + map.put("txt", txt[i]); + map.put("img", BitmapFactory.decodeFile(img[i])); + data.add(map); + } + return new TextImageAdapter(c, data, R.layout.spinner_textimg_entry, from, to); + } + + public View getView(int position, View convertView, ViewGroup parent){ + if(convertView == null){ + LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + convertView = inflater.inflate(R.layout.spinner_textimg_entry, parent); + } + TextView tv = (TextView) convertView.findViewById(R.id.spinner_txt); + ImageView img = (ImageView) convertView.findViewById(R.id.spinner_img); + + tv.setText((String)data.get(position).get("txt")); + img.setImageBitmap((Bitmap)data.get(position).get("img")); + + return convertView; + } }