loopeer / itemtouchhelper-extension Goto Github PK
View Code? Open in Web Editor NEWExtension for itemtouchhelper with swipe settling,recover and no conflict with recyclerview
Extension for itemtouchhelper with swipe settling,recover and no conflict with recyclerview
if i don't need drag functionality then how i can remove it ?
Hi,
TanX for your great library,
I have 2 question:
1-How can I swipe rows from the other direction?
2-How can I swipe rows from both directions?
How to make swipe of item and recyclerview scrolling at the same time with this? If swiping is enabled, nested scroll is not working
我看了一下主要是动画那部分用了高版本API,其实可以考虑吧执行动画那部分抽出来让客户端去实现。。。这一低版本就可以用noa来往下兼容
Steps to play
Expectations:
the edge of the second element starts moving away from the buttons
Reality:
the edge of the second element begins to move from the edge of the screen
Example
device-2019-01-31-103632.zip
First of all, thanks for the nice library! The code looks it only supports to open the swipe content view at the end of the item. Does it support to open the swiping content views at both ends of the item at the same time?
i want to swipe item when i click on button not on touch
我照着源代码敲了一遍之后发现划开任意一个item的菜单,菜单中的按钮事件无法被响应,但是第二个item的菜单打后按钮事件可以被响应。后来发现奇数次打开的item菜单按钮事件不能被响应,但是偶数次的菜单按钮事件可以被响应。
甚至将源代码copy之后运行也有同样的情况。
建议把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);
}
}
I'm trying to use drag to swipe functionality in my activity with this code ,everything is work fine but one problem is there when im trying to swipe items from one position to another then after dropping the item on new position then immediately onclick function called how i can fix this...? very urgent
Can you add a drag to sort feature
Create a list (recyclerView) with a number of items which don't fit on a screen (it's necessary to scroll to see all the items).
While drag the 1st item,scrolling works and the 1st item appears in the bottom under some other items.
It leads to the fact that the 1st item can't be placed, for instance, to the 2nd position.
While using Google ItemTouchHelper, no such problems arise.
Is there a way to enable and disable the swiping on the item dynamically? Thanks.
I seen that even though i provide different view for different type it still allow to swipe. I want something where it only allow swipe on certain items.
compile 'com.loopeer.library:itemtouchhelperextension:1.0.2' not found
I have three views inside item layout - first is layout with remove button, second is item info layout, and the last one is progress bar, and in this case my swiped items don't returns to initial state.
When I moved progress to second layout, it started to work, but I want to have progress above this layout, not inside.
I know there is a onSwiped method in the helper and callback classes however how can I use that method to access a view component in the activity? My use case consists of a main activity and a fragment. The adapter class shows the rows in the fragment through the activity class, now I need to change the text and an imageview when a row gets swiped, how can I access the textview and imageview present in the fragment through the onSwipe method?
There is an strange bug in swiping first item after swiping an other item. .
First swipe any arbitrary item, then before clicking on the delete or refresh buttons, try to swipe the first item. It will not swipe unless you start swiping from the rightest point of item. if you try to swipe the first item by touching the middle points of it, the previous open item will respond to this swipe.
有时候打开Action然后再向右滑到原来位置,会触发click事件,而且有时候滑动会删除掉这个item,不知是不是触发到了SwipeThreshold,SwipeThreshold和ActionWidth有没有兼容好呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.