use of me.zhanghai.android.douya.network.api.info.frodo.CollectableItem in project Douya by DreaminginCodeZH.
the class ProfileItemAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final CollectableItem item = getItem(position);
float ratio = 1;
switch(item.getType()) {
case BOOK:
case EVENT:
case MOVIE:
case TV:
ratio = 2f / 3f;
break;
}
holder.itemLayout.setRatio(ratio);
final Context context = RecyclerViewUtils.getContext(holder);
holder.itemLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// TODO
Intent intent = ItemActivities.makeIntent(item, context);
if (intent != null) {
context.startActivity(intent);
} else {
UriHandler.open(item.url, context);
}
}
});
ImageUtils.loadImage(holder.coverImage, item.cover.getLarge());
holder.titleText.setText(item.title);
// FIXME: This won't work properly if items are changed.
ViewUtils.setVisibleOrGone(holder.dividerSpace, position != getItemCount() - 1);
}
Aggregations