use of xyz.zpayh.myadapter.adapter.HeadAndFootAdapter in project SherlockAdapter by EvilBT.
the class HeadAndFootActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_head_and_foot);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new HeadAndFootAdapter(this);
recyclerView.setAdapter(mAdapter);
mAdapter.addHeadLayout(R.layout.item_head);
mAdapter.addFootLayout(R.layout.item_foot);
mAdapter.addFootLayout(R.layout.item_foot2);
List<ImageCard> data = new ArrayList<>();
for (int i = 0; i < mTitles.length; i++) {
ImageCard card = new ImageCard(mImageResId[i], mTitles[i]);
data.add(card);
}
mAdapter.setData(data);
final SwipeRefreshLayout refresh = (SwipeRefreshLayout) findViewById(R.id.refresh);
refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
refresh();
refresh.setRefreshing(false);
}
});
findViewById(R.id.fab).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
refresh();
}
});
}
Aggregations