Skip to content

An android package that provides horizontal date picker as week and day mode within a given range of year.

License

Notifications You must be signed in to change notification settings

rrsaikat/RCalendar

Repository files navigation

RCalendar

Feature Image

An android package that provides horizontal date picker as week and day mode within a given range of year. This library extends Recyclerview and JodaTime. Feel free to use it all you want in your Android apps provided that you cite this project and include the license in your app.

Demo App:

Get it on Google Play

Usage Guide

Have to enable Kotlin and AndroidX, because this project only works into this configuration and not available for java.

STEP 1: Download rcalenderlib_vX.X.X.aar from here:

Download

STEP 2: Put the downloaded library file into libs folder like this:

nb: Don't forget to navigate the library into projects build.gradle:

        allprojects {
            repositories {
                google()
                jcenter()
                flatDir {
                    dirs 'libs'
                  }
              }
          }      

STEP 3: Reference the library itself in your module-level build.gradle:

    api(name: 'rcalenderlib_v2.5.0', ext: 'aar')

STEP 4: Add more required libraries into your module-level build.gradle:

    implementation 'com.google.android.material:material:1.1.0'
    implementation 'joda-time:joda-time:2.10.1'

STEP 5: Finally sync and build.

Usage Example

In XML :

  <com.rezwan.rcalenderlib.views.YearRangeCalendarView
          android:id="@+id/yearRangeCalendarView"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:month_name_maxlength="two"
          app:date_start_name="Wednesday"
          app:highlight_today_at_startup="true"
          app:sticky_date="false"
          app:calendar_style="light"
          app:show_month="false"
          app:start_year="2020"
          app:end_year="2021"
          app:calendar_mode="week"/>

In Activity/Fragment:

          yearRangeCalendarView.setYearRangeListener(this)
               override fun OnDateClicked(rCalendar: RCalendar, position: Int) {

               }

               override fun OnSelectedDateFound(
                    rCalendar: RCalendar,
                    firstDayOfWeek: String,
                    lastDayOfWeek: String,
                    dayPosition: Int,
                    currentPageNum: Int) {

                  }

Methods

Methods Return Description
setYearRange(startYear: Int, endYear: Int) void set the start and end year.
setMonthTextLength(textLength: Int) void set the text length of month.
setIsDateSticky(isSticky: Boolean) void tracks your previous selected date position.
navigateToPrevious() void go to previous week/day .
navigateToNext() void go to next week/day.
navigateToday() void highlight or go to at today's date position.
navigateToStart() void go to starting week/day.
navigateToEnd() void go to ending week/day.
navigateToPage(pageNumber: Int) void go to specific week/day position.
gotoDate(date:LocalDate) void go to specific date in between the year range.
currentFirtDayOfWeek() String get current first day of visible week/day.
currentLastDayOfWeek() String get current last day of visible week/day.
getIsDateSticky() boolean get if selected date will remains sticky or not.
getTotalDays() Int get total number of days(start year ~ end year).
getTotalWeeks() Int get total number of weeks.
getCurrentPagePos() Int get current visible position of week/day.
getStartYear() Int get starting year.
getEndYear() Int get ending year.
getStartDate() LocalDate get first day from the year range.
getEndDate() LocalDate get last day from the year range.
today() LocalDate get today's date

Attributes

Attributes Default Description
month_name_maxlength two set the month text length.
viewbackground colorDark set the background of calendar view.
date_text_color
day_text_color
month_text_color
active_date_background rounded bg set the background of selected date only.
inactive_date_background transparent set the background of unselected dates.
date_start_name starting day of starting year customize the starting day of starting year.
highlight_today_at_startup false highlights date of today at startup.
calendar_style dark available styles are dark and light.
show_month false hide/show text of months.
start_year current year should be smaller than end year.
end_year current year should be bigger than start year.
calendar_mode week can set to week or day mode.
sticky_date false only available for week view and it tracks of your previous selected date position if its true.

Project example is here for better understanding:

GO TO WeekView Example

GO TO DayView Example

Video Sample (Installaion or setup)

GO TO Tutorial

Author

👤 RRSaikat

Inspired From -

DatePicker Logo

Copyright

Copyright 2020 RRsaikat. All rights reserved. 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.

About

An android package that provides horizontal date picker as week and day mode within a given range of year.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages