fix swipe to dismiss crashing on swiping footers and other random crap which is not article
This commit is contained in:
parent
b761914e0f
commit
49152f188c
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.fox.ttrss"
|
package="org.fox.ttrss"
|
||||||
android:versionCode="415"
|
android:versionCode="416"
|
||||||
android:versionName="1.181" >
|
android:versionName="1.182" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="16"
|
android:minSdkVersion="16"
|
||||||
|
@ -61,6 +61,7 @@ import com.google.gson.JsonElement;
|
|||||||
import com.nhaarman.listviewanimations.appearance.AnimationAdapter;
|
import com.nhaarman.listviewanimations.appearance.AnimationAdapter;
|
||||||
import com.nhaarman.listviewanimations.appearance.simple.SwingBottomInAnimationAdapter;
|
import com.nhaarman.listviewanimations.appearance.simple.SwingBottomInAnimationAdapter;
|
||||||
import com.nhaarman.listviewanimations.itemmanipulation.DynamicListView;
|
import com.nhaarman.listviewanimations.itemmanipulation.DynamicListView;
|
||||||
|
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.DismissableManager;
|
||||||
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.OnDismissCallback;
|
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.OnDismissCallback;
|
||||||
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.undo.SimpleSwipeUndoAdapter;
|
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.undo.SimpleSwipeUndoAdapter;
|
||||||
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.undo.TimedUndoAdapter;
|
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.undo.TimedUndoAdapter;
|
||||||
@ -560,6 +561,19 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
swipeUndoAdapter.setAbsListView(m_list);
|
swipeUndoAdapter.setAbsListView(m_list);
|
||||||
m_list.setAdapter(swipeUndoAdapter);
|
m_list.setAdapter(swipeUndoAdapter);
|
||||||
m_list.enableSimpleSwipeUndo();
|
m_list.enableSimpleSwipeUndo();
|
||||||
|
m_list.setDismissableManager(new DismissableManager() {
|
||||||
|
@Override
|
||||||
|
public boolean isDismissable(long id, int position) {
|
||||||
|
try {
|
||||||
|
Article article = m_adapter.getItem(position);
|
||||||
|
|
||||||
|
return article != null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
// index out of bounds == footer or w/e
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user