use of com.yanzhenjie.recyclerview.SwipeRecyclerView in project SwipeRecyclerView by yanzhenjie.
the class MenuActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_group_menu);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
assert actionBar != null;
actionBar.setDisplayHomeAsUpEnabled(true);
SwipeRecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(this, R.color.divider_color)));
recyclerView.setSwipeMenuCreator(mSwipeMenuCreator);
mAdapter = new GroupAdapter();
recyclerView.setAdapter(mAdapter);
mAdapter.setListItems(createDataList());
}
use of com.yanzhenjie.recyclerview.SwipeRecyclerView in project SwipeRecyclerView by yanzhenjie.
the class HeaderViewActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scroll);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
assert actionBar != null;
actionBar.setDisplayHomeAsUpEnabled(true);
SwipeRecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setOnItemClickListener(this);
recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
recyclerView.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(this, R.color.divider_color)));
// HeaderView。
View headerView = getLayoutInflater().inflate(R.layout.layout_header, recyclerView, false);
headerView.findViewById(R.id.btn_start).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "HeaderView", Toast.LENGTH_SHORT).show();
}
});
recyclerView.addHeaderView(headerView);
// FooterView。
View footerView = getLayoutInflater().inflate(R.layout.layout_footer, recyclerView, false);
footerView.findViewById(R.id.btn_start).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(), "FooterView", Toast.LENGTH_SHORT).show();
}
});
recyclerView.addFooterView(footerView);
MainAdapter mainAdapter = new MainAdapter(this);
recyclerView.setAdapter(mainAdapter);
mainAdapter.notifyDataSetChanged(createDataList());
}
Aggregations