Skip to content

Instantly share code, notes, and snippets.

@jpotts18
Created October 7, 2013 03:05
Show Gist options
  • Save jpotts18/6862002 to your computer and use it in GitHub Desktop.
Save jpotts18/6862002 to your computer and use it in GitHub Desktop.
private int TYPE_MESSAGE = 1;
private int TYPE_ACTIVITY = 2;
private int TYPE_MEAL = 3;
private int TYPE_DRINK = 5
private int TYPE_DAILY_INPUT = 4;
@SuppressWarnings("unchecked")
public TimeLineAdapter(Context mContext, int textViewResourceId, List<TimelineObject> timelineList, DailyInput dailyInput) {
super(mContext, textViewResourceId, timelineList);
this.timelineList = timelineList;
this.dailyInput = dailyInput;
this.mContext = mContext;
}
@Override
public int getItemViewType(int position) {
int typeId = 0;
if(timelineList.get(position) instanceof Message){
typeId = TYPE_MESSAGE;
}
if(timelineList.get(position) instanceof PhysicalActivity){
typeId = TYPE_ACTIVITY;
}
if(timelineList.get(position) instanceof GetOnlyMeal){
typeId = TYPE_MEAL;
}
if(timelineList.get(position) instanceof Hydration){
typeId = TYPE_DRINK;
}
return typeId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment