use of com.codeest.geeknews.ui.gold.adapter.GoldManagerAdapter in project GeekNews by codeestX.
the class GoldManagerActivity method initEventAndData.
@Override
protected void initEventAndData() {
setToolBar(toolBar, "首页特别展示");
mList = ((GoldManagerBean) getIntent().getParcelableExtra(Constants.IT_GOLD_MANAGER)).getManagerList();
mAdapter = new GoldManagerAdapter(mContext, mList);
rvGoldManagerList.setLayoutManager(new LinearLayoutManager(mContext));
rvGoldManagerList.setAdapter(mAdapter);
mCallback = new DefaultItemTouchHelpCallback(new DefaultItemTouchHelpCallback.OnItemTouchCallbackListener() {
@Override
public void onSwiped(int adapterPosition) {
}
@Override
public boolean onMove(int srcPosition, int targetPosition) {
if (mList != null) {
Collections.swap(mList, srcPosition, targetPosition);
mAdapter.notifyItemMoved(srcPosition, targetPosition);
return true;
}
return false;
}
});
mCallback.setDragEnable(true);
mCallback.setSwipeEnable(false);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(mCallback);
itemTouchHelper.attachToRecyclerView(rvGoldManagerList);
}
Aggregations