Giter VIP home page Giter VIP logo

datetimepickerlibrarydemo's Introduction

DateTimePickerLibraryDemo

Integration and working of date and time picker.

About Date Time Picker Library

If you are looking for an date and time picker or (date or time picker alone) you are in the right zone. This is the library which will give you the date as well as the time in specified format. All you have to do is to add the maven repository url and the implementation into your project. It will give the result in the required and mentioned format. Hope you guys enjoy the library. Please give STARS if you like this library. Thanks folks....

Implementation

  1. In your project.gradle file just add the maven url file as mentioned below
allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url  "https://niyaz434.bintray.com/DateTimePickerLibrary"
        }
    }
}
  1. Add this line into your build.gradle dependencies of your project

implementation 'com.datetimepicker.datetimepickerlibrary:datetimepickerlibrary:0.0.4'

And you can able to use the date time picker now.

Intialization

Intialize your date time picker library from the following code and you can able to see the picker

{

DateTimeConfig.Builder dateTimeConfigBuilder = new DateTimeConfig.Builder()     //intializing the builder
            .setDialogTitle("Pick a date")      //apply your title of the date time picker
            .setTimePickerTitle("Choose time also please")      //#Optional if your using time picker here
            .setDateTimePickerFeild(AppConstants.TIME_PICKER_ONLY)  //set what you want date or time or both pickers here
            .setPositiveButton("All Set Go")      //positive button text field here
            .setSpinnerOrDefaultMode(AppConstants.SPINNER_MODE)     //Mode want in the spinner mode or default mode
            .setNegativeButton("No I don't need it")      //Negative button text
            .setDateOrTimeFormat("hh/mm/ss");     //Important Set the correct format you want as a result
    DateTimeConfig dateTimeConfig = dateTimeConfigBuilder.build();
    DateTimePicker dateTimePicker = new DateTimePicker(dateTimeConfig);
    dateTimePicker.show(this,this);   // Starting the date time picker library

}

Result Callback

Here, you can able to get the result accordingly. If user select some date you can get result in dateTime Success and if user clicked cancel you will recieve the error code. Below mentioned the types and cause of the error code.

{
    @Override
    public void dateTimeSuccess(DateTimeResult dateTimeResult) {
        if (dateTimeResult != null) {
            Log.d("dateTimeResult", "dateTimeResult: " + dateTimeResult.toString());
            String dateTime = dateTimeResult.getDatetimeRequestedFormat();
            Log.d("dateTimeSuccess", "dateTimeSuccess: " + dateTime);
        }
    }

    @Override
    public void dateTimeFailure(int errorCode) {
        Log.d("dateTimeFailure", "dateTimeFailure: " + String.valueOf(errorCodes));
    }

}

Result Success CallBack

Result Readme
datetimeRequestedFormat Returns the result in String as requested format which is added in requested format
dateTimeInMillis Returns the result in long in milliseconds

Screen Shots

Below are some screen shots which will make understanding easily... This library is under development. It will enhanced along with features and issues are most welcome. Kindly raise your suggestions in issue box. Thanks.

datetimepickerlibrarydemo's People

Contributors

niyaz434 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.