We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
建议把Callback类中的onChildDraw方法的第三个参数由ViewHolder类型改为Extension类型,并为Extension新增两个接口,getItemView和getTranslateView。这样就可以为使用者提供一个默认的callback,省去使用者再自己定义callback并在onChildDraw进行类型判断的步骤。下面是我使用的示例:
public interface Extension { float getActionWidth(); View getTranslateView(); View getItemView(); }
自定义的callback中onChildDraw
@Override public void onChildDraw(Canvas c, RecyclerView recyclerView, Extension extension, float dX, float dY, int actionState, boolean isCurrentlyActive) { extension.getTranslateView().setTranslationX(dX); }
ItemTouchHelperExtension中调用onChildDraw的修改
private void onDraw(Canvas c, RecyclerView parent, ViewHolder selected, List<RecoverAnimation> recoverAnimationList, int actionState, float dX, float dY) { final int recoverAnimSize = recoverAnimationList.size(); for (int i = 0; i < recoverAnimSize; i++) { final RecoverAnimation anim = recoverAnimationList.get(i); anim.update(); final int count = c.save(); onChildDraw(c, parent, (Extension) anim.mViewHolder, anim.mX, anim.mY, anim.mActionState, false); c.restoreToCount(count); } if (selected != null) { final int count = c.save(); onChildDraw(c, parent, (Extension) selected, dX, dY, actionState, true); c.restoreToCount(count); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
建议把Callback类中的onChildDraw方法的第三个参数由ViewHolder类型改为Extension类型,并为Extension新增两个接口,getItemView和getTranslateView。这样就可以为使用者提供一个默认的callback,省去使用者再自己定义callback并在onChildDraw进行类型判断的步骤。下面是我使用的示例:
自定义的callback中onChildDraw
ItemTouchHelperExtension中调用onChildDraw的修改
The text was updated successfully, but these errors were encountered: