All Projects → andrewjapar → Rangedatepicker

andrewjapar / Rangedatepicker

Licence: mit
📆 A simple vertical date picker for Android, written in kotlin 🇮🇩

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Rangedatepicker

Ng Bootstrap
Angular powered Bootstrap
Stars: ✭ 7,872 (+8948.28%)
Mutual labels:  datepicker
Material Vue Daterange Picker
a date-range-picker follows the Material Design spec powered by vue.js (alpha)
Stars: ✭ 64 (-26.44%)
Mutual labels:  datepicker
Angular Mydatepicker
Angular datepicker and date range picker 📅
Stars: ✭ 76 (-12.64%)
Mutual labels:  datepicker
Vue Mj Daterangepicker
🗓Vue.js date range picker with multiples ranges and presets (vue 2.x)
Stars: ✭ 48 (-44.83%)
Mutual labels:  datepicker
Laydate
layDate(日期与时间组件) 是 layui 独立维护的三大组件之一
Stars: ✭ 1,066 (+1125.29%)
Mutual labels:  datepicker
Horizontal Calendar
A material horizontal calendar view for Android based on RecyclerView
Stars: ✭ 1,155 (+1227.59%)
Mutual labels:  datepicker
React Calendar
A React Native inspired date list renderer
Stars: ✭ 34 (-60.92%)
Mutual labels:  datepicker
Core Components
Accessible and lightweight Javascript components
Stars: ✭ 85 (-2.3%)
Mutual labels:  datepicker
Datetimepicker
This is a custom android holo datepicker timepicker
Stars: ✭ 56 (-35.63%)
Mutual labels:  datepicker
Almostmaterialdatepicker
Date picker made in material design style with some additional spinners
Stars: ✭ 75 (-13.79%)
Mutual labels:  datepicker
Persianrangedatepicker
Persian range date picker for android.
Stars: ✭ 48 (-44.83%)
Mutual labels:  datepicker
React Native Jalali Datepicker
📅 React Native Jalali DatePicker component for both Android and iOS ✨
Stars: ✭ 52 (-40.23%)
Mutual labels:  datepicker
Vue2 Datepicker
A datepicker / datetimepicker component for Vue2
Stars: ✭ 1,154 (+1226.44%)
Mutual labels:  datepicker
React Dates
React date(range) inputs/pickers
Stars: ✭ 43 (-50.57%)
Mutual labels:  datepicker
Vue Draggablecal
Not your ordinary datepicker. A Vuejs draggable date selector with a fresh responsive design, mobile ready and 0 dependencies, 17kb gzipped
Stars: ✭ 79 (-9.2%)
Mutual labels:  datepicker
Pgdatepicker
日期选择器,支持年、年月、年月日、年月日时、年月日时分、年月日时分秒、月日、月日时、月日时分、月日时分秒、时、时分、时分秒、分秒、月日周 时分等
Stars: ✭ 998 (+1047.13%)
Mutual labels:  datepicker
Datepicker
⚠️ [Deprecated] No longer maintained. A simple jQuery datepicker plugin.
Stars: ✭ 1,133 (+1202.3%)
Mutual labels:  datepicker
Persiandatepicker
An Android DatePicker for Persian Calendar
Stars: ✭ 86 (-1.15%)
Mutual labels:  datepicker
Rc Datetime Picker
React component for datetime picker by Moment.js
Stars: ✭ 85 (-2.3%)
Mutual labels:  datepicker
Circularpicker
CircularPicker is helpful for creating a controller aimed to manage any calculated parameter.
Stars: ✭ 73 (-16.09%)
Mutual labels:  datepicker

CPicker (Calendar Picker)

📆 A simple vertical date picker for Android, written in kotlin 🇮🇩

Android Arsenal Download

Screenshoot

  

Installation

Gradle

repositories {
    jcenter()
}

dependencies {
    implementation 'com.andrewjapar.rangedatepicker:rangedatepicker:0.3'
}

Usage

1. Add CalendarPicker to your XML file

<com.andrewjapar.rangedatepicker.CalendarPicker
      android:id="@+id/calendar_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:clipToPadding="false"
      android:scrollbarStyle="outsideOverlay"
      app:picker_type="range" />

2. You can customize the picker range (by default current date + 1 year)

val startDate = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault())
val endDate = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault())
endDate.add(Calendar.MONTH, 6) // Add 6 months ahead from current date
 
calendar_view.apply {
  showDayOfWeekTitle(false) // If you want to disable day of the week title, just make it false
  setMode(SelectionMode.RANGE) // You can set it via XML
  setRangeDate(startDate.time, endDate.time)
  setSelectionDate(startDate.time, endDate.time)
}

3. Don't forget to set the listener to get range selection date

// Set listener first before set the selection to ensure we can track changed date range
// This will be called when range is selected
calendar_view.setOnRangeSelectedListener { startDate, endDate, startLabel, endLabel ->
    departure_date.text = startLabel
    return_date.text = endLabel
}

// This will be called when only single day is selected for both SINGLE and RANGE type
calendar_view.setOnStartSelectedListener { startDate, label ->
    departure_date.text = label
    return_date.text = "-"
}

4. But wait, there is more! If you want to custom text color and background, just override it on your colors.xml file

<!--Background color-->
<color name="calendar_picker_bg">#00FFFFFF</color>

<color name="calendar_day_unselected_bg">#00000000</color>
<color name="calendar_day_selected_bg">#E91E63</color>
<color name="calendar_day_range_selected_bg">#8CE91E63</color>

<!--Font color-->
<color name="calendar_day_disabled_font">#8CE91E63</color>
<color name="calendar_day_weekend_font">#ff0000</color>
<color name="calendar_day_selected_font">#FFFFFF</color>
<color name="calendar_day_normal_font">#333333</color>

<color name="calendar_month_font">#000000</color>
<color name="calendar_week_font">#333333</color>

5. You also can override the value of dimens.xml

<dimen name="calendar_day_height">36dp</dimen>
<dimen name="calendar_day_gap">8dp</dimen>
<dimen name="calendar_day_textsize">12sp</dimen>

<dimen name="calendar_month_padding">16dp</dimen>
<dimen name="calendar_month_textsize">16sp</dimen>

<dimen name="calendar_week_textsize">12sp</dimen>

Future Plan

  1. Support Horizontal View like Traveloka, Expedia, Airbnb, etc
  2. Change font color when the day is weekend
  3. Add a marker on some dates (e.g for public holidays)
  4. Render optimization
  5. Please let me know, if you have any other ideas

Contributing

Currently, CPicker is used only on my personal project but if you have any idea to make it more powerfull, just make a pull request, You are in!

License

    MIT License
    
    Copyright (c) 2020 andrewjapar
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publiAsh, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].