# SublimePicker **Repository Path**: baijuncheng-open-source/sublime-picker ## Basic Information - **Project Name**: SublimePicker - **Description**: 用于时间选择的自定义控件:提供选择日期(年、月、日),提供选择时间(时、分、秒),提供可选择日期的重复选项等功能 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-29 - **Last Updated**: 2021-07-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SublimePicker 本项目是基于开源项目SublimePicker进行鸿蒙化的移植和开发的,可以通过项目标签以及github地址(https://github.com/vikramkakkar/SublimePicker)追踪到原安卓项目版本 项目介绍 项目名称:一个可定制的自定义view,提供日期、时间和重复选项。 所属系列:鸿蒙的第三方组件适配移植 功能:日历选择控件、时间选择控件、重复选择控件 项目移植状态:完成 调用差异:无 开发版本:sdk4,DevEco Studio2.1 beta2 项目作者和维护人:胡傲 联系方式:huao73641@billjc.com 原项目Doc地址:https://github.com/vikramkakkar/SublimePicker 项目介绍 编程语言:Java 外部库依赖:无 ### 安装教程: 一、本地依赖 1,下载sublimepickerlibrary 2,将下载sublimepickerlibrary引入工程: ```xml dependencies { ... implementation project(path: ':sublimepickerlibrary') } ``` 二、远程依赖 ``` dependencies { implementation 'com.gitee.baijuncheng-open-source:SublimePicker:1.0.1' } ``` ### 使用说明: 1,布局文件定义,提供控件:SublimePicker ``` ``` 2,在SublimePicker展示时需要调用初始化方法:initializePicker(SublimeOptions options, SublimeListenerAdapter listener),根据传入的参数会自动更新布局。 ### 参数说明: ​ SublimeOptions说明: ​ setDisplayOptions(int displayOptions):表示需要展示的界面类型,如日期、时间、重复选项都需要展示,则需要将ACTIVATE_DATE_PICKER、 ACTIVATE_TIME_PICKER、ACTIVATE_RECURRENCE_PICKER相加后传入,以此类推 ​ setPickerToShow(SublimeOptions.Picker) 设置需要展示的默认控件,Picker为枚举类型,包括DATE_PICKER(显示日期控件)、TIME_PICKER(显示时间控件)、 REPEAT_OPTION_PICKER(重复选项)。与setDisplayOptions对应,如都展示则可随意设置默认展示界面;如只是单个则只能设置对应的选项。 ​ setCanPickDateRange(boolean canPickDateRange) 是否需要支持日期范围选择 (此项暂不支持) ​ SublimeListenerAdapter说明: ​ 一个回调接口,主要有两个监听,onCancelled()view关闭时的监听、onDateTimeRecurrenceSet(SelectedDate selectedDate, int hourOfDay, int minute, SublimeRecurrencePicker.RecurrenceOption recurrenceOption, String recurrenceRule)view关闭时,选择的时间,包括日期、时分秒等参数。 ### Demo演示: ------ 首先安装 **DatePicker**: ![date_picker_v2](https://images.gitee.com/uploads/images/2021/0330/180354_1e16cb56_8230582.jpeg "date_picker_v2.png.jpg") 左下角的按钮可以用来切换到 **TimePicker**: ![time_picker_v2](https://images.gitee.com/uploads/images/2021/0330/180427_19b425ce_8230582.jpeg "time_picker_v2.png.jpg") 横屏: ![time_picker_land_v2](https://images.gitee.com/uploads/images/2021/0330/180444_f141eca6_8230582.jpeg "time_picker_land_v2.jpg") 点击右上角按钮可以切换到 **RecurrencePicker**: ![recurrence_picker_v2](https://images.gitee.com/uploads/images/2021/0330/180506_ee23d2cc_8230582.jpeg "recurrence_picker_v2.jpg") 选择 **Custom...** 会跳转到 **RecurrenceOptionCreator**: ![recurrence_option_creator](https://images.gitee.com/uploads/images/2021/0330/180529_8d54c6b3_8230582.jpeg "recurrence_option_creator.jpg") 选择 **Until a date** 选择一个日期并单击该日期将显示一个精简版的DatePicker: ![recurrence_option_creator_end_date_v2](https://images.gitee.com/uploads/images/2021/0330/180550_8da36240_8230582.jpeg "recurrence_option_creator_end_date_v2.jpg") **Sample Application**: ![sampler_v2.png](https://images.gitee.com/uploads/images/2021/0330/180610_21f52a72_8230582.jpeg "sampler_v2.png.jpg") 选中时间后 **sample application** : ![sampler_results_single_date_v2](https://images.gitee.com/uploads/images/2021/0330/180624_f8301c8c_8230582.jpeg "sampler_results_single_date_v2.jpg") ### Change Log #### [1.0.0] - March , 2021 * 增加SublimePicker库; #### [1.0.1] - June , 2021 * 去掉函数中文注释,否则有转码异常问题 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. ```