Need help to implement 47degree Android-SwipeListView
Asked Answered
J

1

9

Need help to implement 47degree Android-SwipeListView

Library URL:

https://github.com/47deg/android-swipelistview

Full Fledge Working Example:

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.

Jigaboo answered 7/11, 2013 at 23:10 Comment(5)
How did you try to include the library? It sounds like you made a mistake when trying to include it.Tetrabasic
I did include it as JAR... Through libs folder and right click and selecting add as library option...Jigaboo
Unfortunately I have never used Android Studio myself (I'm using Eclipse) so I'm not sure how the windows and stuff looks for you. Make sure that you have selected the library for exporting. In Eclipse, it looks like this: i.sstatic.net/b0A6R.pngTetrabasic
Also, the answer might exist in this questionTetrabasic
I finally managed to integrate 47degree Android-SwipeListView in my own application.Jigaboo
J
16

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.

https://github.com/47deg/android-swipelistview-sample/blob/master/src/main/java/com/fortysevendeg/android/swipelistview/sample/activities/SwipeListViewExampleActivity.java

You will need to correct some imports from the code above.

Jigaboo answered 17/11, 2013 at 22:30 Comment(5)
You can copy 'com' folder (..\swipelistview\src\main\java\com) to your project's 'src' folder, without changing package names of .java files. The only necessary change then is importing of your R class in SwipeListView.javaMingle
I've played with this view but I've discovered that it's quite buggy - even a year after its debut.Consequent
Activity code link not working... can supply alternative example?Plateau
I did what you said but some methods are not resolved in SwipeListViewTouchListener.java class plz helpRahmann
Also, don't forget to include the nineoldandroids jar file as it is required for SwipeListViewTouchListener.java. Just search for nineoldandroids jar and you'll find one. E.g. github.com/JakeWharton/NineOldAndroids/downloadsGay

© 2022 - 2024 — McMap. All rights reserved.