B4A Library SlideSwitch V1.0.2

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, Mar 12, 2015.

  1. DonManfred

    DonManfred Expert Licensed User

    SlideSwitch
    Version:
    1.02
    • SlideSwitch
      Events:
      • close (swview as Object As , token as Object As )
      • onClick (swview as Object As )
      • open (swview as Object As , token as Object As )
      Fields:
      • ba As BA
      Methods:
      • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
      • BringToFront
      • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
      • Initialize (EventName As String)
      • Invalidate
      • Invalidate2 (arg0 As Rect)
      • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • IsInitialized As Boolean
      • RemoveView
      • RequestFocus As Boolean
      • SendToBack
      • SetBackgroundImage (arg0 As Bitmap)
      • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
      • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
      • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
      Properties:
      • Background As Drawable
      • Color As Int [write only]
        Set the Color for the SlideSwitch
      • Enabled As Boolean
      • Height As Int
      • Left As Int
      • Rounded As Boolean [write only]
        Set this to true if you want to get an rounded SlideSwitch
        Default is false
      • State As Boolean
        The State of the the SlideSwitch
        If true the Switch is open
        false if Switch is closed
      • Tag As Object
      • Token As Object
      • Top As Int
      • Visible As Boolean
      • Width As Int

    [​IMG]
     

    Attached Files:

    Last edited: Apr 30, 2015
    Kwame Twum, giga, Ohanian and 11 others like this.
  2. migrec

    migrec Member Licensed User

    You are pumping out libraries right now, trying to break some record? Erels perhaps? :D
     
    Inman, Erel, DonManfred and 1 other person like this.
  3. NJDude

    NJDude Expert Licensed User

    Very nice, however, would it be possible to make those arguments a little but more descriptive?
    Code:
    SetColorAnimated(arg0 As Int, arg1 As Int, arg2 As Int)
    arg0...arg1, gives no idea of what to do there.
     
    DonManfred and Peter Simpson like this.
  4. DonManfred

    DonManfred Expert Licensed User

    must have a look at this. The mentioned method is added automatically (AbsViewWrapper<SlideSwitch>) and it is taken from the View
     
  5. Inman

    Inman Well-Known Member Licensed User

    Great job. Don't forget to mention this library in the Updates thread.
     
  6. DonManfred

    DonManfred Expert Licensed User

    What? I did not do a post there? Oups, sorry ;-)
    Will do that today when i update this lib here. Want to see first how much work it is to realize @NJDude wish for better method parameter names...
     
    Peter Simpson likes this.
  7. daemon

    daemon Active Member Licensed User

    Good one!

    A feature request: Please add another class SlideToAction that behaves like 'slide to unlock'. Basically, it is always in closed position and raises an even when the slider is moved to beyond 90%.

    Another feature request: Possibility to add text on slider.

    Thanks!
     
  8. ArminKH

    ArminKH Well-Known Member

    Hi thank u 4 for sharing this usefull lib
    but when i use this lib and ahviewpager lib together then when i want to use slide switch (swipe my hand from left side to right or right to left)
    then my page (created by using ahviewpager changed and my slide switch not worked properly
    if is possible please test this or let me to know if is there any way to disable slide switch (slide animation)
    thank u again
     
  9. DonManfred

    DonManfred Expert Licensed User

    I did not wrote the library. I just wrote a wrapper to use it in B4A.
    I dont know how to change such things.

    Find a java library which has exact the features needed and post the link to it. Maybe i´ll do a wrapper for it.
     
  10. DonManfred

    DonManfred Expert Licensed User

    I dont have this lib. And i dont have any example which uses this and my lib.

    But intuitive i would say that is is not a good idea to have a swipe pager and the slideswitch on the same layout. Sounds not logically for me.

    Create a small project which shows the problem. Maybe i can see anything
     
    ArminKH likes this.
  11. ArminKH

    ArminKH Well-Known Member

    OK I will create a small project to show the problem tonight
    But now i can say:two touch event(AhviewPager' touch and slide switch's touch)works together for example when i touch and swipe slide switch to change state then at the same time my page(created by ahviewpager)changed because by using that we can change page's by touch and 2 touch event works together
    Thank u i'll attach small project tonight
     
    Last edited: Apr 28, 2015
  12. ArminKH

    ArminKH Well-Known Member

    @DonManfred
    this is a small project to show the problem
    if is possible atleast please take an option 4 disable animation during state changed or disable touch and changing state just work by using click event
     

    Attached Files:

    • T.zip
      File size:
      12.9 KB
      Views:
      25
  13. walterf25

    walterf25 Well-Known Member Licensed User

    +1
     
  14. thedesolatesoul

    thedesolatesoul Expert Licensed User

    It cannot be done. The Javadocs is not inherited from the parent class. SetColorAnimated is a method in ViewWrapper not in the slideswitch.
     
    Peter Simpson and DonManfred like this.
  15. DonManfred

    DonManfred Expert Licensed User

    Maybe we should create wa wish. As far as i know viewwrapper is a b4a class. Maybe erel need to extend this class!?
     
  16. thedesolatesoul

    thedesolatesoul Expert Licensed User

    I think the only way is to have the ViewWrapper and all parent class source files in the project rather than just the jar files for reference.
    I'm not sure if that is a good thing or not.
     
  17. ArminKH

    ArminKH Well-Known Member

  18. DonManfred

    DonManfred Expert Licensed User

    i will look at it this evening
     
    Peter Simpson and ArminKH like this.
  19. walterf25

    walterf25 Well-Known Member Licensed User

    That is why it is better to create your own function that can be exposed to B4A that way you can create the documentation and then just pass the viewwraper method inside that function.

    Example:
    Code:
    */Sets the RGB color
    */<code>
    */
    dim whatever as slideswitch
    */whatever.Initialize
    */whatever.ColorAnimated(
    2005076)
    */</code>

    public void ColorAnimated(BA ba, int R, int G, int B){
    SetColorAnimated(R, G, B)
    }
    :D:D:D
     
    DonManfred likes this.
  20. thedesolatesoul

    thedesolatesoul Expert Licensed User

    I'm simply not willing to do so much donkey work. Be my guest, take all my libraries and write the code for every method in ViewWrapper or other.
     
    DonManfred likes this.
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