SeslDatePicker

open class SeslDatePicker : LinearLayout, SeslSimpleMonthView.OnDayClickListener, View.OnClickListener, View.OnLongClickListener, SeslSimpleMonthView.OnDeactivatedDayClickListener(source)

A custom date picker widget for selecting dates, supporting both standard and lunar calendars.

The SeslDatePicker provides a user interface for date selection, allowing users to pick a year, month, and day. It supports various configurations, including minimum and maximum date constraints, and can be customized for different locales and calendar systems.

This widget is designed to be used within Android applications that require date input from users. It integrates with accessibility services and provides support for custom fonts, animations, and Samsung-specific features such as lunar calendar conversion.

Features:

  • Standard and lunar calendar support
  • Customizable appearance and font
  • Minimum and maximum date constraints
  • Accessibility support
  • Locale-aware formatting
  • Samsung-specific enhancements

Usage Example:


SeslDatePicker datePicker = new SeslDatePicker(context);
datePicker.setMinDate(minDateInMillis);
datePicker.setMaxDate(maxDateInMillis);
datePicker.init(year, month, day, new SeslDatePicker.OnDateChangedListener() {
    public void onDateChanged(SeslDatePicker view, int year, int monthOfYear, int dayOfMonth) {
        // Handle date change
    }
});

See also

Constructors

Link copied to clipboard
constructor(@NonNull context: @NonNull Context)
constructor(@NonNull context: @NonNull Context, @Nullable attrs: @Nullable AttributeSet)
constructor(@NonNull context: @NonNull Context, @Nullable attrs: @Nullable AttributeSet, defStyleAttr: Int)
constructor(@NonNull context: @NonNull Context, @Nullable attrs: @Nullable AttributeSet, defStyleAttr: Int, defStyleRes: Int)

Types

Link copied to clipboard
annotation class DateMode
Interface to define the different date selection modes.
Link copied to clipboard
The callback used to indicate the user changed the date.
Link copied to clipboard
Interface definition for a callback to be invoked when the edit text mode of a DatePicker changes.
Link copied to clipboard
Interface definition for a callback to be invoked when the current view type is changed.
Link copied to clipboard

Properties

Link copied to clipboard
This mode to select the start of a date range.
Link copied to clipboard
The default selection mode where user can select a date.
Link copied to clipboard
This mode to select the start of a date range.
Link copied to clipboard
The mode where the user can select a week.
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
@NonNull
open fun getCalendarViewDisabled(): @NonNull Boolean
Gets a boolean indicating whether the calendar view is disabled.
Link copied to clipboard
Gets the current view type.
Link copied to clipboard
open fun getDateMode(): Int
Gets the current date selection mode.
Link copied to clipboard
open fun getDayOfMonth(): Int
Link copied to clipboard
@NonNull
open fun getEditText(picker: Int): @NonNull EditText
Gets the EditText used for the picker given.
Link copied to clipboard
@NonNull
open fun getEndDate(): @NonNull Calendar
Retrieves the end date.
Link copied to clipboard
Gets the first day of the week.
Link copied to clipboard
open fun getLunarEndDate(): @NonNull Array<Int>
Link copied to clipboard
open fun getLunarStartDate(): @NonNull Array<Int>
Link copied to clipboard
open fun getMaxDate(): Long
Link copied to clipboard
open fun getMinDate(): Long
Link copied to clipboard
open fun getMonth(): Int
Gets the current month.
Link copied to clipboard
@NonNull
open fun getNumberPicker(picker: Int): @NonNull SeslNumberPicker
Link copied to clipboard
@NonNull
open fun getStartDate(): @NonNull Calendar
Gets the start date of the date range.
Link copied to clipboard
open fun getYear(): Int
Gets the current year.
Link copied to clipboard
open fun init(year: Int, monthOfYear: Int, dayOfMonth: Int, @Nullable onDateChangedListener: @Nullable SeslDatePicker.OnDateChangedListener)
Initialize the DatePicker.
Link copied to clipboard
Link copied to clipboard
open fun isEnabled(): Boolean
Link copied to clipboard
open fun isLeapMonth(): Boolean
Link copied to clipboard
open fun isLunar(): Boolean
Link copied to clipboard
open fun onClick(view: View)
Link copied to clipboard
open fun onDayClick(@NonNull view: @NonNull SeslSimpleMonthView, year: Int, month: Int, day: Int)
Handles the click event on a day in the month view.
Link copied to clipboard
open fun onDeactivatedDayClick(@NonNull view: @NonNull SeslSimpleMonthView, year: Int, month: Int, selectedDay: Int, isLeapMonth: Boolean, isPrevMonth: Boolean)
Handles the click event for a deactivated day in the calendar view.
Link copied to clipboard
open fun onLongClick(view: View): Boolean
Link copied to clipboard
open fun requestLayout()
Link copied to clipboard
open fun setCalendarViewDisabled(@NonNull disable: @NonNull Boolean)
Use this method to enable/disable the calendar view.
Link copied to clipboard
open fun setCurrentViewType(type: Int)
Sets the current view type.
Link copied to clipboard
open fun setDateMode(mode: Int)
Sets the selection mode for the DatePicker.
Link copied to clipboard
open fun setDialogPaddingVertical(paddingVertical: Int)
Link copied to clipboard
open fun setDialogWindow(@NonNull window: @NonNull Window)
Link copied to clipboard
open fun setEditTextMode(editTextMode: Boolean)
Sets the edit text mode for the spinner layout.
Link copied to clipboard
open fun setEnabled(enabled: Boolean)
Link copied to clipboard
open fun setFirstDayOfWeek(@IntRange(from = 1, to = 7) firstDayOfWeek: Int)
Sets the first day of the week.
Link copied to clipboard
open fun setLunar(isLunar: Boolean, isLeapMonth: Boolean)
Link copied to clipboard
open fun setLunarEndDate(year: Int, month: Int, day: Int, isLeapEndMonth: Boolean)
Link copied to clipboard
open fun setLunarStartDate(year: Int, month: Int, day: Int, isLeapStartMonth: Boolean)
Link copied to clipboard
open fun setLunarSupported(supported: Boolean, @Nullable switchButton: @Nullable View)
Link copied to clipboard
open fun setMaxDate(maxDate: Long)
Sets the maximal date supported by this DatePicker in milliseconds since January 1, 1970 00:00:00 in getDefault time zone.
Link copied to clipboard
open fun setMinDate(minDate: Long)
Sets the minimal date that can be selected in this NumberPicker.
Link copied to clipboard
open fun setOnEditTextModeChangedListener(@Nullable onEditModeChangedListener: @Nullable SeslDatePicker.OnEditTextModeChangedListener)
Sets a listener to be notified when the isEditTextMode is changed.
Link copied to clipboard
Sets a listener to be notified when the view type changes.
Link copied to clipboard
open fun setSeparateLunarButton(separate: Boolean)
Link copied to clipboard
open fun setValidationCallback(@Nullable callback: @Nullable SeslDatePicker.ValidationCallback)
Link copied to clipboard
open fun updateDate(year: Int, month: Int, dayOfMonth: Int)
Updates the current date.