Issue
Need help to implement 47degree Android-SwipeListView
Library URL:
https://github.com/47deg/android-swipelistview
https://play.google.com/store/apps/details?id=com.fortysevendeg.android.swipelistview
Problem:
Every time I try to implement swipelistview in my activity listview I get new problems. Lastly I tried to include compiled and distributed JAR (https://oss.sonatype.org/content/groups/public/com/fortysevendeg/android/swipelistview/1.0-SNAPSHOT/) to my project and implement it; it was compiling correctly but when I was trying to run it on the device or avd it was crashing with exception ClassNotFoundException for SwipeListViewTouchListener and many more...
Tool I am using?
Android Studio
What I need?
I would be (and many more developers looking around for same solution ) very grateful if someone can provide very basic example using this library...
- No need to provide fully working kind of application
- Demo code with front and back view for listview item working while left and right sliding would be fine
- No need to implement all settings of the library
The motive of this question is to get idea about how to wire-up 47degree swipelistview library into your application and make it working. Rest things programmer who is using it should be able to find out from API documentation.
Any help on this would be very useful as I am working on one small application where I want to implement such functionality.
Solution
Finally I managed to integrate 47degree Android-SwipeListView in my own application.
Works like a charm. Thanks 47degree to write such a wonderful piece of code.
Solution:
What is not working!!?
Including JAR as dependency and attrs.xml in res/values OR referencing to the swipelistview library as lib dependency project in your project is not working.
What works!!?
Include following classes into your application package. Also correct package names in these classes to your package name.
- SwipeListView.java
- SwipeListViewListener.java
- SwipeListViewListenerBase.java
- SwipeListViewTouchListener.java
Include following xml into your application res/values folder.
- attrs.xml
Now you can define and use SwipeListView as follows.
<au.com.your.package.SwipeListView
xmlns:swipe="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipe_listview"
android:listSelector="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
swipe:swipeFrontView="@+id/front"
swipe:swipeBackView="@+id/back"
swipe:swipeActionLeft="reveal"
swipe:swipeActionRight="choice"
swipe:swipeMode="both"
swipe:swipeCloseAllItemsWhenMoveList="true"
swipe:swipeOpenOnLongPress="true"
swipe:swipeAnimationTime="100"
swipe:swipeOffsetLeft="50dp"
swipe:swipeDrawableChecked="@drawable/item_selected"
swipe:swipeDrawableUnchecked="@drawable/item_unselected"
/>
Activity code you can use same as displayed in the example on SwipeListView github site.
You will need to correct some imports from the code above.
Answered By - GDroid
Answer Checked By - Timothy Miller (JavaFixing Admin)