B4A Library Ripple Effect library

Discussion in 'Additional libraries, classes and official updates' started by Erel, Oct 22, 2014.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Attached Files:

    Last edited: Nov 21, 2018
  2. Informatix

    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.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    You can treat this view as a Panel.
    Code:
    If View Is Panel Then
     
    Dim p As Panel = View
     
    Dim originalView As Label = p.GetView(0)
    End If
     
    Peter Simpson and Informatix like this.
  4. derez

    derez Expert Licensed User

    Very nice.
    The demo has a b1_click which does not exist.
     
  5. woniol

    woniol Active Member Licensed User

    Is StdActionBar (Standard ActionBar) library used on this demo video ?
     
  6. Erel

    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.
     
  7. thedesolatesoul

    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.
     
    Rochow likes this.
  8. Erel

    Erel Administrator Staff Member Licensed User

    Several members requests the library source code. It is attached.
     

    Attached Files:

  9. Douglas Farias

    Douglas Farias Expert Licensed User

  10. corwin42

    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:

     
    thedesolatesoul likes this.
  11. Informatix

    Informatix Expert Licensed User

    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.
     
    Peter Simpson likes this.
  12. Erel

    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).
     
    thedesolatesoul likes this.
  13. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Last edited: Oct 22, 2014
  14. johndb

    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.
     
  15. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Did you try to bind to the GestureDetector after you added the ripple effect?
     
  16. Informatix

    Informatix Expert Licensed User

    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.
     
  17. thedesolatesoul

    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).
     
  18. Informatix

    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
     

    Attached Files:

    Last edited: Oct 24, 2014
    Pooya1, Mashiane, Devan and 5 others like this.
  19. johndb

    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 ;)
     
  20. Informatix

    Informatix Expert Licensed User

    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: Oct 23, 2014
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice