Git Product home page Git Product logo

horizontalcalendar's Introduction

header

A horizontal calendar scrollable and customizable. Programmed 100% in Kotlin. Calendar available in Spanish and English.

Installation

Very easy! The library is hosted on jcenter. You just have to add this to your project in build.gradle :

repositories {
      jcenter()
}
    
dependencies {
      compile 'com.oscarvera:scrollhorizontalcalendar:0.4.0.4'
}

Usage

  1. First add the view in the layout you want:
<com.rudo.calendarhorizontal.HorizontalCalendarView
    android:id="@+id/horizontalcalendarview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>
  1. Initialize the calendar with the basic fields in your Activity or Fragment:

Kotlin:

HorizontalCalendar.Build(YOUR_ACTIVITY,
                   R.id.horizontalcalendarview, //Id of the calendar view
                   BasicStyle( //Basic Style of the calendar
                      R.color.YOUR_COLOR,  //Color of the days before the current date
                      R.color.YOUR_COLOR, //Color of the days after the current date
                      R.color.YOUR_COLOR)) //Color of the current day
                   .build() 

Java:

new HorizontalCalendar.Build(YOUR_ACTIVITY,
                   R.id.horizontalcalendarview, //Id of the calendar view
                   new BasicStyle( //Basic Style of the calendar
                      R.color.YOUR_COLOR,  //Color of the days before the current date
                      R.color.YOUR_COLOR, //Color of the days after the current date
                      R.color.YOUR_COLOR)) //Color of the current day
                   .build() 

This option will take the default values

Customization

You can customize the default values of the calendar setting this fields in Build.

  • Days in screen. You can choose the number of days shown on the screen at the same time:
   ...
   .daysInScreen(NUMBER_OF_DAYS)
   ...
  • Maximum days range. Maximum number of days / months that can be selected before and after the current date.
   ...
   .rangeMax(7,HorizontalCalendar.TIMEMEASURE.DAY) //You can choose months directly with TIMEMEASURE.MONTH
   ...
  • Extra period. You can select an extra period in the calendar. This period is going to show in a different color.
   ...
   .periodSelected(DATE_START,
                   DATE_END,
                   R.color.YOUR_COLOR) //different color of that period of days
   ...
  • Selected days. You can highlight calendar days with a small dot bellow. The days do not need to be correlated.
  ...
  .selectedDays(LIST_DATES, //ArrayList of Dates to select
                R.color.YOUR_COLOR) //Color of the lower icon
  ...
  • Listener. It collects all the clicks and data of the day clicked on the calendar.

Java:

...
.onClickDay(new OnClickDateCalendar() {
           @Override
           public void onClickDate(@NotNull Date date, boolean isInExtraRange, boolean isSelected) {
             //Class date of the day clicked.
             //If has extra period
             //If is selected
           }
       })
...

Kotlin (Implement OnClickDateCalendar interface in the Activity):

...
.onClickDay(this)
...
...
override fun onClickDate(date: Date, isInExtraRange: Boolean, isSelected: Boolean) {
      // date: Class date of the day clicked.
      //isInExtraRange: If has extra period
      //isSelected: If is selected
   }
...

Versions

We are currently in the process of development. The current version is in beta phase.

License

Copyright 2018
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.

horizontalcalendar's People

Contributors

oscarvera 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.