本文整理汇总了Java中github.nisrulz.recyclerviewhelper.RVHItemDividerDecoration类的典型用法代码示例。如果您正苦于以下问题:Java RVHItemDividerDecoration类的具体用法?Java RVHItemDividerDecoration怎么用?Java RVHItemDividerDecoration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RVHItemDividerDecoration类属于github.nisrulz.recyclerviewhelper包,在下文中一共展示了RVHItemDividerDecoration类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import github.nisrulz.recyclerviewhelper.RVHItemDividerDecoration; //导入依赖的package包/类
private void init() {
dm = new DBManager(this);
dm.readFromDB(noteDataList);
myrecyclerview = (RecyclerView) findViewById(R.id.rv_list);
Intent searchIntent = getIntent();
if (Intent.ACTION_SEARCH.equals(searchIntent.getAction()))
query = searchIntent.getStringExtra(SearchManager.QUERY);
myrecyclerview.hasFixedSize();
myrecyclerview.setLayoutManager(new LinearLayoutManager(this));
for (int i = 0; i < noteDataList.size(); i++) {
if (noteDataList.get(i).getTitle().toLowerCase().contains(query.toLowerCase()))
temp.add(noteDataList.get(i));
}
adapter = new RecyclerViewAdapter(this, temp);
myrecyclerview.setAdapter(adapter);
// Setup onItemTouchHandler
ItemTouchHelper.Callback callback = new RVHItemTouchHelperCallback(adapter, true, true, true);
ItemTouchHelper helper = new ItemTouchHelper(callback);
helper.attachToRecyclerView(myrecyclerview);
// Set the divider
myrecyclerview.addItemDecoration(
new RVHItemDividerDecoration(this, LinearLayoutManager.VERTICAL));
// Set On Click
myrecyclerview.addOnItemTouchListener(
new RVHItemClickListener(this, new RVHItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
int noteId = noteDataList.get(position).getId();
Intent intent = new Intent(SearchActivity.this, EditNoteActivity.class);
intent.putExtra("id", noteId);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
}));
}