A beautiful little Android view to pick hours, minutes and seconds.
Language:
Kotlin
Owner:
Contributors:
License:
Apache License 2.0
Description:
HmsPickerView
A beautiful little Android view to pick hours, minutes and seconds.
Installation
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects { repositories { ... maven { url 'https://jitpack.io' } } }
Step 2. Add the dependency
dependencies { implementation "xyz.aprildown:HmsPickerView:${version}" }
Usage
In the XML:
<xyz.aprildown.hmspickerview.HmsPickerView android:id="@+id/hmsPickerView" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<attr name="hpv_time_text_size" format="dimension" /> <!--default: 40sp port, 32sp land--> <attr name="hpv_digit_text_size" format="dimension" /> <!--default: 40sp port, 24sp land-->
In the code:
fun getHours(): Int fun setHours(hours: Int) fun getMinutes(): Int fun setMinutes(minutes: Int) fun getSeconds(): Int fun setSeconds(seconds: Int) fun getTimeInMillis(): Long fun setTimeInMillis(time: Long) fun setTimeTextSize(@Px textSize: Int) fun setDigitTextSize(@Px textSize: Int) fun setListener(l: HmsPickerView.Listener) interface Listener { /** * Indicates [HmsPickerView] now has an valid input(anything except 00h 00m 00s). * This methods can be used to allow user to go forward (such as enabling "next" button). */ fun onHmsPickerViewHasValidInput(hmsPickerView: HmsPickerView) /** * Indicates [HmsPickerView]'s input becomes 00h 00m 00s. * This methods can be used to prevent user from going forward(such as disabling "next" button). */ fun onHmsPickerViewHasNoInput(hmsPickerView: HmsPickerView) }
Use this view in a dialog
🦄 Please star this repo if you like it 🦄