B4A Library [B4X] [XUI] AS TimePicker

This is a simple TimePicker, with android style.

I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal or with a coffee. :)

Animation.gif
MinuteSteps.gif
12h Format.gif

Events
  • SelectedHourChanged and SelectedMinuteChanged
    • This event is triggered every time the pointer moves
  • SelectedHour and SelectedMinute
    • This event is triggered when you release the pointer
  • SelectionDone
    • This event is triggered when an hour and minute is selected
Designer Properties
  • AutoSwitch
    • If True then automatically switches to minutes when the user releases the clock during hour selection
  • MinuteSteps
    • Indicates in how many steps the selector can be moved
    • Example: 5 = the pointer only moves in 5 minute increments
  • TimeFormat
    • If 24h then 2 rows are displayed
    • If 12h just 1 row are visible
1697292707394.png

ASTimePicker
Author: Alexander Stolte
Version: 1.00

  • AS_TimerPicker
    • Events:
      • SelectedHour (Hour As Int)
      • SelectedHourChanged (Hour As Int)
      • SelectedMinute (Minute As Int)
      • SelectedMinuteChanged (Minute As Int)
      • SelectionDone (Hour As Int, Minute As Int)
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • Class_Globals As String
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • getAutoSwitch As Boolean
      • getBackgroundColor As Int
      • getCurrentMode_HourSelection As String
      • getCurrentMode_MinuteSelection As String
      • getMinuteSteps As Int
      • getTextColor As Int
      • getThumbColor As Int
      • getThumbLineColor As Int
      • getTimeFormat As String
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Refresh As String
      • setAutoSwitch (Auto As Boolean) As String
      • setBackgroundColor (Color As Int) As String
      • setCurrentMode (Mode As String) As String
      • setMinuteSteps (Steps As Int) As String
      • setTextColor (Color As Int) As String
      • setThumbColor (Color As Int) As String
      • setThumbLineColor (Color As Int) As String
      • setTimeFormat (Format As String) As String
    • Properties:
      • AutoSwitch As Boolean
      • BackgroundColor As Int
      • CurrentMode
      • CurrentMode_HourSelection As String [read only]
      • CurrentMode_MinuteSelection As String [read only]
      • MinuteSteps As Int
      • TextColor As Int
      • ThumbColor As Int
      • ThumbLineColor As Int
      • TimeFormat As String
Changelog
  • 1.00
    • Release
  • 1.01
    • BugFixes
  • 1.02 (read more)
    • BugFixes
    • Add get and set Hours
    • Add get and set Minutes
  • 1.03 (read more)
    • Add SmoothModeChange - Fade in mode change
  • 1.04
    • 12h Format now has a 12 at the top
  • 1.05
    • BugFix
  • 1.06
    • BugFix
  • 1.07
    • Add get CurrentMode
  • 1.08
    • BugFixes
    • Visual Improvements
    • The Thumb is now behind the Text, so you can now use thumb colors with full alpha
    • Add get and set FontSize
      • Default: 15
    • Add get and set SecondRowGap
      • Default: 5dip
  • 1.09
    • BugFix
  • 1.10
    • BugFix in set Hours
  • 1.11
    • B4A BugFix
Have Fun :)
 

Attachments

  • AS TimePicker Example.zip
    10.4 KB · Views: 617
  • AS_TimePicker.b4xlib
    4.2 KB · Views: 309
Last edited:

arvin

Member
I did , but got this errors:

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
b4xmainpage_b4xpage_created (java line: 66)
java.lang.RuntimeException: java.lang.ClassNotFoundException: b4a.example.as_timerpicker
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:312)
at b4a.example.b4xmainpage._b4xpage_created(b4xmainpage.java:66)
at b4a.example.b4xmainpage.callSub(b4xmainpage.java:90)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1066)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1037)
at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:522)
at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:859)
at b4a.example.b4xpagesmanager._addpage(b4xpagesmanager.java:199)
at b4a.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:206)
at b4a.example.b4xpagesmanager._initialize(b4xpagesmanager.java:710)
at b4a.example.main._activity_create(main.java:365)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.example.main.afterFirstLayout(main.java:105)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6138)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
Caused by: java.lang.ClassNotFoundException: b4a.example.as_timerpicker
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at java.lang.Class.forName(Class.java:326)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:389)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:453)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
... 24 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "b4a.example.as_timerpicker" on path: DexPathList[[zip file "/data/app/b4a.example-2/base.apk"],nativeLibraryDirectories=[/data/app/b4a.example-2/lib/x86, /system/lib, /vendor/lib, /data/downloads, /data/priv-downloads]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 30 more
 

jvetterli

Member
Licensed User
Longtime User
Hi Alexander,
Thanks for this nice lib, how am I able to detect if I'm in hour or minute mode?
-CurrentMode is write only
-CurrentMode_HourSelection/CurrentMode_MinuteSelection just returns HourSelection/MinuteSelection as a string
Your description states there should be get and set functions, which I'm not able to find
 

Espinosa4

Active Member
Licensed User
Longtime User
if I use the edits writing the hour (12) it works fine but I have the edits disabled I only use the finger.
 
Top