B4A Library SD: Panel Extra (Slide Swap Scroll)

Discussion in 'Additional libraries, classes and official updates' started by Star-Dust, Sep 7, 2017.

  1. Star-Dust

    Star-Dust Expert Licensed User

    (No WRAP, No Java Only B4A)

    The PanelExtra library contains these classes
    PanelNavigator (Example)

    1.png 2.gif
    SlidePanel (Example)
    slide2.gif Slide1.gif
    TitleScrollView (Example)
    3.gif
    SwipePanel (Example)
    Swipe1.gif
    ManagerPanel (Example)
    ManagerPanel.gif

    SD_PanelExtra


    Author: Star-Dust
    Version: 0.11
    • PanelNavigator
      • Events:
        • ChangePanel (NumberPanel As Int)
      • Fields:
        • BallSize As Int
        • NameDrawable As String
      • Functions:
        • Add (Name As String, Color As Int, Icon As Bitmap) As Int
          Add Name Panel, Color panel, Icon and return index of panel
        • Add2 (Name As String, Color As Int, Icon As Bitmap) As Panel
          Add Name Panel, Color panel, Icon and return panel
        • AddAt (Name As String, Color As Int, Icon As Bitmap, Index As Int) As String
          Add Name Panel, Color panel, Icon at specific position
        • AddMyPanel (Index As Int, Panel As Panel) As String
          PanelNavigator.AddMyPanel(0,Panel3)
        • Class_Globals As String
        • Clear As String
          Remove all panel
        • DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) As String
        • GetBase As Panel
        • GetPanel (Index As Int) As Panel
          Get Panel at Index
        • GetPanelName (Index As Int) As String
          Get Name of Panel
        • GetSelectPanel As Int
          Get Panel to be Visible
        • GetVisible As Boolean
        • Initialize (vCallback As Object, vEventName As String) As String
        • Invalidate As String
          Rewrite all design
        • IsInitialized As Boolean
          Tests whether the object has been initialized.
        • SetBackGroundColor (Color As Int) As String
          Change color of background
        • SetIcon (Index As Int, B As Bitmap) As String
          Set Icon at panel position
        • SetIconPanelVisible (Visible As Boolean) As String
          Set Visible/Invisible Icon Panel
        • SetLayout (Left As Int, Top As Int, Width As Int, Height As Long) As String
        • SetNamePanelVisible (Visible As Boolean) As String
          Set Visible/Invisible Label with NamePanel
        • setPadding (Left As Int, Top As Int, Right As Int, Bottom As Int) As String
        • SetPanelName (Index As Int, Name As String) As String
          Set Name of Panel
        • SetSelectPanel (Index As Int) As String
          Set Panel to be Visible
        • SetTextColorNamePanel (Color As Int) As String
          Set text Color ofa Name Panel if visible
        • SetVisible (Visible As Boolean) As String
        • Size As Int
          Number of panel insert
    • SlidePanel ' Slide Up/Down/Left/Right
      • Events:
        • Close (FromCode As Boolean)
        • Open (FromCode As Boolean)
      • Fields:
        • PanelSlide As Panel
        • SlidePanelAnchor As Int
        • CloseAutomatically As Boolean
        • IsOpen As Boolean
      • Functions:
        • Class_Globals As String
        • CloseSlidePanel As String
        • DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) As String
        • GetBase As Panel
        • Initialize (vCallback As Object, vEventName As String) As String
        • Invalidate As String
        • IsInitialized As Boolean
        • OpenSlidePanel As String
        • SetSlideLeft As String
        • SetSlideRight As String
        • SetSlideUp As String
        • SetSlideDown As String
      • Properties:
        • SlidePanelWidth As Int
        • SlidePanelHeight As Int
    • TitleScrollView
      • Fields:
        • FullHeight As Int
        • MyTitleFull As Panel
        • MyTitleReduced As Panel
        • ReduceHeight As Int
        • Scroll As Panel
      • Functions:
        • AddTitleFull (Panel As Panel) As String
        • AddTitleReduce (Panel As Panel) As String
        • Class_Globals As String
        • DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) As String
        • GetBase As Panel
        • Initialize (vCallback As Object, vEventName As String) As String
        • IsInitialized As Boolean
          Tests whether the object has been initialized.
      • ManagerPanel
        • Events:
          • Change (FromCode As Boolean, ID As String)
        • Functions:
          • Class_Globals As String
          • Clear As String
          • DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) As String
          • GetBase As Panel
          • getPanel (Position As Int) As Panel
          • getPanelfromID (ID As String) As Panel
          • getPanelOnScreen As Int
          • Initialize (vCallback As Object, vEventName As String) As String
          • Invalidate As String
          • IsInitialized As Boolean
            Verifica se l'oggetto sia stato inizializzato.
          • NewPanel (Title As String, ID As String, ColorTitle As Int, ColorPanel As Int) As Panel
          • setPanelOnScreen (Position As Int) As String
        • Properties:
          • PanelOnScreen As Int

    For other panel libraries see also this thread

    1.gif 2.gif 3.gif
     

    Attached Files:

    Last edited: Aug 23, 2018
  2. Star-Dust

    Star-Dust Expert Licensed User

    Example Panel Navigator

    Code:
    Sub Globals
        
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.
        Private PanelNavigator1 As PanelNavigator
        
    Dim Color() As Int = Array As Int(0xffffffff,0xffc1ffbf,0xff009699,0xffcd1515,0xffa786ee)
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    Activity.LoadLayout("panelMain")

        
    For i=0 To 4
            PanelNavigator1.Add(i,Color(i),
    LoadBitmap(File.DirAssets,(i+1) & ".png"))
        
    Next

        PanelNavigator1.Add(
    "Name 5",Colors.Blue,Null)
        
    ' Also
        ' PanelNavigator1.Add2("Name 5",Colors.Blue,Null).LoadLayout("mypanel")
        ' Or
        ' Dim I as int = PanelNavigator1.Add("Name 5",Colors.Blue,Null)
         ' PanelNavigator1.GetPanel(I).LoadLayout("mypanel")

        
    Dim L As Label
        L.Initialize(
    "")
        L.Gravity=
    Gravity.CENTER
        L.Text=
    "First Panel"
        L.TextColor=
    Colors.Black
        L.TextSize=
    20
        
    ' Find first panel and Add a Label
        PanelNavigator1.GetPanel(0).AddView(L,0,0,100%x,40dip)
    End Sub

    Example TitleScroll
    Code:
    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
        Activity.LoadLayout("main")
        TitleScrollView1.MyTitleReduced.LoadLayout(
    "reduced")
        TitleScrollView1.MyTitleFull.LoadLayout(
    "full")
        TitleScrollView1.Scroll.Color=
    Colors.Yellow
        
    For i= 1 To 30
            
    Dim Label1 As Label
        
            Label1.Initialize(
    "")
            Label1.Text=
    "Item " & I
            Label1.Textcolor=
    Colors.Black
        
            TitleScrollView1.Scroll.AddView(Label1,
    0,(i-1)*40dip,100%x,40dip)
            TitleScrollView1.Scroll.Height=i * 
    40dip
        
    Next

    End Sub
     

    Attached Files:

    Last edited: Nov 15, 2017
  3. Star-Dust

    Star-Dust Expert Licensed User

    Update to 0.02
    It can make Visible Label with the name of the panel
    • seticonpanelvisible (Visible As Boolean) As String
      Make visible or Invisible Label Name of panel
    • setNamepanelVisible (Visible As Boolean) As String
      Make visible or Invisible icon of panel
    • SetTextColorNamePanel(Color As Int)
      Set a texto Color of Name Panel if visible
    Add new metod
      • addAt (Name As String, Color As Int, Icon As BitmapWrapper, Position As Int) As String
        Now accept icon null
    AddAt: Insert a new panel to a specific position

    Update to 0.03

    1) Add new metod to PanelNavigator (return a panel added)
    add2 (Name As String, Color As Int, Icon As BitmapWrapper) As Panel
    SetNamePanelVisible (Visible As Boolean) As String
    SetIcon (Index As Int, B As Bitmap) As String

    2) Insert TitleScrollView Panel

    Update to 0.04
    FIX BUG TitleScroll
    You can scroll through the center panel and as you can see lower the title panel in smaller dimensions and turn into another smaller panel

    Update to 0.05
    Add SlidePanel
    You can open a side panel (right, left, top, bottom) just by dragging your finger from the edge and you'll see the panel
     
    Last edited: Nov 19, 2017
    Cableguy and Almora like this.
  4. davelew1s

    davelew1s Active Member Licensed User

    Hi
    Star-Dust
    I have downloaded the libs and example it seems to work ok. I have played around adding other views witout any problems.
    The only thing I get is this error:-
    "ERROR.LoadDrawableByName:android.content.res.Resources$NotFoundException: Resource ID #0x0"
    it occures on this line:-
    ' PanelNavigator1.Add(i,Color(i),LoadBitmap(File.DirAssets,(i+1) & ".png"))'
    it doesn't seem to cause any problems but I cannot find the cause and a solution ... any idea's?
    Thanks for your work I will find it very useful.
    Dave.
     
  5. Star-Dust

    Star-Dust Expert Licensed User

    This error occurs if you change the "NameDrawable" property, default value is "magnified_region_frame"
    also: download the latest version of the library
     
  6. davelew1s

    davelew1s Active Member Licensed User

    Star-Dust
    Thanks the version of the library has cured it. Can't wait to use it now.
    Dave.
     
  7. Star-Dust

    Star-Dust Expert Licensed User

    Update to 0.03

    1) Add new metod to PanelNavigator (return a panel added)
    add2 (Name As String, Color As Int, Icon As BitmapWrapper) As Panel
    SetNamePanelVisible (Visible As Boolean) As String
    SetIcon (Index As Int, B As Bitmap) As String
    2) Insert TitleScrollView Panel

    See Post#1 for Library
    See post#3 for Sample
     
    Last edited: Nov 16, 2017
    Almora likes this.
  8. Medexpert

    Medexpert Member Licensed User

    Hello,
    Could you help me where can I found the library?
    Thanks,
    Istvan
     
  9. giannimaione

    giannimaione Well-Known Member Licensed User

    missing library?
     
  10. Star-Dust

    Star-Dust Expert Licensed User

    Write me privately and I will send you the library and give you an indication to make a donation.
     
  11. Star-Dust

    Star-Dust Expert Licensed User

    Update to 0.05
    New SlidePanel Class
    You can add a side panel that opens by squeezing your finger to the right.
    In this panel you can enter a list, a menu or anything else.
    SlidePanel slider right / left / top / bottom
    Code:
    ' SLIDE PANEL
    SlidePanel1.GetBase.Elevation=2dip
    SlidePanel1.PanelSlide.LoadLayout(
    "List")
    Slide1.gif slide2.gif
     

    Attached Files:

    Last edited: May 13, 2018
  12. Star-Dust

    Star-Dust Expert Licensed User

    Next Update: SwipePanel, You can close a scroll panel with your finger in a preset direction (right, left, top, bottom)
    7.gif 3.gif Swipe1.gif
     

    Attached Files:

    Last edited: May 13, 2018
  13. Star-Dust

    Star-Dust Expert Licensed User

    The ManagerPanel Class has been added

    Code:
    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
        'Activity.LoadLayout("Layout1")
        Activity.LoadLayout("main_managerpanel")

        ManagerPanel1.NewPanel(
    "First",1,Colors.RGB(255,216,0),Colors.RGB(127,0,0))
        ManagerPanel1.NewPanel(
    "Second",2,Colors.Yellow,Colors.RGB(107,63,127))
        ManagerPanel1.NewPanel(
    "Third",3,Colors.RGB(127,0,0),Colors.RGB(255,216,0))
        ManagerPanel1.NewPanel(
    "Fourth",4,Colors.Black,Colors.White)
                
        
    Dim L As Label
        L.Initialize(
    "")
        L.Text=
    "My Label"
        L.TextSize=
    20
        L.TextColor=
    Colors.White
                
        ManagerPanel1.getPanel(
    0).AddView(l,30dip,20dip,100dip,40dip)
        ManagerPanel1.getPanelfromID(
    1).Color=Colors.ARGB(150,150,150,150)
        
    End Sub
    ' -------------------------------------

    Sub ManagerPanel1_Change (FromCode As Boolean, ID As String)
        
        
    Log(FromCode & "-" & ID)
    End Sub
    ManagerPanel.gif ManPanOr.gif
     

    Attached Files:

    Johan Hormaza likes this.
  14. Star-Dust

    Star-Dust Expert Licensed User

    Update to 0.08 on post#1
    Fix bug
     
    Almora likes this.
  15. Carlos marin

    Carlos marin Active Member Licensed User

    Hi star-dust I have a doubt, when trying to close the panel with your finger, it is positioned where you put your finger and it does not close. It feels as if one is fighting with the panel. Can you deactivate that event so that the panel closes easily with your finger?
     
  16. Star-Dust

    Star-Dust Expert Licensed User

    I do not think I understand what you mean
     
  17. Carlos marin

    Carlos marin Active Member Licensed User

    hello Star-Dust the truth is that I like this panel very much but I have that problem when using it, sorry for my bad english but it is the same as you comment in the spañol forum (see image).
     

    Attached Files:

  18. Star-Dust

    Star-Dust Expert Licensed User

    Now I remember your question, Unfortunately I do not understand English well either.

    Does it vibrate when you touch the panel to get it back?
    Have you tried to click on the outside of the panel? because so it should be closed automatically
     
  19. Carlos marin

    Carlos marin Active Member Licensed User

    hello again and thanks for replying. when you want to close the panel by sliding the screen, it does not close. the panel opens up to where you touch the screen. What I wanted was to deactivate that event to simply close the panel by sliding the screen
     
  20. Star-Dust

    Star-Dust Expert Licensed User

    The behavior is correct because the idea is just that, that the panel follows the finger. Even if you can open the panel you can drag it.

    Exceptionally to facilitate you I added (rel 0.10) a new property: CloseAutomatically Boolean type.
    Setting it to true if the panel is open will automatically close if you touch the edge of the panel and do not follow your finger.

    But do not get used to asking for new features :p
     
    moster67 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