You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 26, 2023. It is now read-only.
Hi, I'm using your EnhancedListView and it's great, but I have problem with it in combination with SwipeRefreshLayout from support library. If you swipe verticaly during swiping horizontaly it stops the item at the place and doesn't put it to right place. I'm cliping the image.
Based on my testing, this only happens when the EnhancedListView is scrolled all the way to the top. A downward dragging motion causes the SwipeRefreshLayout to start its swipe animation.
One possible solution I could imagine would be exposing mSwiping via getter, and using that value in a custom SwipeRefreshLayout to override SwipeRefreshLayout.canChildScrollUp:
package com.my.package;
import de.timroes.android.listview.EnhancedListView;
import de.timroes.android.listview.EnhancedListView.OnSwipeCallback;
import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
public class EnhancedSwipeRefreshLayout extends SwipeRefreshLayout {
private EnhancedListView lv;
private boolean disableSwipeToRefresh;
public EnhancedSwipeRefreshLayout(Context context) {
super(context);
}
public EnhancedSwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setEnhancedListViewChild(EnhancedListView v){
this.lv = v;
lv.setSwipeCallback(new OnSwipeCallback(){
@Override
public void onSwipeBegin(){
disableSwipeToRefresh = true;
}
@Override
public void onSwipeEnd(){
disableSwipeToRefresh = false;
}
});
}
@Override
public boolean canChildScrollUp(){
// If we return TRUE from here, swipe to refresh is disabled.
// If it's not disabled, we fall back to whatever super has to say.
return disableSwipeToRefresh || super.canChildScrollUp();
}
}
You might be also able to write the callbacks in a different way and just disable the SwipeRefreshLayout where I'm setting the boolean flag here.
Activity
jcogilvie commentedon Aug 26, 2014
Based on my testing, this only happens when the EnhancedListView is scrolled all the way to the top. A downward dragging motion causes the SwipeRefreshLayout to start its swipe animation.
One possible solution I could imagine would be exposing mSwiping via getter, and using that value in a custom SwipeRefreshLayout to override SwipeRefreshLayout.canChildScrollUp:
jcogilvie commentedon Aug 26, 2014
Confirmed using my fork (goldenspiral):
You might be also able to write the callbacks in a different way and just disable the SwipeRefreshLayout where I'm setting the boolean flag here.
dostalleos commentedon Aug 26, 2014
Yes, you are right, that it happens only when EnhancedListView is scrolled all the way to the top.
Your solution looking good, but there is no method setSwipeCallback and no OnSwipeCallback in EnhancedListView class.
jcogilvie commentedon Aug 26, 2014
I added it in my fork. Goldenspiral/EnhancedListView.
On Aug 26, 2014 3:47 AM, "Leoš Dostál" notifications@github.com wrote:
dostalleos commentedon Aug 26, 2014
Oh, I see, Thank you