Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
com.mikhaellopez:lazydatepicker
Advanced tools
This is an Android project to offer an alternative to the native Android Date Picker.
This is an Android project to offer an alternative to the native Android Date Picker.
To make a lazy date picker add LazyDatePicker in your layout XML and add LazyDatePicker library in your project or you can also grab it via Gradle:
implementation 'com.mikhaellopez:lazydatepicker:1.1.0'
<com.mikhaellopez.lazydatepicker.LazyDatePicker
android:id="@+id/lazyDatePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:ldp_text_color="@color/primary"
app:ldp_hint_color="@color/accent"
app:ldp_date_format="mm-dd-yyyy" />
You must use the following properties in your XML to change your LazyDatePicker.
Properties | Type | Default |
---|---|---|
app:ldp_text_color | color | BLACK |
app:ldp_hint_color | color | GRAY |
app:ldp_date_format | mm-dd-yyyy or dd-mm-yyyy | mm-dd-yyyy |
app:ldp_show_full_date | boolean | true |
lazyDatePicker.setDateFormat(LazyDatePicker.DateFormat.MM_DD_YYYY)
lazyDatePicker.setMinDate(minDate)
lazyDatePicker.setMaxDate(maxDate)
// The date when is selected
lazyDatePicker.setOnDatePickListener { dateSelected ->
//...
}
// True or false when date is selected
lazyDatePicker.setOnDateSelectedListener { dateSelected ->
//...
}
LazyDatePicker lazyDatePicker = findViewById(R.id.lazyDatePicker);
lazyDatePicker.setDateFormat(LazyDatePicker.DateFormat.MM_DD_YYYY);
lazyDatePicker.setMinDate(minDate);
lazyDatePicker.setMaxDate(maxDate);
lazyDatePicker.setOnDatePickListener(new LazyDatePicker.OnDatePickListener() {
@Override
public void onDatePick(Date dateSelected) {
//...
}
});
lazyDatePicker.setOnDateSelectedListener(new LazyDatePicker.OnDateSelectedListener() {
@Override
public void onDateSelected(Boolean dateSelected) {
//...
}
});
You can used LazyLocalDatePicker
instead of LazyDatePicker
to have all method with LocalDate
instead of Date
.
<com.mikhaellopez.lazydatepicker.LazyLocalDatePicker
android:id="@+id/lazyDatePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:ldp_text_color="@color/primary"
app:ldp_hint_color="@color/accent"
app:ldp_date_format="mm-dd-yyyy" />
lazyLocalDatePicker.setDateFormat(LazyDatePicker.DateFormat.MM_DD_YYYY)
lazyLocalDatePicker.setMinLocalDate(minDate)
lazyLocalDatePicker.setMaxLocalDate(maxDate)
// The localdate when is selected
lazyLocalDatePicker.setOnLocalDatePickListener { localDateSelected ->
//...
}
// True or false when date is selected
lazyLocalDatePicker.setOnLocalDateSelectedListener { dateSelected ->
//...
}
You can override day, month & year if you want like this in your strings.xml
:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="ldp_day" tools:override="true">D</string>
<string name="ldp_month" tools:override="true">M</string>
<string name="ldp_year" tools:override="true">Y</string>
</resources>
You can also change the design of the picker by changing the dimensions like this in your dimens.xml
:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<dimen name="lazy_date_picker_width_case" tools:override="true">12dp</dimen>
<dimen name="lazy_date_picker_height_focus" tools:override="true">2.5dp</dimen>
<dimen name="lazy_date_picker_width_margin" tools:override="true">1dp</dimen>
<dimen name="lazy_date_picker_width_space" tools:override="true">6dp</dimen>
</resources>
And to finish you can also completely redefine the layout by keeping the same name layout_lazy_date_picker.xml
and keep all the ids. You can find the default one here: layout_lazy_date_picker.xml
Find this library useful? Support it by joining stargazers for this repository ⭐️
And follow me for my next creations 👍
LazyDatePicker by Lopez Mikhael is licensed under a Apache License 2.0.
FAQs
This is an Android project to offer an alternative to the native Android Date Picker.
We found that com.mikhaellopez:lazydatepicker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.