1 |
efrain |
1 |
package com.cesams.twogetskills.adapter;
|
|
|
2 |
|
|
|
3 |
import android.content.Context;
|
|
|
4 |
import android.view.LayoutInflater;
|
|
|
5 |
import android.view.View;
|
|
|
6 |
import android.view.ViewGroup;
|
|
|
7 |
import android.widget.TextView;
|
|
|
8 |
|
|
|
9 |
import androidx.recyclerview.widget.RecyclerView;
|
|
|
10 |
|
|
|
11 |
import com.cesams.twogetskills.R;
|
|
|
12 |
import com.cesams.twogetskills.viewdata.UserProfileViewData;
|
|
|
13 |
import com.cesams.twogetskills.skeleton.IUserProfileDelegateAdapter;
|
|
|
14 |
|
|
|
15 |
import java.util.List;
|
|
|
16 |
|
|
|
17 |
public class UserProfileListViewItemAdapter implements IUserProfileDelegateAdapter {
|
|
|
18 |
private final static String TAG = "C2GS - TimeUserProfileViewHeaderAdapter";
|
|
|
19 |
private List<UserProfileViewData> mData;
|
|
|
20 |
private LayoutInflater mInflater;
|
|
|
21 |
private Context mContext;
|
|
|
22 |
|
|
|
23 |
public UserProfileListViewItemAdapter(Context context)
|
|
|
24 |
{
|
|
|
25 |
this.mContext = context;
|
|
|
26 |
this.mInflater = LayoutInflater.from(context);
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
// inflates the row layout from xml when needed
|
|
|
32 |
@Override
|
|
|
33 |
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
|
34 |
View view = mInflater.inflate(R.layout.fragment_userprofile_item_line, parent, false);
|
|
|
35 |
return new PointViewHolder(view);
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
// binds the data to the TextView in each row
|
|
|
39 |
@Override
|
|
|
40 |
public void onBindViewHolder(RecyclerView.ViewHolder holder, UserProfileViewData userProfileViewData) {
|
|
|
41 |
UserProfileListViewItemAdapter.PointViewHolder mHolder = (UserProfileListViewItemAdapter.PointViewHolder) holder;
|
|
|
42 |
|
|
|
43 |
mHolder.mLabel.setText(userProfileViewData.getLabelOrCompanyName());
|
|
|
44 |
mHolder.mValue.setText(userProfileViewData.getValueOrImage());
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
public class PointViewHolder extends RecyclerView.ViewHolder {
|
|
|
50 |
TextView mLabel;
|
|
|
51 |
TextView mValue;
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
PointViewHolder(View itemView) {
|
|
|
55 |
super(itemView);
|
|
|
56 |
|
|
|
57 |
mLabel = (TextView) itemView.findViewById(R.id.fragment_userprofile_item_label);
|
|
|
58 |
mValue = (TextView) itemView.findViewById(R.id.fragment_userprofile_item_value);
|
|
|
59 |
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
}
|