Closed gnuhel closed 8 years ago
@gnuhel I haven't updated the code with the latest changes from the original library yet. Will do that as soon as I can.
@TR4Android cool thanks would be nice to have it as soon as possible, any ETA?
thanks again for the library
@gnuhel I think I'll manage to do that today, no promises though :wink:
@TR4Android thanks a lot.
@gnuhel Unfortunately this one has proven rather tricky. I don't know whether I'll get around to finishing this anytime soon, sorry about that :disappointed: I'll keep you up-to-date!
@TR4Android is there something I can help? do you mean the code from dev branch?
@gnuhel Nope, the code from the dev branch has its own issues for now (touch handling is done in a very complicated and restrictive way by the support library implementation and allows little configuration, e.g. there's an issue with the undo implementation).
The main issue here though is the feedback loop inside clampViewPositionHorizontal
(see SwipeItem
) where I'll have to figure out how to properly apply the left and right interpolators. You can go ahead and try it out yourself, I'll gladly accept any pull requests!
@TR4Android what do you think about
public int clampViewPositionHorizontal(View child, int left, int dx) {
if (left < 0) {
float range = mConfiguration.getLeftSwipeRange();
Interpolator interpolator = mConfiguration.getLeftSwipeInterpolator();
float interpolation = interpolator != null ? interpolator.getInterpolation(range) : range;
return child.getLeft() + Math.round(interpolation * dx);
} else {
float range = mConfiguration.getRightSwipeRange();
Interpolator interpolator = mConfiguration.getRightSwipeInterpolator();
float interpolation = interpolator != null ? interpolator.getInterpolation(range) : range;
return child.getLeft() + Math.round(interpolation * dx);
}
}
range would have another meaning, here it is the point where swipe listener is triggered.
@gnuhel Something like this was my initial thought also, but it doesn't work to well with other interpolators such as BounceInterpolator
.
@TR4Android Yeah, I think the problem is that clampViewPositionHorizontal
is not called when you release the view. maybe interpolator is not suitable here
@gnuhel I've investigated other options, but haven't found anything we could use. Implementing interpolator support would probably mean modifying the ViewDragHelper
which is more work than I can currently handle.
@TR4Android it's ok, you showed me where I can change it. it works well for me with DecelerateInterpolator and the changes above. Thank you
in the code I don't see where you use the custom interpolator? could you tell me where you use them?