B4A Library TimeLineView

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


B4X:
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 Bitmap= LoadBitmap(File.DirAssets,"ba.png")
    Dim checked As Bitmap= LoadBitmap(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),1dip, 50dip, -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
 

Attachments

  • ctimelineview.zip
    29.8 KB · Views: 196
  • ctimelineview (2).zip
    30 KB · Views: 173
  • ctimelineview (3).zip
    30 KB · Views: 242
Last edited:

Star-Dust

Expert
Licensed User
It would serve this method to reach a line:
B4X:
TimeLineRow1=TimeLineView1.GetTimeLine(ID as int)
 

Star-Dust

Expert
Licensed User
I am sorry I did not get your point
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
 

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?
 

somed3v3loper

Well-Known Member
Licensed User
In the Origine Library, you can obtain a time line both vertical and horizontal. How to make it with your wrap?
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

Expert
Licensed User
Thank's very much
 

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

B4X:
Sub GetRowfromID(TimeLn As TimeLineView,SizeTimeLine As Int,ID As String) As 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
 

somed3v3loper

Well-Known Member
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

B4X:
Sub GetRowfromID(TimeLn As TimeLineView,SizeTimeLine As Int,ID As String) As 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
I uploaded v3 . it has Size property
 

Star-Dust

Expert
Licensed User
Thanks, too kind I will not ask for any other changes ... I hope :p
 

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

B4X:
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 )
 

somed3v3loper

Well-Known 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

B4X:
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 )

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

Attachments

  • TimeLineView(2).zip
    30 KB · Views: 103
Top