Search in sources :

Example 1 with Project

use of com.byoutline.kickmaterial.model.Project in project kickmaterial by byoutline.

the class SearchAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    Project project = getItem(position);
    if (project != null) {
        ViewUtils.setText(holder.titleTv, project.getProjectName());
        ViewUtils.setText(holder.descTv, project.desc);
        Picasso.with(context).load(project.getPhotoUrl()).into(holder.photoIv);
    }
}
Also used : Project(com.byoutline.kickmaterial.model.Project)

Example 2 with Project

use of com.byoutline.kickmaterial.model.Project in project kickmaterial by byoutline.

the class ProjectsAdapter method onBindViewHolder.

// Replace the contents of a view. This is invoked by the layout manager.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    int type = getItemViewType(position);
    switch(type) {
        case NORMAL_ITEM:
        case BIG_ITEM:
            Project project = getItem(position);
            if (project != null) {
                if (holder.projectId == project.id) {
                    // This view holder appears to already show correct project.
                    return;
                } else {
                    holder.projectId = project.id;
                }
                ViewUtils.setTextForViewOrHideIt(holder.projectItemBigTitleTv, project.getProjectName());
                holder.projectItemBigProgressSb.setProgress((int) project.getPercentProgress());
                Picasso picasso = Picasso.with(context);
                final RequestCreator picassoBuilder;
                if (type == BIG_ITEM) {
                    setProjectDetailsInfo(null, holder.projectItemBigDescTv, holder.projectItemBigGatheredMoneyTv, holder.projectItemBigPledgedOfTv, holder.projectItemBigBackersTv, holder.projectItemBigTimeLeft, holder.projectItemBigTimeLeftType, project);
                    picassoBuilder = picasso.load(project.getBigPhotoUrl()).resize(bigItemWidth, bigItemHeight).placeholder(R.drawable.blank_project_wide);
                } else {
                    picassoBuilder = picasso.load(project.getPhotoUrl()).resize(smallItemWidth, smallItemHeight).placeholder(R.drawable.blank_project_small);
                }
                picassoBuilder.onlyScaleDown().transform(new AplaTransformation()).centerCrop().into(holder.projectItemBigPhotoIv);
            }
            break;
    }
}
Also used : Project(com.byoutline.kickmaterial.model.Project) Picasso(com.squareup.picasso.Picasso) AplaTransformation(com.byoutline.kickmaterial.utils.AplaTransformation) RequestCreator(com.squareup.picasso.RequestCreator)

Aggregations

Project (com.byoutline.kickmaterial.model.Project)2 AplaTransformation (com.byoutline.kickmaterial.utils.AplaTransformation)1 Picasso (com.squareup.picasso.Picasso)1 RequestCreator (com.squareup.picasso.RequestCreator)1