本文整理了Java中com.zx.zxutils.views.RecylerMenu.ZXRecyclerDeleteHelper
类的一些代码示例,展示了ZXRecyclerDeleteHelper
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZXRecyclerDeleteHelper
类的具体详情如下:
包路径:com.zx.zxutils.views.RecylerMenu.ZXRecyclerDeleteHelper
类名称:ZXRecyclerDeleteHelper
暂无
代码示例来源:origin: StannyBing/ZXUtils
private void animateFG(View downView, Animation animateType, long duration) {
if (animateType == Animation.OPEN) {
ObjectAnimator translateAnimator = ObjectAnimator.ofFloat(
fgView, View.TRANSLATION_X, -bgWidth);
translateAnimator.setDuration(duration);
translateAnimator.setInterpolator(new DecelerateInterpolator(1.5f));
translateAnimator.start();
animateFadeViews(downView, 0f, duration);
} else if (animateType == Animation.CLOSE) {
ObjectAnimator translateAnimator = ObjectAnimator.ofFloat(
fgView, View.TRANSLATION_X, 0f);
translateAnimator.setDuration(duration);
translateAnimator.setInterpolator(new DecelerateInterpolator(1.5f));
translateAnimator.start();
animateFadeViews(downView, 1f, duration);
}
}
代码示例来源:origin: StannyBing/ZXUtils
/**
* Gets coordinates from Activity and closes any
* swiped rows if touch happens outside the recycler view
*/
@Override
public void getTouchCoordinates(MotionEvent ev) {
int y = (int) ev.getRawY();
if (swipeable && bgVisible && ev.getActionMasked() == MotionEvent.ACTION_DOWN
&& y < heightOutsideRView) closeVisibleBG(null);
}
代码示例来源:origin: StannyBing/ZXUtils
@Override
public void onTouchEvent(RecyclerView rv, MotionEvent motionEvent) {
handleTouchEvent(motionEvent);
}
代码示例来源:origin: StannyBing/ZXUtils
if (shouldIgnoreAction(touchedPosition)) {
touchedPosition = ListView.INVALID_POSITION;
return false; // <-- guard here allows for ignoring events, allowing more than one view type and preventing NPE
if (swipeable && bgVisible && touchedPosition != bgVisiblePosition) {
handler.removeCallbacks(mLongPressed);
closeVisibleBG(null);
animateFG(touchedView, Animation.CLOSE, ANIMATION_STANDARD);
animateFG(touchedView, Animation.OPEN, ANIMATION_STANDARD);
bgVisible = true;
bgVisibleView = fgView;
animateFG(touchedView, Animation.CLOSE, ANIMATION_STANDARD);
bgVisible = false;
bgVisibleView = null;
animateFG(touchedView, Animation.CLOSE, ANIMATION_STANDARD, new OnSwipeListener() {
@Override
public void onSwipeOptionsClosed() {
animateFG(touchedView, Animation.OPEN, ANIMATION_STANDARD);
bgVisible = true;
bgVisibleView = fgView;
animateFG(touchedView, Animation.CLOSE, ANIMATION_STANDARD);
bgVisible = false;
bgVisibleView = null;
代码示例来源:origin: StannyBing/ZXUtils
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(deleteAdapter);
swipeHelper = new ZXRecyclerDeleteHelper(getActivity(), recyclerView)
.setClickable(new ZXRecyclerDeleteHelper.OnItemClickListener() {
@Override
public void onItemClicked(int position) {
.setSwipeOptionViews(R.id.tv_delete, R.id.tv_cancle)
.setSwipeable(R.id.ll_content, R.id.ll_menu, new ZXRecyclerDeleteHelper.OnSwipeOptionsClickListener() {
@Override
public void onSwipeOptionClicked(int viewID, int position) {
代码示例来源:origin: StannyBing/ZXUtils
public void openSwipeOptions(int position) {
if (!swipeable || rView.getChildAt(position) == null
|| unSwipeableRows.contains(position) || shouldIgnoreAction(position))
return;
if (bgWidth < 2) {
if (act.findViewById(bgViewID) != null)
bgWidth = act.findViewById(bgViewID).getWidth();
heightOutsideRView = screenHeight - rView.getHeight();
}
touchedPosition = position;
touchedView = rView.getChildAt(position);
fgView = touchedView.findViewById(fgViewID);
bgView = touchedView.findViewById(bgViewID);
bgView.setMinimumHeight(fgView.getHeight());
closeVisibleBG(null);
animateFG(touchedView, Animation.OPEN, ANIMATION_STANDARD);
bgVisible = true;
bgVisibleView = fgView;
bgVisiblePosition = touchedPosition;
}
代码示例来源:origin: StannyBing/ZXUtils
public ZXRecyclerDeleteHelper setSwipeable(boolean value) {
this.swipeable = value;
if (!value)
invalidateSwipeOptions();
return this;
}
代码示例来源:origin: StannyBing/ZXUtils
@Deprecated
public void closeVisibleBG() {
if (bgVisibleView == null) {
Log.e(TAG, "No rows found for which background options are visible");
return;
}
bgVisibleView.animate()
.translationX(0)
.setDuration(ANIMATION_CLOSE)
.setListener(null);
animateFadeViews(bgVisibleView, 1f, ANIMATION_CLOSE);
bgVisible = false;
bgVisibleView = null;
bgVisiblePosition = -1;
}
代码示例来源:origin: StannyBing/ZXUtils
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent motionEvent) {
if (bgVisible) {
rv.requestDisallowInterceptTouchEvent(true);
} else if ((ZXScreenUtil.getScreenWidth() > touchedX + 150)
&& (motionEvent.getRawX() - touchedX < 0)) {
rv.requestDisallowInterceptTouchEvent(true);
} else {
rv.requestDisallowInterceptTouchEvent(false);
}
return handleTouchEvent(motionEvent);
}
代码示例来源:origin: StannyBing/ZXUtils
translateAnimator.start();
animateFadeViews(bgVisibleView, 1f, ANIMATION_CLOSE);
bgVisible = false;
bgVisibleView = null;
代码示例来源:origin: StannyBing/ZXUtils
translateAnimator.setInterpolator(new DecelerateInterpolator(1.5f));
translateAnimator.start();
animateFadeViews(downView, 0f, duration);
} else /*if (animateType == Animation.CLOSE)*/ {
translateAnimator = ObjectAnimator.ofFloat(fgView, View.TRANSLATION_X, 0f);
translateAnimator.setInterpolator(new DecelerateInterpolator(1.5f));
translateAnimator.start();
animateFadeViews(downView, 1f, duration);
内容来源于网络,如有侵权,请联系作者删除!