Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.LachlanMcKee:datetimepicker:0.0.6'
}
dependencies {
implementation("com.github.LachlanMcKee:datetimepicker:0.0.6")
}
<dependency>
<groupId>com.github.LachlanMcKee</groupId>
<artifactId>datetimepicker</artifactId>
<version>0.0.6</version>
</dependency>
libraryDependencies += "com.github.LachlanMcKee" % "datetimepicker" % "0.0.6"
:dependencies [[com.github.LachlanMcKee/datetimepicker "0.0.6"]]
Official source:
https://android.googlesource.com/platform/frameworks/opt/datetimepicker/ (Android 4.3+)
#DateTimePicker
DateTimePicker is a library which contains the beautiful DatePicker and TimePicker that can be seen in the new Google Agenda app.
This picker is available for 2.1+
You have a recurrence picker in the same style here.
This library reproduces as much as possible the original picker contained in the new Google Agenda app.
Or browse the source code of the sample application for a complete example of use.
Last version is 0.0.5
Just add the following in your build.gradle
repositories{
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.github.lachlanm:datetimepicker:0.0.5'
}
Basic
Date Picker
DatePickerDialog datePickerDialog = DatePickerDialog.newInstance(new OnDateSetListener() {...}, year, month, day);
Time Picker
TimePickerDialog timePickerDialog = TimePickerDialog.newInstance(new TimePickerDialog.OnTimeSetListener() {...}, hourOfDay, minute, is24HourMode);
For more info look at the source code of the provided sample here
Change Dialog Primary Color
Colors will be based off AppCompat colorPrimary and colorPrimaryDark. You must use a theme based on Theme.AppCompat.
Set Min/Max Date
datePickerDialog.setDateConstaints(new SimpleMonthAdapter.CalendarDay(2015, 4, 17), new SimpleMonthAdapter.CalendarDay(2015, 4, 20));
Copyright 2013 Flavien Laurent (DatePicker) edisonw (TimePicker)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.