A material-styled android view that provisions picking of a date, time & recurrence option, all from a single user-interface.

Overview

SublimePicker

A customizable view that provisions picking of a date, time & recurrence option, all from a single user-interface. You can also view 'SublimePicker' as a collection of material-styled (API 23) DatePicker, TimePicker & RecurrencePicker, backported to API 14.

With the release of version 2, SublimePicker now allows date-range selection.

All three components have been converted to views, which enables us to add/embed them anywhere - add them to a 'Dialog', a 'PopupWindow', or use them as any regular android widget.

Almost all styling possibilities have been exposed through attrs. If something has been missed, please bring it to my attention.

SublimePicker provides a single point of entry to all three pickers. What I mean is that once SublimePicker is available for interaction, the user can select a date, a time & a recurrence option without leaving the picker.

Gradle dependency

compile 'com.appeaser.sublimepickerlibrary:sublimepickerlibrary:2.1.2'

Walkthrough

Following screenshots have been taken from the sample application: Get it on Google Play

Launching into DatePicker:

Version 2 allows date-range selection using SublimeOptions#setCanPickDateRange(boolean). Picking date range is one fluent gesture which begins with a long-press on the intended start-date, followed by a drag onto the intended end-date. The range can span as many days, months or years, as needed. During a drag, approaching the left/right edge of date picker scrolls the previous/next month into view.

Date range selection:

Landscape:

Date range selection spanning multiple months:

Button at bottom-left corner can be used to switch to TimePicker:

Landscape:

The overflow button at top-right opens the RecurrencePicker:

Choosing Custom... from this menu brings you to RecurrenceOptionCreator:

Picking Until a date from the bottom spinner & clicking on the date shows a stripped down version of DatePicker:

Sample Application:

Results of the selection in sample application (single date):

Results of the selection in sample application (date range):

How-tos will be added in a day or two...

License

