Git Product home page Git Product logo

datepickertimeline's Introduction

DatePickerTimeline

An android package that provides a Horizontal Date Picker.

Download

DatePicker Logo

Gradle

In your module (app-level) Gradle file (usually app/build.gradle), Add this line inside the dependencies block.

dependencies {
    ...
    implementation 'com.vivekkaushik.datepicker:datePickerTimeline:0.0.4'
}

Usage

Add DatePickerTimeline View to your layout file

<com.vivekkaushik.datepicker.DatePickerTimeline
android:id="@+id/datePickerTimeline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Properties:

You can use the following properties in your XML to change your DatePickerTimeline colors.

  • app:dateTextColor (color) -> default -> Black
  • app:dayTextColor (color) -> default -> Black
  • app:monthTextColor (color) -> default -> Black
  • app:disabledColor (color) -> default -> Grey

JAVA

DatePickerTimeline datePickerTimeline = findViewById(R.id.dateTimeline);
// Set a Start date (Default, 1 Jan 1970)
datePickerTimeline.setInitialDate(2019, 3, 21);
// Set a date Selected Listener
datePickerTimeline.setOnDateSelectedListener(new OnDateSelectedListener() {
    @Override
    public void onDateSelected(int year, int month, int day, int dayOfWeek) {
        // Do Something
    }

    @Override
    public void onDisabledDateSelected(int year, int month, int day, int dayOfWeek, boolean isDisabled) {
        // Do Something
    }
});

// Disable date
Date[] dates = {Calendar.getInstance().getTime()};
datePickerTimeline.deactivateDates(dates);

You can also use the built in methods to change the text color

datePickerTimeline.setDateTextColor(Color.RED);
datePickerTimeline.setDayTextColor(Color.RED);
datePickerTimeline.setMonthTextColor(Color.RED);

LIMITATIONS

  • Text Size currently can't be changed

FIXES

  • This project is using AndroidX artifacts make sure you have migrated your project to androidX.
  • If Preview dosen't show up in android Studio then make sure you have added android recycler view.

Flutter

This library is also available for flutter check the github repo here. Also available on pub.dev

Author

datepickertimeline's People

Contributors

iamvivekkaushik avatar wahyupermadie 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.