-
Notifications
You must be signed in to change notification settings - Fork 0
/
GuestListAdapter.java
executable file
·70 lines (54 loc) · 2 KB
/
GuestListAdapter.java
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
65
66
67
68
69
70
package com.example.android.waitlist;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import static android.support.v7.recyclerview.R.styleable.RecyclerView;
public class GuestListAdapter extends RecyclerView.Adapter<GuestListAdapter.GuestViewHolder> {
private Context mContext;
/**
* Constructor using the context and the db cursor
*
* @param context the calling context/activity
*/
public GuestListAdapter(Context context) {
this.mContext = context;
}
@Override
public GuestViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// Get the RecyclerView item layout
LayoutInflater inflater = LayoutInflater.from(mContext);
View view = inflater.inflate(R.layout.guest_list_item, parent, false);
return new GuestViewHolder(view);
}
@Override
public void onBindViewHolder(GuestViewHolder holder, int position) {
}
@Override
public int getItemCount() {
return 0;
}
/**
* Inner class to hold the views needed to display a single item in the recycler-view
*/
class GuestViewHolder extends RecyclerView.ViewHolder {
// Will display the guest name
TextView nameTextView;
// Will display the party size number
TextView partySizeTextView;
/**
* Constructor for our ViewHolder. Within this constructor, we get a reference to our
* TextViews
*
* @param itemView The View that you inflated in
* {@link GuestListAdapter#onCreateViewHolder(ViewGroup, int)}
*/
public GuestViewHolder(View itemView) {
super(itemView);
nameTextView = (TextView) itemView.findViewById(R.id.name_text_view);
partySizeTextView = (TextView) itemView.findViewById(R.id.party_size_text_view);
}
}
}