loper7 / DateTimePicker

⭐🎉一个高颜值日期时间选择器;极简API,内置弹窗,支持农历日期显示,适配深色模式,可动态配置样式及主题,选择器支持完全自定义UI。
1.09k stars 121 forks source link
datepicker datepicker-dialog datetime-picker datetimepicker kotlin kotlin-library timepicker timepickerdialog ui-design


API

Language

中文 | English

⭐🎉一个高颜值日期时间选择器;极简API,内置弹窗,支持农历日期显示,简单适配深色模式,可动态配置样式及主题,选择器支持完全自定义UI。

预览

加载不出图片可以前往 掘金 查看


快速体验


或者 点击下载

如何引入

Step 1. 添加 JitPack repository

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Step 2. 添加 Gradle依赖

dependencies {
    ...
    implementation 'com.google.android.material:material:1.1.0' //为了防止不必要的依赖冲突,0.0.3开始需要自行依赖google material库
    implementation 'com.github.loper7:DateTimePicker:0.6.3'//具体版本请看顶部jitpack标识,如0.6.3,仅支持androidx
}

如何使用

日期时间选择控件
  DateTimePicker 使用说明
卡片弹窗
  CardDatePickerDialog 使用说明
自定义选择器
  DateTimePicker 自定义
周选择弹窗
  CardWeekPickerDialog 使用说明

更新日志

v0.6.2 -> v0.6.3

v0.6.1 -> v0.6.2

v0.6.0 -> v0.6.1

v0.5.8 -> v0.6.0

//1.自定义dialog背景,为light/dark模式设置不同的值 builder.setBackGroundModel(if(isDark) R.drawable.shape_bg_dialog_dark else R.drawable.shape_bg_dialog_light) //2.自定义dialog辅助文字颜色 .setAssistColor(if(isDark) darkColor else lightColor) //3.自定义dialog分割线颜色 .setDividerColor(if(isDark) darkColor else lightColor)

//这样深色模式就适配完成了,当然,以上三个方法的作用不仅可以用于适配深色模式,也可以传入更契合app主题的颜色,用于与app统一UI风格。


### [v0.5.7](https://github.com/loperSeven/DateTimePicker/releases/tag/0.5.7) -> [v0.5.8](https://github.com/loperSeven/DateTimePicker/releases/tag/0.5.8)
* fix [issues 57](https://github.com/loperSeven/DateTimePicker/issues/57)

### [v0.5.3](https://github.com/loperSeven/DateTimePicker/releases/tag/0.5.3) -> [v0.5.7](https://github.com/loperSeven/DateTimePicker/releases/tag/0.5.7)
* fix [issues 51](https://github.com/loperSeven/DateTimePicker/issues/51)
* fix [issues 53](https://github.com/loperSeven/DateTimePicker/issues/53)

### [v0.5.2](https://github.com/loperSeven/DateTimePicker/releases/tag/0.5.2) -> [v0.5.3](https://github.com/loperSeven/DateTimePicker/releases/tag/0.5.3)
* fix [issues 47](https://github.com/loperSeven/DateTimePicker/issues/47)
* fix [issues 48](https://github.com/loperSeven/DateTimePicker/issues/48)

### [v0.5.1](https://github.com/loperSeven/DateTimePicker/releases/tag/0.5.1) -> [v0.5.2](https://github.com/loperSeven/DateTimePicker/releases/tag/0.5.2)
* fix [issues 44](https://github.com/loperSeven/DateTimePicker/issues/44)
* `CardDatePickerDialog` 支持设置 `touchHideable`, 用以控制是否允许滑动手势关闭弹窗
```kotlin
    /**
         * 是否可以滑动关闭弹窗
         * @param touchHideable 默认为 true
         */
        fun setTouchHideable(touchHideable:Boolean = true):Builder{
            this.touchHideable = touchHideable
            return this
        }

v0.5.0 -> v0.5.1

v0.4.1 -> v0.5.0

v0.3.4 -> v0.4.1

v0.3.3 -> v0.3.4

支持设置国际化日期选择格式 DateTimePicker 新增如下方法,CardDatePickerDialog 不受任何影响。

v0.3.1 -> v0.3.3

v0.3.0 -> v0.3.1

v0.2.3 -> v0.3.0

v0.2.2 -> v0.2.3

v0.2.1 -> v0.2.2

v0.2.0 -> v0.2.1

v0.1.1 -> v0.2.0

v0.1.0 -> v0.1.1

混淆

-dontwarn com.loper7.date_time_picker.**
-keep class com.loper7.date_time_picker.**{*;}

感谢

Number Picker

联系我

Issues:Issues
邮箱:loper7@163.com

Licenses

Copyright 2020 loperSeven

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, publish, 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.