B4A Library TimePicker V1.0

TimePicker
Version:
1
  • TimePicker
    Events:
    • timechanged (date as Long As )
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • IsInitialized As Boolean
    • disableTouch (disableTouch As Boolean)
    • enableTwentyFourHour (twentyFour As Boolean)
    Properties:
    • ClockColor As Int [write only]
    • Color As Int [write only]
    • DialColor As Int [write only]
    • Left As Int
    • TextColor As Int [write only]
    • Time As Long
    • Top As Int

TimePicker002.png


This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate (You can donate any amount you want to donate for the library (or my work) :)
 

Attachments

  • libTimePicker_v1.0.0.zip
    7.8 KB · Views: 743
  • TimePickerEx.zip
    11 KB · Views: 695

Peter Simpson

Expert
Licensed User
Longtime User
Hiya @DonManfred.
You habe a sub called the following
B4X:
Sub TP_TimeChanged(date As Long)
Surely date should be called something else that is logical, maybe SetTime, SelectedTime, AlarmTime or just anything with the word time included with it. I only mention this as date could easily be confused with Date as it says date but actually returns the time.

It's a nice library and it works really well, cheers...
 

DonManfred

Expert
Licensed User
Longtime User
Surely date should be called something else that is logical, maybe SetTime, SelectedTime, AlarmTime or just anything with the word time included with it. I only mention this as date could easily be confused with Date as it says date but actually returns the time.
You are right. It may be irritating... Will change it. The lib is a quick and dirty wrap. I made the wrapper in 20 to 30 minutes or so... ;) It was never so easy to wrap a lib like this one...
 

rboeck

Well-Known Member
Licensed User
Longtime User
One idea for the timepicker: If you want to plan a date, you will most of the time use rounded values, from 5 minutes to 15 or 30 minute steps. So maybe this could be an option to make an step parameter and you get back rounded time values.
 

DonManfred

Expert
Licensed User
Longtime User
It is just a wrapper for this library. I dont wrote the logic. I just made a wrapper to be used in b4a.
Maybe you find the formular in this java-file (this is ALL of the library). I did not looked for it actually. But there are some formulas to calc degrees and so

btw: I like the idea
 

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Everyone,

How do I convert the time from the clock into HH:mm?

B4X:
Sub PickedTime_timechanged(date As Long)
   ' strPickedTime = the hours and minutes go here.
End Sub

Thanks.
 

rleiman

Well-Known Member
Licensed User
Longtime User
Thanks.

Here's the code I used.

B4X:
    DateTime.TimeFormat = "HH:mm"

    StrPickedTime = "Time picked is: " & DateTime.Time(date)
 

rleiman

Well-Known Member
Licensed User
Longtime User
TimePicker
Version:
1
  • TimePicker
    Events:
    • timechanged (date as Long As )
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • IsInitialized As Boolean
    • disableTouch (disableTouch As Boolean)
    • enableTwentyFourHour (twentyFour As Boolean)
    Properties:
    • ClockColor As Int [write only]
    • Color As Int [write only]
    • DialColor As Int [write only]
    • Left As Int
    • TextColor As Int [write only]
    • Time As Long
    • Top As Int

TimePicker002.png


This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate (You can donate any amount you want to donate for the library (or my work) :)


Nice Time Picker. I can use it until a B4A KitKat version comes out.

Is there a way to make it snap to the tick lines on the clock dial?

It's very tricky to select a time like 17:30 because the time numbers jump around too much to get an exact time.
 

DonManfred

Expert
Licensed User
Longtime User
Is there a way to make it snap to the tick lines on the clock dial?
The original library does not expose a method for this. sorry, no.

It's very tricky to select a time like 17:30
i know. I dont like it too. That´s why i dont like this library. I just wrote the wrapper out of fun.

I´m working on nicer ones too but sadly - till now - i just get the date-picker working but not the time-picker from the kitkat version :mad:
 

rleiman

Well-Known Member
Licensed User
Longtime User
I may try making something that looks and behaves something like the KitKat time picker sometime.
 
Top