B4A Library Ripple Effect library

Erel

Administrator
Staff member
Licensed User

Attachments

Last edited:

Informatix

Expert
Licensed User
When you apply this effect to a view, the view class becomes com.andexert.library.RippleView, which is a big problem. You cannot do things like:
Dim lbl As Label = CellPanel.GetView(0) -> ClassCastException
or
If View Is Label then...
You should add a method allowing to retrieve the wrapped object.
 

Erel

Administrator
Staff member
Licensed User
The video was created by the developer who created the library. So I don't know how exactly he implemented it.

You can add icons to the action bar with Activity.AddMenuItem3. Though you will not be able to add the ripple effect to these icons.
 

thedesolatesoul

Expert
Licensed User
I cant find the actual video or source, but personally I think this library (original) is slightly wrong.
The ripple is supposed to give touch feedback, so I expect the ripple to show on ACTION_DOWN not on ACTION_UP.
 

corwin42

Expert
Licensed User
A comment from Chris Banes (Android Developer and responsible for large parts of the new android-support-v7-appcompat library) on this ripple effect library:

Ripples are highly dependent on Lollipop's new RenderThread for performance. As devices before that do not have RT, the performance will be bad.
 

Informatix

Expert
Licensed User
A comment from Chris Banes (Android Developer and responsible for large parts of the new android-support-v7-appcompat library) on this ripple effect library:
I'd like to see a case where the performance is really bad. Even the slow official emulator displays a smooth animation. Maybe if you trigger many ripples at the same time, which should not happen, on a very cheap and old device... It seems that's just a very theoretical point of view.
 

Erel

Administrator
Staff member
Licensed User
I also experienced very good performance with it (though I tested it on a Nexus 5 running Android 5 so there is a small chance that it used the new magical RenderThread).
 

johndb

Active Member
Licensed User
It would appear that this RippleEffect library is not compatible with Informatix's GestureDetector library. Gestures are not passed along by the RippleEffect.
 

Informatix

Expert
Licensed User
It would appear that this RippleEffect library is not compatible with Informatix's GestureDetector library. Gestures are not passed along by the RippleEffect.
In fact, the RippleView is a bit cumbersome to use but should work with everything. With GestureDetector, you have to bind the GD to the RippleView. And when you want to move the view concerned by the gesture, you have to move the RippleView instead. Since it has no left or right property, you have to convert it to a panel first.
 

thedesolatesoul

Expert
Licensed User
Would it be better to write it in a way where you construct the view hierarchy bottom to top?
i.e. Add a RippleLayer or RipplePanel to an activity first, and then add the view onto this. This way you dont need to un-parent the view.
I am not saying it is a better way, but I have always been unsure which way is better. (Personally I prefer to 'attach' views, but that is a minefield for errors if things are not done in sequence).
 

Informatix

Expert
Licensed User
Here's a modified version of the RippleEffect lib.
It works with any Android version, it can return the view embedded within the RippleView, the ripple effect can be added before or after the view is added to its parent (if you do it before, then it's the RippleView that has to be added to a parent view) and the RippleView is now a view as any other view, with all properties and functions of a B4A view. I also added the Zoom feature, included in the original library, and two new settings for the ripple effect: type and padding (see the Ripple function).

How to use it
 

Attachments

Last edited:

johndb

Active Member
Licensed User
Thank you Informatix. I'll try it later today when I get back to the office.
I tried various combinations with the initial library: RippleView before view creation, after view creation and didn't play nice with your GestureDetector. I hope your revised version works. The effect isn't essential for my software but it would be nice feature to have ;)
 

Informatix

Expert
Licensed User
Thank you Informatix. I'll try it later today when I get back to the office.
I tried various combinations with the initial library: RippleView before view creation, after view creation and didn't play nice with your GestureDetector. I hope your revised version works. The effect isn't essential for my software but it would be nice feature to have ;)
The Erel's version works with GestureDetector but you have to do what I explained in post #16.
EDIT: I posted an example with GD here.
 
Last edited:
Top