B4A Library StepView

Step by step,just use HorizontalStepView,VerticalStepView. step indicator,flow indicator,timeline,order process,express status .This is a WRAP from This Github Project.
StepView
Version:
0.2
  • HorizontalStepView
    Fields:
    • ba As anywheresoftware.b4a.BA
    Methods:
    • DesignerCreateView (base As anywheresoftware.b4a.objects.PanelWrapper, lw As anywheresoftware.b4a.objects.LabelWrapper, props As anywheresoftware.b4a.objects.collections.Map) As void
    • IsInitialized As boolean
    • Initialize (ba As anywheresoftware.b4a.BA, EventName As java.lang.String) As void
    • BringToFront As void
    • SetLayout (arg0 As int, arg1 As int, arg2 As int, arg3 As int) As void
    • SendToBack As void
    • SetVisibleAnimated (arg0 As int, arg1 As boolean) As void
    • RemoveView As void
    • AddToParent (Parent As android.view.ViewGroup, left As int, top As int, width As int, height As int) As void
    • Invalidate3 (arg0 As int, arg1 As int, arg2 As int, arg3 As int) As void
    • Invalidate2 (arg0 As android.graphics.Rect) As void
    • SetColorAnimated (arg0 As int, arg1 As int, arg2 As int) As void
    • SetBackgroundImageNew (arg0 As android.graphics.Bitmap) As anywheresoftware.b4a.objects.drawable.BitmapDrawable
    • Invalidate As void
    • SetLayoutAnimated (arg0 As int, arg1 As int, arg2 As int, arg3 As int, arg4 As int) As void
    • RequestFocus As boolean
    Properties:
    • StepsViewIndicatorUnCompletedLineColor As int [write only]
    • Left As int
    • Background As android.graphics.drawable.Drawable
    • Parent As java.lang.Object [read only]
    • StepsViewIndicatorDefaultIcon As android.graphics.drawable.Drawable [write only]
    • Color As int [write only]
    • TextSize As int [write only]
    • Enabled As boolean
    • StepViewComplectedTextColor As int [write only]
    • StepsViewIndicatorCompleteIcon As android.graphics.drawable.Drawable [write only]
    • StepsViewIndicatorCompletedLineColor As int [write only]
    • StepViewTexts As java.util.List [write only]
    • Top As int
    • Visible As boolean
    • Padding As int[]
    • Height As int
    • Tag As java.lang.Object
    • Width As int
    • StepsViewIndicatorAttentionIcon As android.graphics.drawable.Drawable [write only]
    • StepViewUnComplectedTextColor As int [write only]
  • StepBean
    Fields:
    • STEP_UNDO As int
    • STEP_COMPLETED As int
    • STEP_CURRENT As int
    Methods:
    • IsInitialized As boolean
    • Initialize (name As java.lang.String, state As int) As void
    Properties:
    • State As int
    • Name As java.lang.String
  • VerticalStepView
    Fields:
    • ba As anywheresoftware.b4a.BA
    Methods:
    • DesignerCreateView (base As anywheresoftware.b4a.objects.PanelWrapper, lw As anywheresoftware.b4a.objects.LabelWrapper, props As anywheresoftware.b4a.objects.collections.Map) As void
    • IsInitialized As boolean
    • Initialize (ba As anywheresoftware.b4a.BA, EventName As java.lang.String) As void
    • BringToFront As void
    • SetLayout (arg0 As int, arg1 As int, arg2 As int, arg3 As int) As void
    • SendToBack As void
    • SetVisibleAnimated (arg0 As int, arg1 As boolean) As void
    • reverseDraw (isReverSe As boolean) As void
    • RemoveView As void
    • AddToParent (Parent As android.view.ViewGroup, left As int, top As int, width As int, height As int) As void
    • Invalidate3 (arg0 As int, arg1 As int, arg2 As int, arg3 As int) As void
    • Invalidate2 (arg0 As android.graphics.Rect) As void
    • SetColorAnimated (arg0 As int, arg1 As int, arg2 As int) As void
    • SetBackgroundImageNew (arg0 As android.graphics.Bitmap) As anywheresoftware.b4a.objects.drawable.BitmapDrawable
    • Invalidate As void
    • SetLayoutAnimated (arg0 As int, arg1 As int, arg2 As int, arg3 As int, arg4 As int) As void
    • RequestFocus As boolean
    Properties:
    • StepsViewIndicatorUnCompletedLineColor As int [write only]
    • Left As int
    • Background As android.graphics.drawable.Drawable
    • Parent As java.lang.Object [read only]
    • StepsViewIndicatorDefaultIcon As android.graphics.drawable.Drawable [write only]
    • Color As int [write only]
    • TextSize As int [write only]
    • Enabled As boolean
    • StepsViewIndicatorComplectingPosition As int [write only]
    • StepViewComplectedTextColor As int [write only]
    • StepsViewIndicatorCompleteIcon As android.graphics.drawable.Drawable [write only]
    • StepsViewIndicatorCompletedLineColor As int [write only]
    • StepViewTexts As java.util.List [write only]
    • Top As int
    • Visible As boolean
    • Padding As int[]
    • Height As int
    • Tag As java.lang.Object
    • Width As int
    • StepsViewIndicatorAttentionIcon As android.graphics.drawable.Drawable [write only]
    • StepViewUnComplectedTextColor As int [write only]

  • Fields:
    • uncompleted_color As int
    • uncompleted_text_color As int

  • Fields:
    • complted As int
    • attention As int
    • default_icon As int

  • Fields:
    • widget_horizontal_stepsview As int
    • widget_vertical_stepsview As int

  • Fields:
    • steps_indicator As int
    • rl_text_container As int
