diff options
Diffstat (limited to 'src/net/cbaines/suma/POIArrayAdapter.java')
-rw-r--r-- | src/net/cbaines/suma/POIArrayAdapter.java | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/net/cbaines/suma/POIArrayAdapter.java b/src/net/cbaines/suma/POIArrayAdapter.java index e35acf4..f9b5271 100644 --- a/src/net/cbaines/suma/POIArrayAdapter.java +++ b/src/net/cbaines/suma/POIArrayAdapter.java @@ -21,7 +21,6 @@ package net.cbaines.suma; import java.util.List; - import android.content.Context; import android.view.View; import android.view.ViewGroup; @@ -29,51 +28,52 @@ import android.widget.BaseAdapter; public class POIArrayAdapter extends BaseAdapter { - private final Context context; - private final List<POI> POIs; - - public POIArrayAdapter(Context context, List<POI> pois) { - this.context = context; - this.POIs = pois; - } + private final Context context; + private final List<? extends POI> POIs; - public View getView(int position, View convertView, ViewGroup parent) { - POIView poiView; - if (convertView == null) { - if (POIs.get(position).distTo == -1) { - poiView = new POIView(context, POIs.get(position)); - } else { - poiView = new POIView(context, POIs.get(position), POIs.get(position).distTo); - } - } else { - poiView = (POIView) convertView; - if (POIs.get(position).distTo == -1) { - poiView = new POIView(context, POIs.get(position)); - } else { - poiView = new POIView(context, POIs.get(position), POIs.get(position).distTo); - } + public POIArrayAdapter(Context context, List<? extends POI> pois) { + this.context = context; + this.POIs = pois; } - return poiView; - } + public View getView(int position, View convertView, ViewGroup parent) { + POIView poiView; + POI poi = POIs.get(position); + if (convertView == null) { + if (poi.distTo == -1) { + poiView = new POIView(context, poi); + } else { + poiView = new POIView(context, poi, poi.distTo); + } + } else { + poiView = (POIView) convertView; + if (((POI) POIs.get(position)).distTo == -1) { + poiView = new POIView(context, poi); + } else { + poiView = new POIView(context, poi, poi.distTo); + } + } - public int getCount() { - return POIs.size(); - } + return poiView; + } - public Object getItem(int position) { - return position; - } + public int getCount() { + return POIs.size(); + } - public POI getPOIItem(int position) { - return POIs.get(position); - } + public Object getItem(int position) { + return position; + } - public long getItemId(int position) { - return position; - } + public POI getPOIItem(int position) { + return (POI) POIs.get(position); + } + + public long getItemId(int position) { + return position; + } - public String getItemStringId(int position) { - return POIs.get(position).id; - } + public String getItemStringId(int position) { + return ((POI) POIs.get(position)).id; + } }
\ No newline at end of file |