1 |
gabriel |
1 |
package com.cesams.twogetskills.inconcert.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.ImageView;
|
|
|
8 |
import android.widget.TextView;
|
|
|
9 |
|
|
|
10 |
import androidx.recyclerview.widget.RecyclerView;
|
|
|
11 |
|
18 |
efrain |
12 |
|
1 |
gabriel |
13 |
import com.cesams.twogetskills.inconcert.Constants;
|
|
|
14 |
import com.cesams.twogetskills.inconcert.R;
|
18 |
efrain |
15 |
import com.cesams.twogetskills.inconcert.library.ImageService;
|
1 |
gabriel |
16 |
import com.cesams.twogetskills.inconcert.library.MD5;
|
|
|
17 |
import com.cesams.twogetskills.inconcert.viewdata.UserProfileViewData;
|
|
|
18 |
import com.cesams.twogetskills.inconcert.skeleton.ITwoGetSkills;
|
|
|
19 |
import com.cesams.twogetskills.inconcert.skeleton.IUserProfileDelegateAdapter;
|
|
|
20 |
|
|
|
21 |
import java.util.Calendar;
|
|
|
22 |
import java.util.List;
|
|
|
23 |
import java.util.Random;
|
|
|
24 |
import java.util.TimeZone;
|
|
|
25 |
|
|
|
26 |
public class UserProfileListViewHeaderAdapter implements IUserProfileDelegateAdapter {
|
|
|
27 |
private final static String TAG = "C2GS - UserProfileListViewHeaderAdapter";
|
|
|
28 |
private List<UserProfileViewData> mData;
|
|
|
29 |
private LayoutInflater mInflater;
|
|
|
30 |
private Context mContext;
|
|
|
31 |
private ITwoGetSkills iTwoGetSkills;
|
|
|
32 |
|
|
|
33 |
public UserProfileListViewHeaderAdapter(Context context)
|
|
|
34 |
{
|
|
|
35 |
this.mContext = context;
|
|
|
36 |
this.mInflater = LayoutInflater.from(context);
|
|
|
37 |
|
|
|
38 |
if(context instanceof ITwoGetSkills) {
|
|
|
39 |
iTwoGetSkills = (ITwoGetSkills) context;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
// inflates the row layout from xml when needed
|
|
|
47 |
@Override
|
|
|
48 |
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
|
49 |
View view = mInflater.inflate(R.layout.fragment_userprofile_item_header, parent, false);
|
|
|
50 |
return new HeaderViewHolder(view);
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
// binds the data to the TextView in each row
|
|
|
54 |
@Override
|
|
|
55 |
public void onBindViewHolder(RecyclerView.ViewHolder holder, UserProfileViewData userProfileViewData) {
|
|
|
56 |
HeaderViewHolder mHolder = (HeaderViewHolder) holder;
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
mHolder.mItem.setText(userProfileViewData.getLabelOrCompanyName());
|
18 |
efrain |
60 |
ImageService.retrieve(mContext, userProfileViewData.getValueOrImage(), mHolder.mImage);
|
1 |
gabriel |
61 |
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
public class HeaderViewHolder extends RecyclerView.ViewHolder {
|
|
|
65 |
TextView mItem;
|
|
|
66 |
ImageView mImage;
|
|
|
67 |
|
|
|
68 |
HeaderViewHolder(View itemView) {
|
|
|
69 |
super(itemView);
|
|
|
70 |
|
|
|
71 |
mItem = (TextView) itemView.findViewById(R.id.fragment_userprofile_item_header_company_name);
|
|
|
72 |
mImage = (ImageView) itemView.findViewById(R.id.fragment_userprofile_item_header_company_image);
|
|
|
73 |
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
}
|