B4A Library [B4X][XUI] ExpandView - source code

Discussion in 'Additional libraries, classes and official updates' started by LucaMs, May 17, 2018.

  1. LucaMs

    LucaMs Expert Licensed User

    Attached the version 2.0 (not compatible with the 1.0) - b4a code module and library (see post #6). This version allows to also collapse a B4XView.


    Premise: I wanted to create an animation; it did not work the first time and then, from the wrong code, I wrote these few lines, nothing special (for this reason I do not charge € 100 :p).

    Very minimal code module / library.

    This code uses my other code module / library, ViewPos; you could mix the two modules or replace the two methods used here in ExpandView:

    ViewPos.GetBottom(Vw)
    to
    Vw.Top + Vw.Height - 1

    and

    ViewPos.GetRight(Vw)
    to
    Vw.Left + Vw.Width - 1


    Note that jxExpandView and xExpandView libraries already "contains" ViewPos, you don't need to add it to your projects.

    Example:
    ExpandView.Expand(400, ImageView1, ExpandView.EXPVW_LEFT_TO_RIGHT)


    Expand.gif

    applied to a xCustomListView:
    Expand xCLV.gif
     

    Attached Files:

    Last edited: May 19, 2018
  2. LucaMs

    LucaMs Expert Licensed User

    Perfect; I just realized that the "same code" in b4j does not shows the same animation (animations start from the corners of the view).



    Works SetLayoutAnimated differently in the two platforms?
     
    Last edited: May 18, 2018
  3. LucaMs

    LucaMs Expert Licensed User

    No, SetLayoutAnimated works in the same way on all platforms (b4a, b4j and, I guess, also b4i).
    Erel :eek::) pointed out to me the problem that is only in the sample project:
    Then the module will work well with b4j too.
     
    Last edited: May 18, 2018
  4. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    Ahh now i can unfold my color palette panel, thanks! :cool:
    ....
     
    LucaMs likes this.
  5. LucaMs

    LucaMs Expert Licensed User

    It would be more useful if you could also collapse a b4xView... but:

    1) I had no intention of developing stuff like this :p
    2) the best thing here is that you do not have to deal with the size of the view; if instead you want also to collapse it, you must store its size.

    Well, if someone wants also the possibility to collapse the view and they will ask for this, maybe I will add this feature.
     
  6. LucaMs

    LucaMs Expert Licensed User

    New version, with collapse; currently it is imperfect because of a small bug in SetLayoutAnimated (soon fixed by Aniwhere Software, I am sure :)).

    The minimum width of the first panel is set to 10dip, so you can touch it to open.

    1.gif

    Very simple code:
    Code:
    Sub Activity_Create(FirstTime As Boolean)
    '...
        ExpandView.Init
        ExpandView.AddView(Panel1, 
    2dip0, -1, ExpandView.EXPVW_DIR_BOTTOM_TO_TOP)
        ExpandView.AddView(Panel2, 
    2dip10dip, -1, ExpandView.EXPVW_DIR_LEFT_TO_RIGHT)
    End Sub


    Sub chkEpanded_CheckedChange(Checked As Boolean)
       ExpandView.Animate(Panel1, -
    1)
    End Sub

    Sub Panel2_Click
       ExpandView.Animate(Panel2, -
    1)
    End Sub
     
    Last edited: May 19, 2018
  7. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    I correct myself, now I can unfold my palette. :p Thanks!
     
    LucaMs likes this.
  8. LucaMs

    LucaMs Expert Licensed User

    I fear that you have to correct yourself again :D:(, since I have not yet posted the new module/library at the moment.
    This because it is not perfect; but probably I should not wait the next version of B4A !?
     
    Alexander Stolte likes this.
  9. LucaMs

    LucaMs Expert Licensed User

    Attached to the first post (B4A version only).
     
  10. LucaMs

    LucaMs Expert Licensed User

    Johan Hormaza likes this.
  11. LucaMs

    LucaMs Expert Licensed User

    Ok, now I have a CLASS which works very well but it uses the @Informatix' library NineOldAndroids, then it will work only with b4a.

    What should I do? I think a new thread! :(
     
  12. LucaMs

    LucaMs Expert Licensed User

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