Copyright (c) 2018 Vikram Kakkar

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.
Comments
  • How to use and styling of pickers.

    How to use and styling of pickers.

    I have gone through your sample app on playstore and it looks pretty good even in below lollipop devices. I really appreciate your work. It would be better if you provide a bit more explanation regarding how to use and styling of pickers to suit app requirements. Also a gradle dependency for the library project will be much appreciated.

    opened by makk909 24
  • Support API 15

    Support API 15

    When I run the sample code. I got the following error.

    12-13 08:05:46.404: E/AndroidRuntime(13857): FATAL EXCEPTION: main 12-13 08:05:46.404: E/AndroidRuntime(13857): android.view.InflateException: Binary XML file line #15: Error inflating class com.appeaser.sublimepickerlibrary.SublimePicker 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.createView(LayoutInflater.java:606) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.inflate(LayoutInflater.java:466) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 12-13 08:05:46.404: E/AndroidRuntime(13857): at com.appeaser.sublimepicker.SublimePickerFragment.onCreateView(SublimePickerFragment.java:92) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.os.Handler.handleCallback(Handler.java:605) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.os.Handler.dispatchMessage(Handler.java:92) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.os.Looper.loop(Looper.java:154) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.app.ActivityThread.main(ActivityThread.java:4895) 12-13 08:05:46.404: E/AndroidRuntime(13857): at java.lang.reflect.Method.invokeNative(Native Method) 12-13 08:05:46.404: E/AndroidRuntime(13857): at java.lang.reflect.Method.invoke(Method.java:511) 12-13 08:05:46.404: E/AndroidRuntime(13857): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 12-13 08:05:46.404: E/AndroidRuntime(13857): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 12-13 08:05:46.404: E/AndroidRuntime(13857): at dalvik.system.NativeStart.main(Native Method) 12-13 08:05:46.404: E/AndroidRuntime(13857): Caused by: java.lang.reflect.InvocationTargetException 12-13 08:05:46.404: E/AndroidRuntime(13857): at java.lang.reflect.Constructor.constructNative(Native Method) 12-13 08:05:46.404: E/AndroidRuntime(13857): at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.createView(LayoutInflater.java:586) 12-13 08:05:46.404: E/AndroidRuntime(13857): ... 20 more 12-13 08:05:46.404: E/AndroidRuntime(13857): Caused by: android.view.InflateException: Binary XML file line #42: Error inflating class com.appeaser.sublimepickerlibrary.recurrencepicker.SublimeRecurrencePicker 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.createView(LayoutInflater.java:606) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.inflate(LayoutInflater.java:459) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 12-13 08:05:46.404: E/AndroidRuntime(13857): at com.appeaser.sublimepickerlibrary.SublimePicker.initializeLayout(SublimePicker.java:211) 12-13 08:05:46.404: E/AndroidRuntime(13857): at com.appeaser.sublimepickerlibrary.SublimePicker.(SublimePicker.java:189) 12-13 08:05:46.404: E/AndroidRuntime(13857): at com.appeaser.sublimepickerlibrary.SublimePicker.(SublimePicker.java:184) 12-13 08:05:46.404: E/AndroidRuntime(13857): ... 23 more 12-13 08:05:46.404: E/AndroidRuntime(13857): Caused by: java.lang.reflect.InvocationTargetException 12-13 08:05:46.404: E/AndroidRuntime(13857): at java.lang.reflect.Constructor.constructNative(Native Method) 12-13 08:05:46.404: E/AndroidRuntime(13857): at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.createView(LayoutInflater.java:586) 12-13 08:05:46.404: E/AndroidRuntime(13857): ... 30 more 12-13 08:05:46.404: E/AndroidRuntime(13857): Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class com.appeaser.sublimepickerlibrary.recurrencepicker.RecurrenceOptionCreator 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.createView(LayoutInflater.java:606) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.inflate(LayoutInflater.java:459) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 12-13 08:05:46.404: E/AndroidRuntime(13857): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 12-13 08:05:46.404: E/AndroidRuntime(13857): at com.appeaser.sublimepickerlibrary.recurrencepicker.SublimeRecurrencePicker.initializeLayout(SublimeRecurrencePicker.java:135) 12-13 08:05:46.404: E/AndroidRuntime(13857): at com.appeaser.sublimepickerlibrary.recurrencepicker.SublimeRecurrencePicker.(SublimeRecurrencePicker.java:120) 12-13 08:05:46.404: E/AndroidRuntime(13857): at com.appeaser.sublimepickerlibrary.recurrencepicker.SublimeRecurrencePicker.(SublimeRecurrencePicker.java:113) 12-13 08:05:46.404: E/AndroidRuntime(13857): ... 33 more 12-13 08:05:46.404: E/AndroidRuntime(13857): Caused by: java.lang.reflect.InvocationTargetException 12-13 08:05:46.404: E/AndroidRuntime(13857): at java.lang.reflect.Constructor.constructNative(Native Method) 12-13 08:05:46.404: E/AndroidRuntime(13857): at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 12-13 08:05:46.404: E/AndroidRuntime(13857): at

    opened by aadhk 10
  • Supporting API 14

    Supporting API 14

    Hi, I'll love to use your library but I'd need it to work with API 14. Is there any hope to make it work with API 14?

    I'd just need a simple DatePickerDialog, if I force the use of the library in my manifest... would it crash my app?

    Thanks in advance

    opened by fncapps 6
  • SublimeDatePicker displays wrong week name in Chinese in API 19

    SublimeDatePicker displays wrong week name in Chinese in API 19

    In China we call Monday "星期一". The first two characters means "week" and the last character determines which day in a week. When I use SublimeDatePicker, it only displays "星" for all days of a week: screenshot_2015-08-06-14-40-54 This only occurs in API 19(I didn't test Android 4.2 but I did test on 4.3 and above, at those versions it displays correctly). Maybe we should change DateFormat pattern or sth.

    opened by ywwynm 6
  • prefix attributes such as firstDayOfWeek with sp

    prefix attributes such as firstDayOfWeek with sp

    SublimeePicker has conflicting attributes with other libraries. Some attributes are already prefixed with "sp", would it be possible to prefix all attributes with sp?

    opened by siderakis 5
  • Add the possibilities to select a date range

    Add the possibilities to select a date range

    Hello, Your library is very usefull with a good design.

    Can you add the possibilite to select a range of dates like this library : http://android-arsenal.com/details/1/127

    Thank you

    enhancement 
    opened by AndroFlo 5
  • Possibilty to return null as

    Possibilty to return null as "no date selected"?

    I need the possibilty to return that the user doesn't want to set a date. I/the user start with "no date" and I need that the user also could go back to the initial value "no date".

    opened by Rainer-Lang 4
  • No clue how to use this library

    No clue how to use this library

    Even with the added wiki pages I have absolutely no clue how to get this to work. I tried copying the kotlin code from the example for converting to java later but I get an Unresolved reference for import android.support.v4.app.DialogFragment and so the extends DialogFragment() doesn't work either. Am I missing something?

    opened by PresidentDoggo 1
  • issue when using kotlin

    issue when using kotlin

    java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter recurrenceRule at blackburn.io.audigo_android.DateTimePickerFragment$listenerAdapter$1.onDateTimeRecurrenceSet(DateTimePickerFragment.kt) at com.appeaser.sublimepickerlibrary.SublimePicker$2.onOkay(SublimePicker.java:159) at com.appeaser.sublimepickerlibrary.common.ButtonLayout.onClick(ButtonLayout.java:222) at android.view.View.performClick(View.java:6205) at android.widget.TextView.performClick(TextView.java:11103) at android.view.View$PerformClick.run(View.java:23653) at android.os.Handler.handleCallback(Handler.java:751)

    when onDateTimeRecurrenceSet is called, errors like above happen, cuz one of the override PickerCallback funtions (onDateTimeRecurrenceSet) has recurrenceRule which cannot be set as Optional even if recurrenceRule is not nullable..

    opened by Hpark11 1
  • Monthly - On every second Tuesday etc..

    Monthly - On every second Tuesday etc..

    How can the user change the "on every SECOND tuesday of the month" to third or whatever he wants? I don't find an option in the GUI.

    But it must be supported because the recurrence rule send the sceond back ;-)

    opened by chrisonline 1
  • I am getting NoSuchFieldError after showing the dialog

    I am getting NoSuchFieldError after showing the dialog

    I have added the code as in the sample app, but have set the options to show only the recurrence picker. But after "show" I get this error: aused by: java.lang.NoSuchFieldError: No field date_picker_day_picker of type I in class Lcom/appeaser/sublimepickerlibrary/R$id; or its superclasses (declaration of 'com.appeaser.sublimepickerlibrary.R$id' appears in /data/data/com.colapps.reminder/files/instant-run/dex/slice-slice_4-classes.dex) at com.appeaser.sublimepickerlibrary.datepicker.SublimeDatePicker.initializeLayout(SublimeDatePicker.java:264)

    The line who is crashing is in onCreateView in my RecurrencPickerDialogFragment: SublimePicker sublimePicker = (SublimePicker) getActivity().getLayoutInflater() .inflate(R.layout.sublime_picker, container);

    What do I miss?

    opened by chrisonline 1
  • Several issues on using SublimePicker.

    Several issues on using SublimePicker.

    SublimePicker is amazing but it's so difficult to use without good documentation. I have figured out some stuff but I am having the following problems:

    • Is there a way to only allow users to choose current and future dates (not past dates) ? I have tried to use setDateParams(Calendar startCal, Calendar endCal) method, but it doesn't do anything

    • Is there a way to disable the "repeat Options" button. it disappears when using setPickerToShow(SublimeOptions.Picker.DATE_PICKER); option but I also want to have a time picking option together with the date so when I addsetPickerToShow(SublimeOptions.Picker.TIME_PICKER); The app crashes with the following exception: The picker you have requested to show(DATE_PICKER) is not activated. Use setDisplayOptions(int) to activate it, or use an activated Picker with setPickerToShow(Picker). and I have used SetDisplayOptions method but it doesn't work.

    • Is there a way to change the theme of the Dialogue?

    Thanks in advance. Also, let me know if there is another good option for android range date and time picker.

    opened by leoull 1
  • NullPointerException on SublimeOptions$Picker.name()

    NullPointerException on SublimeOptions$Picker.name()

    Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.appeaser.sublimepickerlibrary.helpers.SublimeOptions$Picker.name()' on a null object reference at com.appeaser.sublimepickerlibrary.SublimePicker$SavedState.writeToParcel + 499(SublimePicker.java:499) at android.os.Parcel.writeParcelable + 1699(Parcel.java:1699) at android.os.Parcel.writeValue + 1605(Parcel.java:1605) at android.os.Parcel.writeSparseArray + 1019(Parcel.java:1019) at android.os.Parcel.writeValue + 1630(Parcel.java:1630) at android.os.Parcel.writeArrayMapInternal + 891(Parcel.java:891) at android.os.BaseBundle.writeToParcelInner + 1579(BaseBundle.java:1579) at android.os.Bundle.writeToParcel + 1233(Bundle.java:1233) at android.os.Parcel.writeBundle + 931(Parcel.java:931) at android.os.Parcel.writeValue + 1596(Parcel.java:1596) at android.os.Parcel.writeArrayMapInternal + 891(Parcel.java:891) at android.os.BaseBundle.writeToParcelInner + 1579(BaseBundle.java:1579) at android.os.Bundle.writeToParcel + 1233(Bundle.java:1233) at android.app.IActivityManager$Stub$Proxy.activityStopped + 3871(IActivityManager.java:3871) at android.app.servertransaction.PendingTransactionActions$StopInfo.run + 144(PendingTransactionActions.java:144) at android.os.Handler.handleCallback + 873(Handler.java:873) at android.os.Handler.dispatchMessage + 99(Handler.java:99) at android.os.Looper.loop + 214(Looper.java:214) at android.app.ActivityThread.main + 7037(ActivityThread.java:7037) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 494(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main + 965(ZygoteInit.java:965)

    opened by daniebruwer 0
  • Added an alternate range selection mode

    Added an alternate range selection mode

    Added a new way to select date ranges, similar to the one Airbnb uses.

    After the user selects the first date and chooses a second date, it will automatically create a range between those two dates. Ex: I first select 2nd of March and then select 10th of March it will select this date range without the need to long press and drag.

    If you want to select another date, just chose a date and you can go through the process of range selection again.

    opened by adriancoman 6
