AutorÃa | Ultima modificación | Ver Log |
package com.cesams.twogetskills.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.cesams.twogetskills.R;
import com.cesams.twogetskills.viewdata.UserProfileViewData;
import com.cesams.twogetskills.skeleton.IUserProfileDelegateAdapter;
import java.util.List;
public class UserProfileListViewItemAdapter implements IUserProfileDelegateAdapter {
private final static String TAG = "C2GS - TimeUserProfileViewHeaderAdapter";
private List<UserProfileViewData> mData;
private LayoutInflater mInflater;
private Context mContext;
public UserProfileListViewItemAdapter(Context context)
{
this.mContext = context;
this.mInflater = LayoutInflater.from(context);
}
// inflates the row layout from xml when needed
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = mInflater.inflate(R.layout.fragment_userprofile_item_line, parent, false);
return new PointViewHolder(view);
}
// binds the data to the TextView in each row
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, UserProfileViewData userProfileViewData) {
UserProfileListViewItemAdapter.PointViewHolder mHolder = (UserProfileListViewItemAdapter.PointViewHolder) holder;
mHolder.mLabel.setText(userProfileViewData.getLabelOrCompanyName());
mHolder.mValue.setText(userProfileViewData.getValueOrImage());
}
public class PointViewHolder extends RecyclerView.ViewHolder {
TextView mLabel;
TextView mValue;
PointViewHolder(View itemView) {
super(itemView);
mLabel = (TextView) itemView.findViewById(R.id.fragment_userprofile_item_label);
mValue = (TextView) itemView.findViewById(R.id.fragment_userprofile_item_value);
}
}
}