public abstract class MonthAdapter extends BaseAdapter implements MonthView.OnDayClickListener
MonthView
items.Modifier and Type | Class and Description |
---|---|
static class |
MonthAdapter.CalendarDay
A convenience class to represent a specific date.
|
Modifier and Type | Field and Description |
---|---|
protected DatePickerController |
mController |
protected static int |
MONTHS_IN_YEAR |
protected static int |
WEEK_7_OVERHANG_HEIGHT |
IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
Constructor and Description |
---|
MonthAdapter(Context context,
DatePickerController controller) |
Modifier and Type | Method and Description |
---|---|
abstract MonthView |
createMonthView(Context context) |
int |
getCount()
How many items are in the data set represented by this Adapter.
|
Object |
getItem(int position)
Get the data item associated with the specified position in the data set.
|
long |
getItemId(int position)
Get the row id associated with the specified position in the list.
|
MonthAdapter.CalendarDay |
getSelectedDay() |
View |
getView(int position,
View convertView,
ViewGroup parent)
Get a View that displays the data at the specified position in the data set.
|
boolean |
hasStableIds()
Indicates whether the item ids are stable across changes to the
underlying data.
|
protected void |
init()
Set up the gesture detector and selected time
|
void |
onDayClick(MonthView view,
MonthAdapter.CalendarDay day) |
protected void |
onDayTapped(MonthAdapter.CalendarDay day)
Maintains the same hour/min/sec but moves the day to the tapped day.
|
void |
setSelectedDay(MonthAdapter.CalendarDay day)
Updates the selected day and related parameters.
|
areAllItemsEnabled, getDropDownView, getItemViewType, getViewTypeCount, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
protected final DatePickerController mController
protected static int WEEK_7_OVERHANG_HEIGHT
protected static final int MONTHS_IN_YEAR
public MonthAdapter(Context context, DatePickerController controller)
public void setSelectedDay(MonthAdapter.CalendarDay day)
day
- The day to highlightpublic MonthAdapter.CalendarDay getSelectedDay()
protected void init()
public int getCount()
Adapter
public Object getItem(int position)
Adapter
public long getItemId(int position)
Adapter
public boolean hasStableIds()
Adapter
hasStableIds
in interface Adapter
hasStableIds
in class BaseAdapter
public View getView(int position, View convertView, ViewGroup parent)
Adapter
LayoutInflater.inflate(int, android.view.ViewGroup, boolean)
to specify a root view and to prevent attachment to the root.getView
in interface Adapter
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 Adapter.getViewTypeCount()
and
Adapter.getItemViewType(int)
).parent
- The parent that this view will eventually be attached topublic void onDayClick(MonthView view, MonthAdapter.CalendarDay day)
onDayClick
in interface MonthView.OnDayClickListener
protected void onDayTapped(MonthAdapter.CalendarDay day)
day
- The day that was tapped