All Projects → npanigrahy → Custom Calendar View

npanigrahy / Custom Calendar View

The CustomCalendarView provides an easy and customizable calendar to create a Calendar. It dispaly the days of a month in a grid layout and allows to navigate between months

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Custom Calendar View

Swift Week View
An iOS calendar library for displaying calendar events in a week view.
Stars: ✭ 88 (-22.12%)
Mutual labels:  calendar-view
Dotfiles
This is a mirror from https://gitlab.com/andreyorst/dotfiles
Stars: ✭ 103 (-8.85%)
Mutual labels:  snippets
Unitylibrary
📚 Library of all kind of scripts, snippets & shaders for Unity
Stars: ✭ 1,968 (+1641.59%)
Mutual labels:  snippets
Docpht
With DocPHT you can take notes and quickly document anything and without the use of any database.
Stars: ✭ 90 (-20.35%)
Mutual labels:  snippets
Atom Turbo Javascript
Commands and snippets for faster Javascript and Typescript with the Atom Editor
Stars: ✭ 100 (-11.5%)
Mutual labels:  snippets
Sketchup Ruby Api Tutorials
SketchUp Ruby API Tutorials and Examples
Stars: ✭ 105 (-7.08%)
Mutual labels:  snippets
Meeting Scheduler
Drop-in calendar event booking tool for your app's users that integrates with Google, Outlook, Exchange, and CalDAV..
Stars: ✭ 88 (-22.12%)
Mutual labels:  calendar-view
Embedme
Utility for embedding code snippets into markdown documents
Stars: ✭ 113 (+0%)
Mutual labels:  snippets
Ncm R
R autocompletion for Neovim and vim 8 📝 📊 ⚡️
Stars: ✭ 102 (-9.73%)
Mutual labels:  snippets
Lh Cpp
C&C++ ftplugins suite for Vim
Stars: ✭ 108 (-4.42%)
Mutual labels:  snippets
Vim React Snippets
Useful snippets for developing in React (Javascript and Typescript)
Stars: ✭ 92 (-18.58%)
Mutual labels:  snippets
Atom Ava
Snippets for AVA and run tests directly in the editor
Stars: ✭ 96 (-15.04%)
Mutual labels:  snippets
Glsnip
copy and paste across machines
Stars: ✭ 107 (-5.31%)
Mutual labels:  snippets
Frame
New-tab extension for Chrome and Firefox
Stars: ✭ 89 (-21.24%)
Mutual labels:  calendar-view
Laravel 5 Snippets
Laravel 5 Snippets for Sublime Text
Stars: ✭ 110 (-2.65%)
Mutual labels:  snippets
Vscode Nestjs Snippets
💥 Vscode NestJS Code Snippets
Stars: ✭ 88 (-22.12%)
Mutual labels:  snippets
Sublime Robot Framework Assistant
Robot Framework plugin for Sublime Text3
Stars: ✭ 103 (-8.85%)
Mutual labels:  snippets
Itnotes
个人笔记,IT相关。
Stars: ✭ 113 (+0%)
Mutual labels:  snippets
Rose
Simple PHP search engine that supports Russian and English morphology
Stars: ✭ 111 (-1.77%)
Mutual labels:  snippets
Regex Snippets
Organized list of useful RegEx snippets
Stars: ✭ 109 (-3.54%)
Mutual labels:  snippets

Custom-Calendar-View

To use the CustomCalendarView in your application, you first need to add the library to your application. You can do this by either from Gradle, Maven or by directly downloading the source code form GitHub.

If you enjoy this library, don’t forget to follow me on Twitter @npanigrahy or visit my blog.

Features

Currently it supports the following features:

  • Next and previous month navigation
  • Allow various customization including background color for day, week and title
  • Set custom typeface using setCustomTypeFace() method.
  • Show hide next previous month overflow days
  • Set custom day options for start day of week. By default it is set to Calendar.SUNDAY
  • Unlimited customizations for day of the month using custom Decorators.
  • Allow you to handle event when user changes month and day selection.

