federicoiosue / checklistview

Library to convert an EditText into a View capable of acting as checklist
Apache License 2.0
89 stars 30 forks source link

Allow NestedScrollView #17

Open jfreax opened 8 years ago

jfreax commented 8 years ago

The ChecklistViewItemOnDragListener::onDrag [1] tries to find the next ScollView ancestor. In some cases it is necessary to use a NestedScrollView instead of a normal ScrollView. But it is not possible to cast between the two classes. Therefor, it would be useful to explicit support the use of NestedScrollView.

One more thing: The check in ChecklistViewItemOnDragListener::getScrollableAncestor [2] is not quite correct. The for-loop will eventually encounter a FrameLayout when there is no ScrollView. FrameLayout.getClass().isAssignableFrom(ScrollView.class) is true, but you can not cast a FrameLayout to a ScrollView. Maybe this is also the problem in issue #16.

[1] https://github.com/federicoiosue/checklistview/blob/develop/checklistview/src/main/java/it/feio/android/checklistview/dragging/ChecklistViewItemOnDragListener.java#L38 [2] https://github.com/federicoiosue/checklistview/blob/develop/checklistview/src/main/java/it/feio/android/checklistview/dragging/ChecklistViewItemOnDragListener.java#L180

cwfei commented 8 years ago

I have similar issue, what I do is putting another scroll view inside nestedscrollview to solve this isssue