com.stringsandints.inventium.khlrooster
Class ImgAdaptor

java.lang.Object
  extended by BaseAdapter
      extended by com.stringsandints.inventium.khlrooster.ImgAdaptor

public class ImgAdaptor
extends BaseAdapter

This adaptor is specially created to make optimal use of the gallery and make this component on the screen as efficient as possible. The ImgAdaptor holds the data shown by the gallery but can be used by any component using a baseAdaptor.

Author:
mathias

Field Summary
private  Context ctx
           
private  int GalItemBg
           
private  LessonHour lh
           
private  java.util.HashMap<java.lang.Integer,java.lang.ref.SoftReference<Bitmap>> screen_images
           
static int THUMBNAIL_HEIGHT_DP
           
static int THUMBNAIL_WIDTH_DP
           
private  java.util.HashMap<java.lang.Integer,java.lang.ref.SoftReference<Bitmap>> thumbnails
           
 
Constructor Summary
ImgAdaptor(LessonHour lh, Context ctx)
          Every ImgAdaptor is used in combination with a LessonHour that contains the list with links to Images
 
Method Summary
 int getCount()
          Get the number of Images in the Adaptor
 Bitmap getItem(int position)
          Returns a bitmap of the position in the list
 long getItemId(int position)
          Get the Id of an item in the adaptor.
 View getView(int position, View convertView, ViewGroup parent)
          Create the view for an Item (Image) in the ImgAdaptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THUMBNAIL_HEIGHT_DP

public static final int THUMBNAIL_HEIGHT_DP
See Also:
Constant Field Values

THUMBNAIL_WIDTH_DP

public static final int THUMBNAIL_WIDTH_DP
See Also:
Constant Field Values

GalItemBg

private int GalItemBg

lh

private LessonHour lh

ctx

private Context ctx

thumbnails

private java.util.HashMap<java.lang.Integer,java.lang.ref.SoftReference<Bitmap>> thumbnails

screen_images

private java.util.HashMap<java.lang.Integer,java.lang.ref.SoftReference<Bitmap>> screen_images
Constructor Detail

ImgAdaptor

public ImgAdaptor(LessonHour lh,
                  Context ctx)
Every ImgAdaptor is used in combination with a LessonHour that contains the list with links to Images

Parameters:
lh - - the lessonHour
ctx - - Activity/Service context (normally not used within a context)
Method Detail

getCount

public int getCount()
Get the number of Images in the Adaptor

Returns:
Number of images

getItem

public Bitmap getItem(int position)
Returns a bitmap of the position in the list

Parameters:
position - - index in the list
Returns:
Bitmap-image

getItemId

public long getItemId(int position)
Get the Id of an item in the adaptor. For this adaptor, the Id is the same as the position in the list.

Returns:
id of item

getView

public View getView(int position,
                    View convertView,
                    ViewGroup parent)
Create the view for an Item (Image) in the ImgAdaptor

Parameters:
position - - The position of the item within the adapter's data set of the item whose view we want.
convertView - - The old view to reuse, if possible. Note: You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view. Heterogeneous lists can specify their number of view types, so that this View is always of the right type (see getViewTypeCount() and getItemViewType(int)).
parent - - The parent that this view will eventually be attached to
Returns:
View - The view containing an image with a width of 100 and a height of 130