Owner
Vikram
Vikram
Asimov-time-kt - Useful time and date related functions and extensions

asimov/time Useful time and date related functions and extensions. Installation

Nicolas Bottarini 1 Jan 7, 2022
Android NTP time library. Get the true current time impervious to device clock time changes

TrueTime for Android Make sure to check out our counterpart too: TrueTime, an NTP library for Swift. NTP client for Android. Calculate the date and ti

Instacart 1.3k Jan 4, 2023
Pick a date or time on Android in style

Material DateTime Picker - Select a time/date in style Material DateTime Picker tries to offer you the date and time pickers as shown in the Material

null 4.7k Dec 29, 2022
KotlinX multiplatform date/time library

kotlinx-datetime A multiplatform Kotlin library for working with date and time. See Using in your projects for the instructions how to setup a depende

Kotlin 1.6k Jan 5, 2023
Multiplatform Date and time library for Kotlin

Klock is a Date & Time library for Multiplatform Kotlin. It is designed to be as allocation-free as possible using Kotlin inline classes, to be consis

null 681 Dec 19, 2022
Additions for Kotlin's date & time library kotlinx-datetime

fluid-time Additions for Kotlin's date & time library kotlinx-datetime. kotlinx-datetime is very early stage and not as actively developed as other of

Marc Knaup 39 Nov 11, 2022
Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.

