Read this in other languages: English, 中文.
ClockSlider
A custom clock view with a circular slider.
Supported Android Versions
- Android 4.0 Jelly Bean(API level 16) or higher.
Gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.a1573595:ClockSlider:1.0.0'
}
Usage
Define ClockSlider on your xml.
"><com.a1573595.clockslider.ClockSlider android:id="@+id/clockSlider" android:layout_width="match_parent" android:layout_height="wrap_content" app:cc_endHour="7" app:cc_fillColor="?attr/colorPrimary" app:cc_startHour="10" app:cc_tickTextColor="?android:attr/textColorPrimary" app:cc_startIconResource="@drawable/ic_moon" app:cc_endIconResource="@drawable/ic_sun" />
Set listener.
binding.clockSlider.setOnTimeChangedListener(object : ClockSlider.OnTimeChangedListener {
override fun onStartChanged(hour: Int, minute: Int) {
...
}
override fun onEndChanged(hour: Int, minute: Int) {
...
}
})