FlexibleCalendar


Source link: https://github.com/p-v/FlexibleCalendar

FlexibleCalendar

A customizable calendar for android with customizable events.

Gradle

Add dependencies in build.gradle,

dependencies {

  compile 'com.p_v:flexiblecalendar:1.2.1' 
}

Customize FlexibleCalendar using the CalendarView interface

calendarView.setCalendarView(new FlexibleCalendarView.CalendarView() {

  @Override
  public BaseCellView getCellView(int position, View convertView, ViewGroup parent, int cellType) {

//customize the date cells

BaseCellView cellView = (BaseCellView) convertView;

if (cellView == null) {

 LayoutInflater inflater = LayoutInflater.from(CalendarActivity4.this);

 cellView = (BaseCellView) inflater.inflate(R.layout.calendar3_date_cell_view, null);

}

if (cellType == BaseCellView.TODAY){

 cellView.setTextColor(getResources().getColor(android.R.color.holo_red_dark));

 cellView.setTextSize(15);

}
 else {

 cellView.setTextColor(getResources().getColor(android.R.color.white));

 cellView.setTextSize(12);

}

return cellView;
  
}

  @Override
  public BaseCellView getWeekdayCellView(int position, View convertView, ViewGroup parent) {

//customize the weekday header cells

BaseCellView cellView = (BaseCellView) convertView;

if (cellView == null) {

 LayoutInflater inflater = LayoutInflater.from(CalendarActivity4.this);

 cellView = (BaseCellView) inflater.inflate(R.layout.calendar3_week_cell_view, null);

 cellView.setBackgroundColor(getResources().getColor(android.R.color.holo_purple));

 cellView.setTextColor(getResources().getColor(android.R.color.holo_orange_light));

 cellView.setTextSize(18);

}

return cellView;
  
}

  @Override
  public String getDayOfWeekDisplayValue(int dayOfWeek, String defaultValue) {

return String.valueOf(defaultValue.charAt(0));

  
}
 
}
);

Display events for a day using the EventDataProvider

calendarView.setEventDataProvider(new FlexibleCalendarView.EventDataProvider() {

  @Override
  public List<? extends Event> getEventsForTheDay(int year, int month, int day) {

return getEventColorList(year,month,day);

  
}
 
}
);

Track the month change event by setting the OnMonthChangeListener

calendarView.setOnMonthChangeListener(new FlexibleCalendarView.OnMonthChangeListener() {

  @Override
  public void onMonthChange(int year, int month, int direction) {

//do things on month change
  
}
 
}
);

Customizations:

Display events in different styles.

 

Customize the cells and events by extending the class BaseCellView.

Existing cells include CircularEventCellView, SquareCellView and EventCountCellView.

Choose whether to show dates outside month or not by setting the showDatesOutsideMonth flag, using FlexibleCalendarView#showDatesOutsideMonth() method.

Set the first day of the week using FlexibleCalendarView#setStartDayOfTheWeek method or through xml by setting the attribute startDayOfTheWeek.

Disable auto date selection on month change by using FlexibleCalendarView#disableAutoDateSelection method or through xml by using disableAutoDateSelection.

 

Navigate the calendar:

selectDate - Scroll and select the provided date goToCurrentDay - Go the the current day
goToCurrentMonth - Go the the current month
moveToNextDate - Select the date after the current selection
moveToPreviousDate - Select the date before the current selection
moveToNextMonth - Move the view to the next month from the current visible month
moveToPreviousMonth - Move the view to the previous month from the current visible month

Customizable display cells with different states:

state_date_regular - Regular date
state_date_today - Today's date
state_date_selected - Selected date
state_date_outside_month - Date lying outside month but in current month view

Sample cell background:

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:flexible="http://schemas.android.com/apk/res-auto">
  <item flexible:state_date_regular="true"

android:drawable="@drawable/cell_purple_background"/>
  <item flexible:state_date_today="true"

android:drawable="@drawable/cell_gray_background"/>
  <item flexible:state_date_selected="true"

android:drawable="@drawable/cell_red_background"/>
  <item flexible:state_date_outside_month="true"

android:drawable="@drawable/cell_blue_background"/> </selector>

Resources

LabelLayout is a powerful layout to display label on top of another view

Use builder to define a selector button.

This is a collection of custom Views and animations.

CaptchaImageView is a custom imageview to generate captcha text.

A RecyclerView adapter that can handle holding hetrogeneuous data types, and provides the ability to set up sections in your adatper.

Kotlin Language Integrated Production System (KLIPS)

A rule based AI engine to simplify design of AIs for games in particular. DSL included!

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes