com.drismo.gui.quickaction
Class QuickActionAdapter

java.lang.Object
  extended by android.widget.BaseAdapter
      extended by com.drismo.gui.quickaction.QuickActionAdapter
All Implemented Interfaces:
android.widget.Adapter, android.widget.ListAdapter, android.widget.SpinnerAdapter

public class QuickActionAdapter
extends android.widget.BaseAdapter

BaseAdapter class to handle and set the layout and content of the whole archive list.
Arrays with filenames, durations and timestamp should be sorted correctly in relation to each other, before they are shipped to this class.

See Also:
ViewArchive

Nested Class Summary
(package private) static class QuickActionAdapter.ViewHolder
          Inner class of QuickActionAdapter, to store the TextView with the filename.
 
Field Summary
private  android.content.Context c
           
private  java.lang.String[] data
           
private  java.lang.String[] duration
           
private  android.view.LayoutInflater mInflater
           
private  java.lang.String[] timestamp
           
 
Fields inherited from interface android.widget.Adapter
IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
 
Constructor Summary
QuickActionAdapter(android.content.Context context)
          When constructing the QuickActionAdapter, get the LayoutInflater to populate the ListView with the archive items as specified in the xml.
 
Method Summary
 int getCount()
          Get the count of the data array, to determine how many trip files we have in the archive.
 java.lang.Object getItem(int item)
          Get filename for a specific trip, based on where it is in the sort order.
 long getItemId(int position)
          Unused function, but implemented as required for BaseAdapter.
 android.view.View getView(int position, android.view.View convertView, android.view.ViewGroup parent)
          Build the content for each list element in the archive.
 void setData(java.lang.String[] data)
          Set the array with all the file names for the trips in the archive.
 void setDuration(java.lang.String[] dura)
          Set the array with converted duration strings for the trips in the archive.
 void setTimestamp(java.lang.String[] ts)
          Set the array with all the timestamps for the trips in the archive.
 
Methods inherited from class android.widget.BaseAdapter
areAllItemsEnabled, getDropDownView, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mInflater

private android.view.LayoutInflater mInflater

data

private java.lang.String[] data

timestamp

private java.lang.String[] timestamp

duration

private java.lang.String[] duration

c

private android.content.Context c
Constructor Detail

QuickActionAdapter

public QuickActionAdapter(android.content.Context context)
When constructing the QuickActionAdapter, get the LayoutInflater to populate the ListView with the archive items as specified in the xml.

Parameters:
context - Context to get the LayoutInflater from.
Method Detail

setData

public void setData(java.lang.String[] data)
Set the array with all the file names for the trips in the archive.

Parameters:
data - A string array containing the file names for all the stored trips.

setTimestamp

public void setTimestamp(java.lang.String[] ts)
Set the array with all the timestamps for the trips in the archive.

Parameters:
ts - Array with timestamps for all the archive files.

setDuration

public void setDuration(java.lang.String[] dura)
Set the array with converted duration strings for the trips in the archive.

Parameters:
dura - Array with duration information for archive files.

getCount

public int getCount()
Get the count of the data array, to determine how many trip files we have in the archive.

Returns:
Trip file count

getItem

public java.lang.Object getItem(int item)
Get filename for a specific trip, based on where it is in the sort order.

Parameters:
item - Trip position in the sort order.
Returns:
Filename for the requested trip.

getItemId

public long getItemId(int position)
Unused function, but implemented as required for BaseAdapter.

Parameters:
position - Integer
Returns:
The parameter value

getView

public android.view.View getView(int position,
                                 android.view.View convertView,
                                 android.view.ViewGroup parent)
Build the content for each list element in the archive.

Parameters:
position - The element's position in the list.
convertView - A view holding the list item layout, filled with content.
parent - The parent that this view will be attached to.
Returns:
A view with the layout and data for the specific position in the list.