timroes / SwipeToDismissUndoList

An Android library to enable swipe to dismiss and undo functionality on ListViews.
250 stars 72 forks source link

Change mListView to type AdapterView<?> #7

Closed androidmoney closed 11 years ago

androidmoney commented 11 years ago

This would make the library more generic purpose allowing it to be used with an ExpandableListView for example.

There is no other change to be made other than changing the definition:

  private AdapterView<?> mListView;

and the callback interface:

  Undoable onDismiss(AdapterView<?> listView, int position);
timroes commented 11 years ago

Though it will break the API, I will consider it and give it a closer look to change it to AdapterView<? extends Adapter>. Thanks for your feedback!

androidmoney commented 11 years ago

Thank you. I am currently not using your library, but thinking about it. I do use ExpandableListView's in my app, though, which is why I looked to see what kind of dependencies you had on a ListView proper, and found none.

timroes commented 11 years ago

I checked it and unfortunately it won't be just changing these two lines. Since AdapterView doesn't have the setOnScrollListener method, I will leave this open and will give it a deeper look sometime. Until then your problem shouldn't actually exist, since ExpendableListView extends ListView and as such could be passed to the SwipeDismissList.

timroes commented 11 years ago

With 95717c612841a2b976d5247bbb525270383d8756 I use AbsListView instead of ListView. Now you can also use it for GridView. I don't think it makes sense to use this on AdapterViews that are not AbsListViews (like Spinner). So I am not going to change it to AdapterView and close this issue. But feel free to give feedback, if you know reasons, I've might have overlooked.

androidmoney commented 11 years ago

That's great, thank you. Not sure how I missed the setOnScrollListener problem, but if I had seen it, I wouldn't have suggested AdapterView obviously. Sorry about that.