blob: 7d35b45fd9e2afab961f8b470b102fccf6e6f2c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
package com.mapswithme.maps.adapter;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mapswithme.maps.R;
import com.mapswithme.maps.bookmarks.data.CatalogTagsGroup;
import java.util.List;
public class TagGroupNameAdapter extends RecyclerView.Adapter<TagGroupNameAdapter.TagGroupNameHolder>
{
@NonNull
private final List<CatalogTagsGroup> mTagsGroups;
public TagGroupNameAdapter(@NonNull List<CatalogTagsGroup> tagsGroups)
{
mTagsGroups = tagsGroups;
setHasStableIds(true);
}
@Override
public TagGroupNameHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View itemView = inflater.inflate(R.layout.tags_category, parent, false);
return new TagGroupNameHolder(itemView);
}
@Override
public void onBindViewHolder(TagGroupNameHolder holder, int position)
{
CatalogTagsGroup item = mTagsGroups.get(position);
holder.mText.setText(item.getLocalizedName());
}
@Override
public long getItemId(int position)
{
return position;
}
@Override
public int getItemCount()
{
return mTagsGroups.size();
}
static final class TagGroupNameHolder extends RecyclerView.ViewHolder
{
@NonNull
private final TextView mText;
TagGroupNameHolder(@NonNull View itemView)
{
super(itemView);
mText = itemView.findViewById(R.id.text);
}
}
}
|