use of android.support.v7.widget.RecyclerView.ViewHolder in project ChipsLayoutManager by BelooS.
the class RecyclerViewAdapter method onCreateViewHolder.
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
switch(viewType) {
case ITEM_TYPE_INCREASED:
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_increased, parent, false);
break;
default:
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_simple, parent, false);
break;
}
viewHolderCount++;
// Timber.w(TAG, "created holders = " + viewHolderCount);
return new ViewHolder(itemView);
}
use of android.support.v7.widget.RecyclerView.ViewHolder in project Douya by DreaminginCodeZH.
the class SingleBroadcastAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final Broadcast broadcast = mBroadcast;
holder.broadcastLayout.bindBroadcast(broadcast);
holder.broadcastLayout.setListener(new BroadcastLayout.Listener() {
@Override
public void onLikeClicked() {
mListener.onLike(broadcast, !broadcast.isLiked);
}
@Override
public void onRebroadcastClicked() {
mListener.onRebroadcast(broadcast, !broadcast.isRebroadcasted());
}
@Override
public void onCommentClicked() {
mListener.onComment(broadcast);
}
});
holder.viewActivityButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mListener.onViewActivity(broadcast);
}
});
}
use of android.support.v7.widget.RecyclerView.ViewHolder 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);
}
use of android.support.v7.widget.RecyclerView.ViewHolder in project Douya by DreaminginCodeZH.
the class BaseUserAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final Context context = RecyclerViewUtils.getContext(holder);
final SimpleUser user = getItem(position);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
context.startActivity(ProfileActivity.makeIntent(user, context));
}
});
ImageUtils.loadAvatar(holder.avatarImage, user.avatar);
holder.nameText.setText(user.name);
//noinspection deprecation
holder.descriptionText.setText(user.uid);
}
use of android.support.v7.widget.RecyclerView.ViewHolder in project Douya by DreaminginCodeZH.
the class NotificationAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final Context context = RecyclerViewUtils.getContext(holder);
final Notification notification = getItem(position);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mListener != null) {
mListener.onMarkNotificationAsRead(notification);
}
UriHandler.open(notification.targetUri, context);
}
});
holder.textText.setText(notification.text);
holder.textText.setTextColor(notification.read ? mTextColorSecondary : mTextColorPrimary);
holder.timeText.setDoubanTime(notification.time);
}
Aggregations