Android Week View Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling. Fea

Raquib-ul Alam (Kanak) 3.4k Jan 3, 2023
MinutesAliveApp - Basic Android App that ask for your date of birth and shows your age in minutes

MinutesAliveApp Basic Android App that ask for your date of birth and shows your

JestorDev 0 Jan 30, 2022
Compose Date Picker - Select month and year

Android DatePicker with month and year build with Compose UI

Doğuş Teknoloji 47 Dec 15, 2022
A simple Cupcake Ordering App, choose flavor, pickup on a date, get order summary and send order via any other app.

Cupcake app This app contains an order flow for cupcakes with options for quantity, flavor, and pickup date. The order details get displayed on an ord

Akshat Khandelwal 0 Dec 23, 2021
Joda-Time library with Android specialization

Android has built-in date and time handling - why bother with a library? If you've worked with Java's Date and Calendar classes you can probably answer this question yourself, but if not, check out Joda-Time's list of benefits.

Daniel Lew 2.6k Dec 9, 2022
java.time Kotlin extension functions library.

Java Time Kotlin extension functions. Background Java Time became integrated to the JDK as of Java 8. It was a huge improvement over its Date predeces

Sami Eljabali 31 Mar 15, 2022
Estimated Time of Arrival Bar

Estimated Time of Arrival Bar

Tek 1 Mar 12, 2022
Tanya Gupta 1 Aug 16, 2022
A Material design back port of Android's CalendarView

Material Calendar View A Material design back port of Android's CalendarView. The goal is to have a Material look and feel, rather than 100% parity wi

Prolific Interactive 5.8k Jan 3, 2023
Android calendar view inspired by Sunrise calendar and iOS7 stock calendar

SilkCal Android calendar view inspired by Sunrise calendar and iOS7 stock calendar. Usage Add compile 'me.nlmartian.silkcal:library:0.1.1' to your dep

JunGuan Zhu 385 Nov 25, 2022
An android library which provides a compact calendar view much like the one used in google calenders.

CompactCalendarView CompactCalendarView is a simple calendar view which provides scrolling between months. It's based on Java's Date and Calendar clas

SundeepK 1.5k Jan 7, 2023
A custom clock view with a circular slider.

Read this in other languages: English, 中文. ClockSlider A custom clock view with a circular slider. Supported Android Versions Android 4.0 Jelly Bean(A

Chien 5 Nov 13, 2022
An adaptation of the JSR-310 backport for Android.

ThreeTen Android Backport An adaptation of the JSR-310 backport for Android. Attention: Development on this library is winding down. Please consider s

Jake Wharton 3.5k Dec 11, 2022