forked from jdsjlzx/AndroidStudyCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleAuthorAdapter.java
More file actions
51 lines (43 loc) · 1.49 KB
/
SimpleAuthorAdapter.java
File metadata and controls
51 lines (43 loc) · 1.49 KB
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
package com.clock.study.adapter;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.clock.study.R;
import com.clock.study.activity.AuthorActivity;
/**
* Just Simple Author Adapter
* <p/>
* Created by Clock on 2016/8/24.
*/
public class SimpleAuthorAdapter extends RecyclerView.Adapter<SimpleAuthorAdapter.SimpleViewHolder> {
private final View.OnClickListener mSimpleClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = v.getContext();
Intent intent = new Intent(context, AuthorActivity.class);
context.startActivity(intent);
}
};
@Override
public SimpleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View rootView = inflater.inflate(R.layout.author_info_layout, parent, false);
return new SimpleViewHolder(rootView);
}
@Override
public void onBindViewHolder(SimpleViewHolder holder, int position) {
holder.itemView.setOnClickListener(mSimpleClickListener);
}
@Override
public int getItemCount() {
return 20;
}
static class SimpleViewHolder extends RecyclerView.ViewHolder {
public SimpleViewHolder(View itemView) {
super(itemView);
}
}
}