Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/blackboxvision/datetimepicker-edittext

📅 A set of EditTexts with built-in support for Date and TimePicker's using Fragments
https://github.com/blackboxvision/datetimepicker-edittext

android calendar datetimepicker edittext java library timepicker

Last synced: 2 months ago
JSON representation

📅 A set of EditTexts with built-in support for Date and TimePicker's using Fragments

Awesome Lists containing this project

README

        

# DateTimePicker EditText
> :calendar: A set of EditTexts with built-in support for Date and TimePicker's using Fragments

[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-DateTimePickerEditText-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5029) [![](https://jitpack.io/v/BlackBoxVision/datetimepicker-edittext.svg)](https://jitpack.io/#BlackBoxVision/datetimepicker-edittext)

## Installation

Actually I don't have this library in **JCenter/Maven Central**, so if you want to use, follow the instructions.

**Gradle**

- Add it in your root build.gradle at the end of repositories:
```gradle
allprojects {
repositories {
...
maven {
url "https://jitpack.io"
}
}
}
```

- Add the dependency:
```gradle
dependencies {
implementation 'com.github.BlackBoxVision:datetimepicker-edittext:v0.5.0'
}
```

**Maven**

- Add this line to repositories section in pom.xml:
```xml


jitpack.io
https://jitpack.io

```
- Add the dependency:
```xml

com.github.BlackBoxVision
datetimepicker-edittext
v0.5.0

```

**SBT**

- Add it in your build.sbt at the end of resolvers:
```sbt
resolvers += "jitpack" at "https://jitpack.io"
```

- Add the dependency:
```sbt
libraryDependencies += "com.github.BlackBoxVision" % "datetimepicker-edittext" % "v0.5.0"
```

## Sample Usage

In your activity layout xml:

```xml

```

The available tags are the following ones:
- **dateTimePicker:theme**: Reference to a custom theme related to the DatePicker or TimePicker dialog style
- **dateTimePicker:minDate**: String, it must be a string date in the format 'dd/MM/yyyy' or if you want current date pass 'CR_DATE'
- **dateTimePicker:maxDate**: String, it must be a string date in the format 'dd/MM/yyyy' or if you want current date pass 'CR_DATE'
- **dateTimePicker:dateFormat**: String, it represents the format that the date will be shown in the EditText, the default is 'dd/MM/yyyy'
- **dateTimePicker:timeFormat**: String, it represents the format that the time will be shown in the EditText, the default is 'HH:mm'
- **dateTimePicker:is24HourView**: Boolean, it tells the TimePicker how to show it

And in your Activity class

```java
public final class MainActivity extends AppCompatActivity {

private DatePickerEditText datePickerEditText;
private TimePickerEditText timePickerEditText;

private DatePickerInputEditText datePickerInputEditText;
private TimePickerInputEditText timePickerInputEditText;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

datePickerEditText = (DatePickerEditText) findViewById(R.id.datePickerEditText);
timePickerEditText = (TimePickerEditText) findViewById(R.id.timePickerEditText);

datePickerInputEditText = (DatePickerInputEditText) findViewById(R.id.datePickerInputEditText);
timePickerInputEditText = (TimePickerInputEditText) findViewById(R.id.timePickerInputEditText);
}
}
```

## License

Distributed under the **MIT license**. See [LICENSE](https://github.com/BlackBoxVision/datetimepicker-edittext/blob/master/LICENSE.txt) for more information.