@@ -27,7 +27,7 @@ Add the JitPack repository in your build.gradle at the end of repositories:
2727And add the dependency
2828```
2929 dependencies {
30- compile 'com.github.Kunzisoft:Android-SwitchDateTimePicker:1.3 '
30+ compile 'com.github.Kunzisoft:Android-SwitchDateTimePicker:1.4 '
3131 }
3232```
3333
@@ -48,6 +48,12 @@ For launch Dialog with a specific view, call :
4848` dateTimeFragment.startAtTimeView(); ` , ` dateTimeFragment.startAtCalendarView(); ` or ` dateTimeFragment.startAtYearView(); `
4949before the "show"
5050
51+ ### Define minimum and maximum
52+ For just allow selection after or/and before dates, use :
53+ ` dateTimeFragment.setMinimumDateTime(Date minimum); `
54+ and
55+ ` dateTimeFragment.setMaximumDateTime(Date maximum); `
56+
5157### Style
5258You can customize the style to change color, bold, etc... of each element.
5359You need to use a Theme.AppCompat theme (or descendant) with SwitchDateTime's activity. (` compile 'com.android.support:appcompat-v7:25.1.0' ` in gradle)
@@ -92,11 +98,15 @@ SwitchDateTimeDialogFragment dateTimeDialogFragment = SwitchDateTimeDialogFragme
9298// Assign values
9399dateTimeFragment.startAtCalendarView();
94100dateTimeFragment.set24HoursMode(true);
95- dateTimeFragment.setDefaultHourOfDay(15);
96- dateTimeFragment.setDefaultMinute(20);
97- dateTimeFragment.setDefaultDay(4);
98- dateTimeFragment.setDefaultMonth(Calendar.DECEMBER);
99- dateTimeFragment.setDefaultYear(2018);
101+ dateTimeFragment.setMinimumDateTime(new GregorianCalendar(2015, Calendar.JANUARY, 1).getTime());
102+ dateTimeFragment.setMaximumDateTime(new GregorianCalendar(2025, Calendar.DECEMBER, 31).getTime());
103+ dateTimeFragment.setDefaultDateTime(new GregorianCalendar(2017, Calendar.MARCH, 4, 15, 20).getTime());
104+ // Or assign each element, default element is the current moment
105+ // dateTimeFragment.setDefaultHourOfDay(15);
106+ // dateTimeFragment.setDefaultMinute(20);
107+ // dateTimeFragment.setDefaultDay(4);
108+ // dateTimeFragment.setDefaultMonth(Calendar.MARCH);
109+ // dateTimeFragment.setDefaultYear(2017);
100110
101111// Define new day and month format
102112try {
0 commit comments