SeslSleepTimePicker
A custom view that allows users to select a bedtime and wakeup time using a circular seek bar. It displays the selected times and the calculated sleep duration.
The picker provides visual feedback and animations as the user interacts with the seek bar. It also supports different time formats (12-hour or 24-hour) based on the device's settings.
Key features:
- Circular seek bar for intuitive time selection.
- Display of bedtime, wakeup time, and sleep duration.
- Animations for selecting and unselecting time icons.
- Support for 12-hour and 24-hour time formats.
- Haptic feedback during time adjustments.
- Customizable sleep duration formatting.
- Ability to set and display a sleep goal.
- Handles configuration changes and instance state saving/restoring.
To use this picker, add it to your layout XML and interact with it programmatically. You can set initial bed and wakeup times, listen for time changes, and customize its appearance.
Example usage in XML:
<com.samsung.android.widget.SeslSleepTimePicker
android:id="@+id/sleep_time_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Content copied to clipboard
Example usage in Java:
SeslSleepTimePicker sleepTimePicker = findViewById(R.id.sleep_time_picker);
sleepTimePicker.setBedTimeInMinute(1320); // 10:00 PM
sleepTimePicker.setWakeUpTimeInMinute(420); // 7:00 AM
sleepTimePicker.setOnSleepTimeChangeListener(new SeslSleepTimePicker.OnSleepTimeChangedListener() {
public void onSleepTimeChanged(float bedTimeInMinutes, float wakeupTimeInMinutes) {
// Handle time changes
}
Content copied to clipboard
Types
Link copied to clipboard
interface OnSleepTimeChangedListener
Link copied to clipboard
interface SleepDurationFormatter
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun setOnSleepTimeChangeListener(@Nullable onSleepTimeChangedListener: SeslSleepTimePicker.OnSleepTimeChangedListener)
Link copied to clipboard
open fun setSleepDurationFormatter(@NonNull sleepDurationFormatter: SeslSleepTimePicker.SleepDurationFormatter)
Sets the SleepDurationFormatter to be used for formatting the sleep duration string.
Link copied to clipboard
Link copied to clipboard
Sets the sleep goal display on the picker.
Link copied to clipboard
Link copied to clipboard