use of org.robobinding.itempresentationmodel.ItemContext in project RoboBinding by RoboBinding.
the class DataSetAdapter method updateItemPresentationModel.
private void updateItemPresentationModel(View view, int position) {
ViewTag<RefreshableItemPresentationModel> viewTag = viewTags.tagFor(view);
RefreshableItemPresentationModel itemPresentationModel = viewTag.get();
itemPresentationModel.updateData(getItem(position), new ItemContext(view, position));
refreshIfRequired(itemPresentationModel);
}
use of org.robobinding.itempresentationmodel.ItemContext in project RoboBinding by RoboBinding.
the class DataSetAdapter method newView.
private View newView(int position, ViewGroup parent, DisplayType displayType) {
BindableView bindableView;
Object item = getItem(position);
if (displayType == DisplayType.ITEM_LAYOUT) {
int layoutId = itemLayoutSelector.selectLayout(getItemViewType(position));
bindableView = itemLayoutBinder.inflate(parent, layoutId);
} else {
bindableView = dropdownLayoutBinder.inflate(parent, dropdownLayoutId);
}
View view = bindableView.getRootView();
RefreshableItemPresentationModel itemPresentationModel = dataSetValueModel.newRefreshableItemPresentationModel(getItemViewType(position));
itemPresentationModel.updateData(item, new ItemContext(view, position));
bindableView.bindTo((AbstractPresentationModelObject) itemPresentationModel);
ViewTag<RefreshableItemPresentationModel> viewTag = viewTags.tagFor(view);
viewTag.set(itemPresentationModel);
return view;
}
use of org.robobinding.itempresentationmodel.ItemContext in project RoboBinding by RoboBinding.
the class DataSetAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder viewHolder, int position) {
View view = viewHolder.itemView;
ViewTag<RefreshableItemPresentationModel> viewTag = viewTags.tagFor(view);
RefreshableItemPresentationModel itemPresentationModel = viewTag.get();
itemPresentationModel.updateData(getItem(position), new ItemContext(view, position));
if (viewHolder.isNewView()) {
viewHolder.bindView();
} else {
refreshIfRequired(itemPresentationModel);
}
}
Aggregations