B4X:
#Region  Project Attributes
    #ApplicationLabel: StepViewB4A
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    #AdditionalRes: ..\res
    #AdditionalJar: com.android.support:support-v4
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

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.

    Private HorizontalStepView1 As HorizontalStepView
    Private VerticalStepView1 As VerticalStepView
    Dim  stepsBeanList,list0 As List
    Dim stepBean0,stepBean1,stepBean2,stepBean3,stepBean4,stepBean5 As StepBean
    Dim bdCompleted,bdDefault,bdAttention As BitmapDrawable
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")
    stepsBeanList.Initialize
    list0.Initialize
    
    'bdCompleted.Initialize(LoadBitmap(File.DirAssets,"complted.png"))
    'bdDefault.Initialize(LoadBitmap(File.DirAssets,"default_icon.png"))
    'bdAttention.Initialize(LoadBitmap(File.DirAssets,"attention.png"))
    
    bdCompleted.Initialize(LoadBitmap(File.DirAssets,"checked.png"))
    bdDefault.Initialize(LoadBitmap(File.DirAssets,"neutral.png"))
    bdAttention.Initialize(LoadBitmap(File.DirAssets,"hourglass.png"))
    
    stepBean0.Initialize("1-接单",stepBean0.STEP_COMPLETED)
    stepBean1.Initialize("2-打包",stepBean0.STEP_COMPLETED)
    stepBean2.Initialize("3-出发",stepBean0.STEP_CURRENT)
    stepBean3.Initialize("4-送单",stepBean0.STEP_CURRENT)
    stepBean4.Initialize("5-完成",stepBean0.STEP_UNDO)
    stepBean5.Initialize("6-支付",stepBean0.STEP_UNDO)
    stepsBeanList.add(stepBean0)
    stepsBeanList.add(stepBean1)
    stepsBeanList.add(stepBean2)
    stepsBeanList.add(stepBean3)
    stepsBeanList.add(stepBean4)
    stepsBeanList.add(stepBean5)
    
    HorizontalStepView1.StepViewTexts = stepsBeanList
    
    HorizontalStepView1.TextSize = 16
    HorizontalStepView1.StepsViewIndicatorCompletedLineColor = Colors.Green
    HorizontalStepView1.StepsViewIndicatorUnCompletedLineColor = Colors.Red
    HorizontalStepView1.StepViewComplectedTextColor = Colors.Green
    HorizontalStepView1.StepViewUnComplectedTextColor= Colors.Yellow
    HorizontalStepView1.StepsViewIndicatorCompleteIcon= bdCompleted
    HorizontalStepView1.StepsViewIndicatorDefaultIcon= bdDefault
    HorizontalStepView1.StepsViewIndicatorAttentionIcon= bdAttention

    list0.add("1-您已提交定单,等待系统确认")
    list0.add("2-您的商品需要从外地调拨,我们会尽快处理,请耐心等待")
    list0.add("3-您的订单已经进入亚洲第一仓储中心1号库准备出库")
    list0.add("4-您的订单预计6月23日送达您的手中,618期间促销火爆,可能影响送货时间,请您谅解,我们会第一时间送到您的手中")
    list0.add("5-您的订单已打印完毕")
    list0.add("6-您的订单已拣货完成")
    list0.add("7-扫描员已经扫描")
    list0.add("8-打包成功")
    list0.add("9-您的订单在京东【华东外单分拣中心】发货完成,准备送往京东【北京通州分拣中心】")
    list0.add("10-您的订单在京东【北京通州分拣中心】分拣完成")
    list0.add("11-您的订单在京东【北京通州分拣中心】发货完成,准备送往京东【北京中关村大厦站】")
    list0.add("12-您的订单在京东【北京中关村大厦站】验货完成,正在分配配送员")
    list0.add("13-配送员【包牙齿】已出发,联系电话【130-0000-0000】,感谢您的耐心等待,参加评价还能赢取好多礼物哦")
    list0.add("14-感谢你在京东购物,欢迎你下次光临!")
    VerticalStepView1.StepsViewIndicatorComplectingPosition = (list0.Size - 9)
    VerticalStepView1.reverseDraw(False)
    VerticalStepView1.TextSize= 14
    VerticalStepView1.StepViewTexts= list0
    VerticalStepView1.StepsViewIndicatorCompletedLineColor = Colors.Green
    VerticalStepView1.StepsViewIndicatorUnCompletedLineColor = Colors.Red
    VerticalStepView1.StepViewComplectedTextColor = Colors.Green
    VerticalStepView1.StepViewUnComplectedTextColor= Colors.Yellow
    VerticalStepView1.StepsViewIndicatorCompleteIcon= bdCompleted
    VerticalStepView1.StepsViewIndicatorDefaultIcon= bdDefault
    VerticalStepView1.StepsViewIndicatorAttentionIcon= bdAttention

