-
Notifications
You must be signed in to change notification settings - Fork 0
/
BaseBookmarkAdapter
62 lines (54 loc) · 1.33 KB
/
BaseBookmarkAdapter
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
package app.organicmaps.bookmarks;
import android.content.Context;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import app.organicmaps.bookmarks.data.BookmarkManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BaseBookmarkAdapter<V extends RecyclerView.ViewHolder>
extends RecyclerView.Adapter<V>
{
private Context mContext;
private HashMap<Long,Boolean> mItems;
BaseBookmarkAdapter(@NonNull Context context, @NonNull HashMap<Long,Boolean> items)
{
mContext = context;
mItems = items;
}
protected Context requireContext()
{
return mContext;
}
@NonNull
@Override
public V onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
{
return null;
}
@Override
public void onBindViewHolder(@NonNull V holder, int position)
{
}
@NonNull
public String getBookmarkInfo(int position)
{
List<String> list = new ArrayList<>();
for(Map.Entry<Long,Boolean> entry: mItems.entrySet())
{
Long key = entry.getKey();
Boolean value = entry.getValue();
if (value){
list.add(BookmarkManager.INSTANCE.getBookmarkName(key));
}
}
return list.get(position);
}
@Override
public int getItemCount()
{
return 0;
}
}