use of pri.weiqiang.liyujapanese.ui.adapter.StaggeredGridAdapter in project LiYuJapanese by 54wall.
the class FavLessonFragment method setData.
@Override
public void setData(List<LessonFav> data) {
Log.e(TAG, "setData!!!!!!");
lessonFavList = data;
staggeredGridAdapter = new StaggeredGridAdapter(getActivity(), data);
mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL));
mRecyclerView.setAdapter(staggeredGridAdapter);
staggeredGridAdapter.setOnItemClickLitener(new OnItemClickLitener() {
@Override
public void onItemClick(View view, int position) {
staggeredGridAdapter.notifyItemRemoved(position);
((MainActivity) getActivity()).switchFavWord(staggeredGridAdapter.getItemLessonId(position), false);
}
@Override
public void onItemLongClick(View view, final int position) {
}
});
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
itemTouchHelper.attachToRecyclerView(mRecyclerView);
}
use of pri.weiqiang.liyujapanese.ui.adapter.StaggeredGridAdapter in project MyJapanese by 54wall.
the class FavLessonFragment method setData.
@Override
public void setData(List<LessonFav> data) {
Log.e(TAG, "setData!!!!!!");
lessonFavList = data;
staggeredGridAdapter = new StaggeredGridAdapter(getActivity(), data);
mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL));
mRecyclerView.setAdapter(staggeredGridAdapter);
staggeredGridAdapter.setOnItemClickLitener(new OnItemClickLitener() {
@Override
public void onItemClick(View view, int position) {
staggeredGridAdapter.notifyItemRemoved(position);
((MainActivity) getActivity()).switchFavWord(staggeredGridAdapter.getItemLessonId(position), false);
}
@Override
public void onItemLongClick(View view, final int position) {
}
});
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
itemTouchHelper.attachToRecyclerView(mRecyclerView);
}
Aggregations