B4A Library NineOldAndroids

This is my version of the NineOldAndroids lib for B4A. It's free and provided with the Java source code.

This library offers more possibilities of animation than AnimationPlus (rotation or translation on more than one axis for 3D effect, animation step by step with events for each step, synchronization between animations, ability to change the view size and contents during the animation, etc.).

It works with all versions of Android >= 2 and with all views, even custom ones.

v0.92: Initial release.
v0.92b: I changed the package name and repackaged the source to ease its compilation.
v0.93: I fixed a bug in noaObjectAnimator.InitializeFloat.
 

Attachments

  • NineOldAndroids v0.93.zip
    328 KB · Views: 1,985
  • BasicTranslationExample.zip
    6.8 KB · Views: 968
Last edited:

eps

Expert
Licensed User
Longtime User
Wow! This could be really useful for something I've been trying to work out how to do...

Thanks for sharing
 

thedesolatesoul

Expert
Licensed User
Longtime User
Hi Informatix,
First of all thank you for this library, it is my 'go to' library for any animation as it is very easy to use and can do pretty much everything. Also the handling is easier as the view property actually changes.

However, I am having some problem, possibly due to the way you wrote this library.
Basically I have a couple of other libraries that depend on the NineOldAndroid jar. They use DependsOn to refer to the actual external jar (NineOldAndroid-2.4.0.jar).
Your library however packages the source inside your jar.
If I include both of these libraries in a project, it creates duplicate classes in the app and the dexer fails. (I think this is the step where jar is converted to dex).
If I remove the DependsOn annotation then my library cannot find the method from the NineOldAndroids package.
The only way I see around (maybe you have an alternate solution) it is to re-write the NineOldAndroids as a wrapper which ofcourse is a lot more work.
 

Informatix

Expert
Licensed User
Longtime User
NineOldAndroids needs only one jar: NineOldAndroids.jar. I don't distribute the NineOldAndroid-2.4.0.jar (you probably downloaded and installed it yourself from the Wharton's web site) and it is not needed. The original source is in the zip file, not in a jar, and is just there for license reasons. You can let it in the zip file.
I cannot just write a wrapper for this library. If you make a diff between the two source codes, you'll see big differences. I changed many things.
 

thedesolatesoul

Expert
Licensed User
Longtime User
NineOldAndroids needs only one jar: NineOldAndroids.jar. I don't distribute the NineOldAndroid-2.4.0.jar (you probably downloaded and installed it yourself from the Wharton's web site) and it is not needed.
You are correct. It is not needed to use your library, but I downloaded to use some other libraries that depend on the Jake's jar.

I cannot just write a wrapper for this library. If you make a diff between the two source codes, you'll see big differences. I changed many things.
Ok, I didnt really go that deep into the source.

Anyway, I cannot get it to work with other libs that also depend on this jar when I include your library.

- When adding both libraries, adds duplicate source
- If I modify my wrapper to depend on your jar, I still get:
B4X:
java.lang.NoSuchMethodError: com.nineoldandroids.animation.ObjectAnimator.setInterpolator
 

Informatix

Expert
Licensed User
Longtime User
You are correct. It is not needed to use your library, but I downloaded to use some other libraries that depend on the Jake's jar.


Ok, I didnt really go that deep into the source.

Anyway, I cannot get it to work with other libs that also depend on this jar when I include your library.

- When adding both libraries, adds duplicate source
- If I modify my wrapper to depend on your jar, I still get:
B4X:
java.lang.NoSuchMethodError: com.nineoldandroids.animation.ObjectAnimator.setInterpolator
As you have my source code, why don't you change the package name of my library in Eclipse? So you will create a distinct library from the original one.
 

thedesolatesoul

Expert
Licensed User
Longtime User
It's not "if I like".
By this I meant I have your permission.

Your problem is specific to your case. Other users of this library don't have it, so I don't see what I could do on my side.
I know, but if I decide to release the library then other users will have the same problem.
There is another issue that refreshing the library tab/clean project doesnt always work sometimes I have to restart the IDE.

I will see if I can find an alternative, otherwise I will change the packagename.
 

Informatix

Expert
Licensed User
Longtime User
By this I meant I have your permission.


I know, but if I decide to release the library then other users will have the same problem.
There is another issue that refreshing the library tab/clean project doesnt always work sometimes I have to restart the IDE.

I will see if I can find an alternative, otherwise I will change the packagename.
Ok, don't worry. I will change the package name tonight and release a new version.
 
D

Deleted member 103

Guest
Hi Informatix,

I have a problem if I use your library.
After the animation of a panel I can not move properly the panel.
Please Try my project.
 

Attachments

  • animation.zip
    15.3 KB · Views: 374
D

Deleted member 103

Guest
Hi thedesolatesoul,

what can be wrong here?
Sub setWithAnimation
AnimRotatY1.InitializeFloat(pnlWithAnimation, AnimRotatY1.PROPERTY_ROTATION_Y, 0, 90, "AnimRotatY1")
AnimRotatY1.RepeatCount = 0
AnimRotatY1.Start
End Sub

Sub AnimRotatY1_End
Dim ImageEffects As RSImageEffects
Dim bmp As Bitmap
bmp.Initialize3(LoadBitmapSample(File.DirAssets, "image.jpg", pnlWithAnimation.Width, pnlWithAnimation.Height))
pnlWithAnimation.SetBackgroundImage(ImageEffects.Mirror(bmp))
AnimRotatY2.InitializeFloat(pnlWithAnimation, AnimRotatY2.PROPERTY_ROTATION_Y, 0, 90, "AnimRotatY2")
AnimRotatY2.RepeatCount = 0
AnimRotatY2.Start
End Sub

Sub AnimRotatY2_End
pnlWithAnimation.SetBackgroundImage(LoadBitmapSample(File.DirAssets, "image.jpg", pnlWithAnimation.Width, pnlWithAnimation.Height))
End Sub
 
Top