本文整理汇总了Java中com.yanzhenjie.recyclerview.swipe.SwipeMenuRecyclerView.RIGHT_DIRECTION属性的典型用法代码示例。如果您正苦于以下问题:Java SwipeMenuRecyclerView.RIGHT_DIRECTION属性的具体用法?Java SwipeMenuRecyclerView.RIGHT_DIRECTION怎么用?Java SwipeMenuRecyclerView.RIGHT_DIRECTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.yanzhenjie.recyclerview.swipe.SwipeMenuRecyclerView
的用法示例。
在下文中一共展示了SwipeMenuRecyclerView.RIGHT_DIRECTION属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemClick
/**
* Item的菜单被点击的时候调用。
*
* @param closeable closeable. 用来关闭菜单。
* @param adapterPosition adapterPosition. 这个菜单所在的item在Adapter中position。
* @param menuPosition menuPosition. 这个菜单的position。比如你为某个Item创建了2个MenuItem,那么这个position可能是是 0、1,
* @param direction 如果是左侧菜单,值是:SwipeMenuRecyclerView#LEFT_DIRECTION,如果是右侧菜单,值是:SwipeMenuRecyclerView
* #RIGHT_DIRECTION.
*/
@Override
public void onItemClick(Closeable closeable, int adapterPosition, int menuPosition, int direction) {
closeable.smoothCloseMenu();// 关闭被点击的菜单。
if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
Toast.makeText(getApplicationContext(), "删除成功", Toast.LENGTH_SHORT).show();
}
// TODO 如果是删除:推荐调用Adapter.notifyItemRemoved(position),不推荐Adapter.notifyDataSetChanged();
if (menuPosition == 0) {// 删除按钮被点击。
Post noteOne = noteList.get(adapterPosition);
ContentValues cv = new ContentValues();
cv.put(NoteDB.ID, noteOne.getId());
cv.put(NoteDB.TITLE, noteOne.getTitle());
cv.put(NoteDB.CONTENT, noteOne.getContent());
cv.put(NoteDB.TIME, System.currentTimeMillis());
mDatabase.insert(NoteDB.RECYCLE_TABLE, null, cv);
mDatabase.delete(NoteDB.TABLE_NAME, "id=?", new String[]{noteOne.getId() + ""});
noteList.remove(adapterPosition);
noteAdapter.notifyItemRemoved(adapterPosition);
}
}
示例2: onItemClick
/**
* Item的菜单被点击的时候调用。
* @param closeable closeable. 用来关闭菜单。
* @param adapterPosition adapterPosition. 这个菜单所在的item在Adapter中position。
* @param menuPosition menuPosition. 这个菜单的position。比如你为某个Item创建了2个MenuItem,那么这个position可能是是 0、1,
* @param direction 如果是左侧菜单,值是:SwipeMenuRecyclerView#LEFT_DIRECTION,如果是右侧菜单,值是:SwipeMenuRecyclerView#RIGHT_DIRECTION.
*/
@Override
public void onItemClick(Closeable closeable, int adapterPosition, int menuPosition, int direction) {
closeable.smoothCloseMenu();// 关闭被点击的菜单。
if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
Toast.makeText(mContext, "list第" + adapterPosition + "; 右侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
} else if (direction == SwipeMenuRecyclerView.LEFT_DIRECTION) {
Toast.makeText(mContext, "list第" + adapterPosition + "; 左侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
}
// TODO 推荐调用Adapter.notifyItemRemoved(position),也可以Adapter.notifyDataSetChanged();
if (menuPosition == 0) {// 删除按钮被点击。
mStrings.remove(adapterPosition);
mMenuAdapter.notifyItemRemoved(adapterPosition);
}
}
示例3: onItemClick
@Override
public void onItemClick(SwipeMenuBridge menuBridge) {
menuBridge.closeMenu();
int direction = menuBridge.getDirection(); // 左侧还是右侧菜单。
int adapterPosition = menuBridge.getAdapterPosition(); // RecyclerView的Item的position。
if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
String deviceId = datalist.get(adapterPosition).getDeviceId();
deletePos = adapterPosition;
mPresent.presentCallBack(deviceId,"","");
}
}
示例4: onItemClick
@Override
public void onItemClick(Closeable closeable, int adapterPosition, int menuPosition, int direction) {
if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
if (menuPosition == 0) {
downLoadMusic(adapterPosition);
} else if (menuPosition == 1) {
playMV(adapterPosition);
}
closeable.smoothCloseRightMenu();
}
}
示例5: onItemClick
@Override
public void onItemClick(SwipeMenuBridge menuBridge) {
menuBridge.closeMenu();
int direction = menuBridge.getDirection(); // 左侧还是右侧菜单。
int adapterPosition = menuBridge.getAdapterPosition(); // RecyclerView的Item的position。
int menuPosition = menuBridge.getPosition(); // 菜单在RecyclerView的Item中的Position。
if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
Toast.makeText(getContext(), "list第" + adapterPosition + "; 右侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
} else if (direction == SwipeMenuRecyclerView.LEFT_DIRECTION) {
Toast.makeText(getContext(), "list第" + adapterPosition + "; 左侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
}
}
示例6: onItemClick
@Override
public void onItemClick(SwipeMenuBridge menuBridge) {
menuBridge.closeMenu();
int direction = menuBridge.getDirection(); // 左侧还是右侧菜单。
int adapterPosition = menuBridge.getAdapterPosition(); // RecyclerView的Item的position。
int menuPosition = menuBridge.getPosition(); // 菜单在RecyclerView的Item中的Position。
if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
Toast.makeText(BaseDragActivity.this, "list第" + adapterPosition + "; 右侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
} else if (direction == SwipeMenuRecyclerView.LEFT_DIRECTION) {
Toast.makeText(BaseDragActivity.this, "list第" + adapterPosition + "; 左侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
}
}
示例7: onItemClick
@Override
public void onItemClick(SwipeMenuBridge menuBridge) {
menuBridge.closeMenu();
int direction = menuBridge.getDirection(); // 左侧还是右侧菜单。
int adapterPosition = menuBridge.getAdapterPosition(); // RecyclerView的Item的position。
int menuPosition = menuBridge.getPosition(); // 菜单在RecyclerView的Item中的Position。
if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
Toast.makeText(ListActivity.this, "list第" + adapterPosition + "; 右侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
} else if (direction == SwipeMenuRecyclerView.LEFT_DIRECTION) {
Toast.makeText(ListActivity.this, "list第" + adapterPosition + "; 左侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
}
}
示例8: onItemClick
@Override
public void onItemClick(SwipeMenuBridge menuBridge) {
menuBridge.closeMenu();
int direction = menuBridge.getDirection(); // 左侧还是右侧菜单。
int adapterPosition = menuBridge.getAdapterPosition(); // RecyclerView的Item的position。
int menuPosition = menuBridge.getPosition(); // 菜单在RecyclerView的Item中的Position。
if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
Toast.makeText(GridActivity.this, "list第" + adapterPosition + "; 右侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
} else if (direction == SwipeMenuRecyclerView.LEFT_DIRECTION) {
Toast.makeText(GridActivity.this, "list第" + adapterPosition + "; 左侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
}
}
示例9: onItemClick
@Override
public void onItemClick(SwipeMenuBridge menuBridge) {
menuBridge.closeMenu();
int direction = menuBridge.getDirection(); // 左侧还是右侧菜单。
int adapterPosition = menuBridge.getAdapterPosition(); // RecyclerView的Item的position。
int menuPosition = menuBridge.getPosition(); // 菜单在RecyclerView的Item中的Position。
if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
Toast.makeText(ViewTypeActivity.this, "list第" + adapterPosition + "; 右侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
} else if (direction == SwipeMenuRecyclerView.LEFT_DIRECTION) {
Toast.makeText(ViewTypeActivity.this, "list第" + adapterPosition + "; 左侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
}
}
示例10: onItemClick
@Override
public void onItemClick(SwipeMenuBridge menuBridge) {
menuBridge.closeMenu();
int direction = menuBridge.getDirection(); // 左侧还是右侧菜单。
int adapterPosition = menuBridge.getAdapterPosition(); // RecyclerView的Item的position。
int menuPosition = menuBridge.getPosition(); // 菜单在RecyclerView的Item中的Position。
if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
Toast.makeText(DrawerActivity.this, "list第" + adapterPosition + "; 右侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
} else if (direction == SwipeMenuRecyclerView.LEFT_DIRECTION) {
Toast.makeText(DrawerActivity.this, "list第" + adapterPosition + "; 左侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
}
}