End Sub


Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Capture.JPG
 

Attachments

  • StepViewB4A.zip
    56 KB · Views: 423

stanks

Active Member
Licensed User
Longtime User
hi

nice work, but i have one problem. your example is not scrolling the list not on emulator with v5 of android not on real device with v8.
any idea?

thanks
 

jahswant

Well-Known Member
Licensed User
Longtime User
Yes that’s true ! It doesn’t scroll. Use a scrollview and estimate the height of your list.
 

stanks

Active Member
Licensed User
Longtime User
i tried this but failed. sc is scrollview added with designer and vertical step view is deleted in designer. i added variables to Globals region and tried next code:
B4X:
VerticalStepView1.Initialize("vsv")
sv.Panel.AddView(VerticalStepView1, 0, 0, sv.Panel.Width, sv.Panel.Height)
...
...
    VerticalStepView1.Height = sv.Panel.Height
'    VerticalStepView1.Height = sv.Height
...

you can see that i tried to set vertical step view height to scroll view panels height but i don't have all 14 items (from your example...i am playing with your example to achive this) when i scroll.
i tried to set vertical step view height to scroll view height but i get the same result.

thanks
 

jahswant

Well-Known Member
Licensed User
Longtime User
you can see that i tried to set vertical step view height to scroll view panels height but i don't have all 14 items (from your example...i am playing with your example to achive this) when i scroll.
i tried to set vertical step view height to scroll view height but i get the same result.
I’m not at my computer now ! Will try tomorrow !
 

cristian petersen

Member
Licensed User
Longtime User
I am trying this library without being able to run it. It compiles but when trying to run on emulator craches with this log:

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at b4a.step.main._activity_create(main.java:402)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.step.main.afterFirstLayout(main.java:105)
at b4a.step.main.access$000(main.java:17)
at b4a.step.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
... 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat;
at com.baoyachi.stepview.HorizontalStepView.<init>(HorizontalStepView.java:28)
at com.baoyachi.stepview.HorizontalStepView.<init>(HorizontalStepView.java:40)
at com.baoyachi.stepview.HorizontalStepView.<init>(HorizontalStepView.java:35)
at cm.jahswant.stepview.HorizontalStepViewWrapper._initialize(HorizontalStepViewWrapper.java:35)
... 21 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.ContextCompat" on path: DexPathList[[zip file "/data/app/b4a.step-U8RbWy_QQahkPIPM2b2gwQ==/base.apk"],nativeLibraryDirectories=[/data/app/b4a.step-U8RbWy_QQahkPIPM2b2gwQ==/lib/x86_64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)

 
Top