B4A Library TimeLineView

Discussion in 'Additional libraries, classes and official updates' started by somed3v3loper, Jul 26, 2017.

  1. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    Yesterday, I found I have an old incomplete wrap of this https://github.com/vipulasri/Timeline-View github project (a wrap of old version) and decided to post it today after testing it


    timeline.jpg

    TimeLineView
    Author:
    SMM
    Version: 0.03
    • TimeLineRow
      Methods:
      • Initialize
      • IsInitialized As Boolean
      Properties:
      • BackgroundColor As Int
      • BackgroundSize As Int
      • BellowLineColor As Int
      • BellowLineSize As Int
      • Date As Long
      • Description As String
      • Id As Int
      • Image As Bitmap
      • ImageSize As Int
      • Title As String
    • TimeLineView
      Events:
      • _click (tlr As TimeLineRow, position As Int, id As Long)
      Fields:
      • ba As BA
      Methods:
      • BringToFront
      • GetRow (position As Int) As TimeLineRowWrapper
      • 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)
      • addStep (id As Int, dateticks As Long, title As String, description As String, image As Bitmap, bellowLineColor As Int, bellowLineSize As Int, imageSize As Int, backgroundColor As Int, backgroundSize As Int)
      • build (ArrangedByDate As Boolean)
      • notifyDataSetChanged
      Properties:
      • Background As Drawable
      • Color As Int [write only]
      • Enabled As Boolean
      • Height As Int
      • Left As Int
      • Padding()() As Int
      • Parent As Object [read only]
      • Size As Int [read only]
      • Tag As Object
      • Top As Int
      • Visible As Boolean
      • Width As Int


    Code:
    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.
        Dim ba As BitmapLoadBitmap(File.DirAssets,"ba.png")
        
    Dim checked As BitmapLoadBitmap(File.DirAssets,"checked.png")
    End Sub

    Sub Globals
        
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.
        Dim tl As TimeLineView
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
        'Activity.LoadLayout("Layout1")
        tl.Initialize("tl")
        
    Activity.AddView(tl,0,0,100%x,100%y)
        tl.addStep(
    1 ,DateTime.Now,"One step","This is first step", ba, Colors.RGB(95,158,160),1dip50dip, -1,10dip)
        tl.addStep(
    2 ,DateTime.Now,"Two step","This is second step",ba,Colors.RGB(95,158,160),1dip,50dip,-1,10dip )
        tl.addStep(
    2 ,DateTime.Now,"Third step","This is third step",ba,Colors.RGB(95,158,160),1dip,50dip,-1,10dip )
        tl.addStep(
    2 ,DateTime.Now,"Fourth step","This is bla bla step",ba,Colors.RGB(95,158,160),1dip,50dip,-1,10dip )
        tl.addStep(
    2 ,DateTime.Now,"5th step","This is bla bla step",ba,Colors.RGB(95,158,160),1dip,50dip,-1,10dip )
        tl.addStep(
    2 ,DateTime.Now,"6th step","This is bla bla step",ba,Colors.RGB(95,158,160),1dip,50dip,-1,10dip )
        tl.addStep(
    2 ,DateTime.Now,"7th step","This is bla bla step",ba,Colors.RGB(95,158,160),1dip,50dip,-1,10dip )
        tl.addStep(
    2 ,DateTime.Now,"8th step","This is bla bla step",ba,Colors.RGB(95,158,160),1dip,50dip,-1,10dip )

        tl.build(
    False)
    End Sub
    Sub tl_click(tlr As TimeLineRow,position As Int,id As Long)
        tlr.Description=
    "Modified"&id
        tlr.Image=checked
        tlr.Date=
    DateTime.Now
        
    'not sure it is a good practice to call notifyDataSetChanged here
        tl.notifyDataSetChanged
    End Sub
    Version 2 adds GetRow(position as int) method
    Version adds Size property
     

    Attached Files:

    Last edited: Jul 27, 2017
  2. Star-Dust

    Star-Dust Expert Licensed User

    It would serve this method to reach a line:
    Code:
    TimeLineRow1=TimeLineView1.GetTimeLine(ID as int)
     
  3. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    I am sorry I did not get your point
     
  4. Star-Dust

    Star-Dust Expert Licensed User

    Thank you. This method is used to modify a line without having to click. Maybe with a Timer and as it advances a function or process.

    Thanks however is an interesting Library
     
    somed3v3loper likes this.
  5. Star-Dust

    Star-Dust Expert Licensed User

    In the Origine Library, you can obtain a time line both vertical and horizontal. How to make it with your wrap?
     
  6. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    I uploaded version 2 which adds GetRow(position as int) method . I did not find a way to get by id .
    Please note that this wrap is incomplete and for an older version of original github library .
     
    Star-Dust likes this.
  7. Star-Dust

    Star-Dust Expert Licensed User

    Thank's very much
     
  8. Star-Dust

    Star-Dust Expert Licensed User

    I found how to do it. But I have to have a variable apart from the number of rows.
    Do I ask too much if I ask you to enter the TimeLineView.Size method? :p:p:p

    Sorry if you have problems, it is already a good Library, these little tricks will further improve it :D:D:D

    Code:
    Sub GetRowfromID(TimeLn As TimeLineView,SizeTimeLine As Int,ID As StringAs TimeLineRow

        
    For i=0 To SizeTimeLine-1
            
    Dim TimeLineRow1 As TimeLineRow = TimeLn.GetRow(i)
            
    If TimeLineRow1.Id=ID Then Return TimeLineRow1
        
    Next
        
    Return Null
    End Sub
     
  9. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    I uploaded v3 . it has Size property
     
    eps, Star-Dust and DonManfred like this.
  10. Star-Dust

    Star-Dust Expert Licensed User

    Thanks, too kind I will not ask for any other changes ... I hope :p
     
  11. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    No problem :)
     
  12. Nickle

    Nickle Member Licensed User

    Thanks so much for this library. Hoping if the DateTime could be left to accept Datetime or string from server. So I can decide what DateTime I put in. I am using it a a view only to show status of a set of activities and will like to show when a specific activity completed

    Code:
    tl.addStep(2 ,DateTime.Now,"Fourth step","This is bla bla step",ba,Colors.RGB(95,158,160),1dip,20dip,-1,10dip )
        tl.addStep(
    2 ,DateTime.Now,"5th step","This is bla bla step",ba,Colors.RGB(95,158,160),1dip,20dip,-1,10dip )
        tl.addStep(
    2 ,DateTime.Now,"6th step","This is bla bla step",ba,Colors.RGB(95,158,160),1dip,20dip,-1,10dip )
     
  13. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    I think you will like this not-very-neat update and modification
    Date field is now just another textview like title and description
     

    Attached Files:

    icarus and DonManfred like 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