alt text

Gradle

Step 1 Add the JitPack repository to your build file. Add it in your build.gradle at the end of repositories.

  repositories {
    maven { url "https://jitpack.io" }
  }

Step-2 Add the dependency in the form

dependencies {
    compile 'com.github.npanigrahy:Custom-Calendar-View:v1.0'
}

Maven

<repository>
     <id>jitpack.io</id>
     <url>https://jitpack.io</url>
</repository>

Step 2 Add the dependency in the form

<dependency>
     <groupId>com.github.npanigrahy</groupId>
     <artifactId>Custom-Calendar-View</artifactId>
     <version>v1.0</version>
</dependency>

Sbt

Step-1 Add it in your build.sbt at the end of resolvers:

resolvers += "jitpack" at "https://jitpack.io"

Step-2 Add the dependency in the form

libraryDependencies += "com.github.npanigrahy" % "Custom-Calendar-View" % "v1.0"

Using CustomCalendarView Library

The GitHub project source includes a sample application, that is used for demonstrating the various features currently supported by this library. Once the library is added to your project, you can include the CustomCalendarView into your activity/fragment layout using the following code snippets.

<com.stacktips.view.CustomCalendarView
	android:id="@+id/calendar_view"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:background="#ffffff">
</com.stacktips.view.CustomCalendarView>

The above code snippet will show the simple Calendar View with default design. Now, you can use the following attributes, to customize the appearance of calendar.

<com.stacktips.view.CustomCalendarView
        android:id="@+id/calendar_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/off_white"
        app:calendarBackgroundColor="@color/off_white"
        app:calendarTitleTextColor="@color/black"
        app:currentDayOfMonthColor="@color/blue"
        app:dayOfMonthTextColor="@color/black"
        app:dayOfWeekTextColor="@color/black"
        app:disabledDayBackgroundColor="@color/off_white"
        app:disabledDayTextColor="@color/grey"
        app:selectedDayBackgroundColor="@color/blue"
        app:titleLayoutBackgroundColor="@color/white"
        app:weekLayoutBackgroundColor="@color/white">
</com.stacktips.view.CustomCalendarView>

Let us now, initialize the calendar view to control the various other appearance and behavior of calendar using the following methods.

//Initialize CustomCalendarView from layout
calendarView = (CustomCalendarView) findViewById(R.id.calendar_view);

//Initialize calendar with date
Calendar currentCalendar = Calendar.getInstance(Locale.getDefault());

//Show Monday as first date of week
calendarView.setFirstDayOfWeek(Calendar.MONDAY);

//Show/hide overflow days of a month
calendarView.setShowOverflowDate(false);

//call refreshCalendar to update calendar the view
calendarView.refreshCalendar(currentCalendar);

//Handling custom calendar events
calendarView.setCalendarListener(new CalendarListener() {
    @Override
    public void onDateSelected(Date date) {
        SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
        Toast.makeText(MainActivity.this, df.format(date), Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onMonthChanged(Date date) {
        SimpleDateFormat df = new SimpleDateFormat("MM-yyyy");
        Toast.makeText(MainActivity.this, df.format(date), Toast.LENGTH_SHORT).show();
    }
});

Using Custom TypeFace

//Setting custom font
final Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Arch_Rival_Bold.ttf");
if (null != typeface) {
    calendarView.setCustomTypeface(typeface);
    calendarView.refreshCalendar(currentCalendar);
}

Custom Calendar View Library in Android Custom Font

Using Day Decorators

//adding calendar day decorators
List decorators = new ArrayList<>();
decorators.add(new ColorDecorator());
calendarView.setDecorators(decorators);
calendarView.refreshCalendar(currentCalendar);
Custom Calendar View Library in Android Decorator

License

/*
 * Copyright (C) 2015 Stacktips {link: http://stacktips.com}.
 *
 * 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.
 */
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].