picker
所属分类:iPhone/iOS
开发工具:kotlin
文件大小:0KB
下载次数:0
上传日期:2023-10-12 21:05:44
上 传 者:
sh-1993
说明: 日期和时间选择器,如IOS,
(Date and time picker like IOS,)
文件列表:
.idea/ (0, 2023-11-12)
.idea/codeStyles/ (0, 2023-11-12)
.idea/codeStyles/Project.xml (3309, 2023-11-12)
.idea/compiler.xml (169, 2023-11-12)
.idea/gradle.xml (850, 2023-11-12)
.idea/inspectionProfiles/ (0, 2023-11-12)
.idea/inspectionProfiles/Project_Default.xml (2331, 2023-11-12)
.idea/jarRepositories.xml (1052, 2023-11-12)
.idea/kotlinc.xml (176, 2023-11-12)
.idea/misc.xml (611, 2023-11-12)
.idea/vcs.xml (180, 2023-11-12)
art/ (0, 2023-11-12)
art/datepickerdarkgif.gif (852252, 2023-11-12)
art/datepickergif.gif (772192, 2023-11-12)
art/popupdark.gif (702309, 2023-11-12)
art/popupgif.gif (573974, 2023-11-12)
art/timepickerdarkgif.gif (255053, 2023-11-12)
art/timepickergif.gif (171823, 2023-11-12)
build.gradle (469, 2023-11-12)
commit_.patch (0, 2023-11-12)
datepicker/ (0, 2023-11-12)
datepicker/build.gradle (1821, 2023-11-12)
datepicker/consumer-rules.pro (0, 2023-11-12)
datepicker/proguard-rules.pro (750, 2023-11-12)
datepicker/src/ (0, 2023-11-12)
datepicker/src/androidTest/ (0, 2023-11-12)
datepicker/src/androidTest/java/ (0, 2023-11-12)
datepicker/src/androidTest/java/com/ (0, 2023-11-12)
datepicker/src/androidTest/java/com/ozcanalasalvar/ (0, 2023-11-12)
datepicker/src/androidTest/java/com/ozcanalasalvar/datepicker/ (0, 2023-11-12)
datepicker/src/androidTest/java/com/ozcanalasalvar/datepicker/ExampleInstrumentedTest.java (774, 2023-11-12)
datepicker/src/main/ (0, 2023-11-12)
datepicker/src/main/AndroidManifest.xml (162, 2023-11-12)
datepicker/src/main/java/ (0, 2023-11-12)
datepicker/src/main/java/com/ (0, 2023-11-12)
datepicker/src/main/java/com/ozcanalasalvar/ (0, 2023-11-12)
... ...
# DatePicker&TimePicker
Picker is a date and time picker library that supports view-based and jetpack compose UI design.
The library has many different feature options to customize your widget. Also checkout this [Wheelview](https://github.com/ozcanalasalvar/Wheelview).
# Jetpack Compose Usage
```java
WheelDatePicker(
offset =/*offset*/,
yearsRange = IntRange(/*minYear*/,/*maxYear*/),
startDate =/*startDate*/,
textSize =/*textSize*/,
selectorEffectEnabled =/*selectorEffectEnabled*/,
darkModeEnabled =/*darkModeEnabled*/,
onDateChanged = { day, month, year, date ->
/*Handle date changes*/
}
)
```
#### Parameters
Parameter | Type | Description
------ | ----- | --
offset | Int | Count of items to be shown on picker
yearsRange | IntRange | Min and max date of picker
startDate | Long | Selected date of picker by default today date
textSize | Int | Size of text on picker
selectorEffectEnabled | Boolean | Uses to enable or disable the selection effect
darkModeEnabled | Boolean | Uses to enable or disable dark mode. If you disable it, although you set display settings dark, component stay light mode
onDateSelected | | Called when the values in the picker date picker are updated
```java
WheelTimePicker(
offset =/*offset*/,
timeFormat = TimeFormat.CLOCK_12H,
startTime =/*startTime*/,
textSize =/*textSize*/,
selectorEffectEnabled =/*selectorEffectEnabled*/,
darkModeEnabled =/*darkModeEnabled*/,
onTimeChanged = { hour, minute, format ->
/*Handle time changes*/
}
)
```
#### Parameters
Parameter | Type | Description
------ | ----- | --
offset | Int | Count of items to be shown on picker
timeFormat | TimeFormat | Time format of picker. TimeFormat.CLOCK_12H or TimeFormat.CLOCK_24H
startTime | Time | Selected time of picker by default current time
textSize | Int | Size of text on picker
selectorEffectEnabled | Boolean | Uses to enable or disable the selection effect
darkModeEnabled | Boolean | Uses to enable or disable dark mode. If you disable it, although you set display settings dark, component stay light mode
onTimeSelected | | Called when the values in the picker date picker are updated
# View Usage
> **_NOTE:_** If you would like to use library on view based ui, add [androidx.compose.material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) to gradle dependencies.
#### Date Picker
```java
datePicker.apply {
setOffset(/*offset*/)
setTextSize(/*textSize*/)
setDate(getCurrentTime())
setDarkModeEnabled(/*darkModeEnabled*/)
setDateChangeListener(object : DatePicker.DateChangeListener {
override fun onDateChanged(date: Long, day: Int, month: Int, year: Int) {
//Handle date changes
}
})
}
```
```xml
```
#### XML attributes
Parameter | Type | Description
------ | ----- | --
offset | Int | Count of items to be shown on picker
textSize | Int | Size of text on picker
darkModeEnabled | Boolean | Uses to enable or disable dark mode. If you disable it, although you set display settings dark, component stay light mode
##### Popup Usage
```java
val datePickerPopup = DatePickerPopup.Builder()
.from(/*context*/)
.offset(/*offset*/)
.textSize(/*textSize*/)
.selectedDate(getCurrentTime())
.darkModeEnabled(/*darkModeEnabled*/)
.listener(object : DatePickerPopup.DateSelectListener {
override fun onDateSelected(
dp: DatePicker?,
date: Long,
day: Int,
month: Int,
year: Int
) {
}
})
.build()
datePickerPopup.show(supportFragmentManager, TAG)
```
### Time Picker
```java
timePicker.apply {
setOffset(/*offset*/)
setTextSize(/*textSize*/)
setTimeFormat(TimeFormat.CLOCK_12H)
setTime(/*hour*/, /*minute*/)
setDarkModeEnabled(/*darkModeEnabled*/)
setTimeChangeListener(object : TimePicker.TimeChangeListener {
override fun onTimeChanged(hour: Int, minute: Int, timeFormat: String?) {
//Handle time changes
}
})
}
```
```xml
```
#### XML attributes
Parameter | Type | Description
------ | ----- | --
offset | Int | Count of items to be shown on picker
is24HourViewEnabled | Boolen | Time format of picker. If true TimeFormat.CLOCK_24H else TimeFormat.CLOCK_12H
textSize | Int | Size of text on picker
darkModeEnabled | Boolean | Uses to enable or disable dark mode. If you disable it, although you set display settings dark, component stay light mode
##### Popup Usage
```java
val pickerPopup = TimePickerPopup.Builder()
.from(/*context*/)
.offset(/*offset*/)
.textSize(/*textSize*/)
.setTime(/*hour*/, /*minute*/)
.setTimeFormat(TimeFormat.CLOCK_24H)
.darkModeEnabled(/*darkModeEnabled*/)
.listener(object : TimePickerPopup.TimeSelectListener {
override fun onTimeSelected(
timePicker: TimePicker?,
hour: Int,
minute: Int,
format: String?
) {
}
})
.build()
pickerPopup.show(supportFragmentManager, TAG)
```
## Implementation Gradle
###### Add it in your root build.gradle at the end of repositories:
```groovy
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
```
###### Add the dependency
```groovy
dependencies {
implementation 'com.github.ozcanalasalvar.picker:datepicker:2.0.7'
implementation 'com.github.ozcanalasalvar.picker:wheelview:2.0.7'
//For view based UI's
implementation 'androidx.compose.material3:material3:Tag'
}
```
近期下载者:
相关文件:
收藏者: