• Stars
    star
    597
  • Rank 74,979 (Top 2 %)
  • Language
    Java
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Quickly customize the calendar UI. You can use EasyCalendar to quickly get the calendar style UI.

EasyCalendar

Quickly customize the calendar UI. You can use EasyCalendar to quickly get the calendar style UI.

Feature

  • Custom layout for title.
  • Custom layout for date.
  • Show or hide divider for date.
  • Show or hide overflow date.
  • Listen to date's view be clicked.

Screenshot

默认样式 自定义样式

自定义样式 自定义样式

Gradle

compile 'com.sch.calendar:easy-calendar:1.0.1'

Attributes

name format description
titleColor color set color for title
titleLayout reference custom layout for title
weekColor color set color for week
weekBackground color|reference set background for week bar
monthBackground color|reference set backgroung for month layout
dateDividerColor color set color for divider of date
dateDividerSize dimension set size for divider of date
imgLastMonth reference set image for button of last month
imgNextMonth reference set image for button of next month
language enum china: 中文, english: English

API

  1. Show or hide overflow date.
/**
 * If true, show whole calendar.
 * e.g. showing date is April, if show whole calendar, 03/30 and 05/01 will show.
 */
public void setShowOverflowDate(boolean showOverflowDate);

public boolean isShowOverflowDate();
  1. Set format for title.
/**
 * Constructs a <code>SimpleDateFormat</code> using the given pattern and
 * the default date format symbols for the given locale.
 * <b>Note:</b> This constructor may not support all locales.
 * For full coverage, use the factory methods in the {@link DateFormat}
 * class.
 *
 * @param pattern the pattern describing the date and time format
 * @param locale  the locale whose date format symbols should be used
 */
public void setTitleFormat(String pattern, Locale locale);
  1. Set a listener for callback when date was clicked.
/**
 * Set listener for date be clicked.
 *
 * @param onDateClickedListener listener
 */
public void setOnDateClickedListener(OnDateClickedListener onDateClickedListener);
  1. Set a listener for callback when showing month changed.
/**
 * Set listener for current showing month changed.
 *
 * @param onMonthChangedListener listener
 */
public void setOnMonthChangedListener(final OnMonthChangedListener onMonthChangedListener);
  1. Set can or can't change month by drag.
/**
 * Set drag enable for page.
 */
public void setCanDrag(boolean canDrag);

/**
 * Return drag enable of page.
 */
public boolean canDrag();
  1. Set can or can't fling when finger off screen.
/**
 * Set fling enable for page.
 */
public void setCanFling(boolean canFling);

/**
 * Return fling enable of page.
 */
public boolean canFling();
  1. Set the visibility of the button for the month of switch.
/**
 * Set button visible for last month.
 *
 * @param visibility {@link Visibility}
 */
public void setLastMonthButtonVisibility(@Visibility int visibility);

/**
 * Set button visible for next month.
 *
 * @param visibility {@link Visibility}
 */
public void setNextMonthButtonVisibility(@Visibility int visibility);
  1. Get view of today.
/**
 * Return item view of today. If today not showing, return null。
 */
public View getTodayItemView();
  1. Set the calendar size will wrap content or not. Use this api you can set the calendar size will wrap content or not. if true, the layout's height will auto change with animation when month changed.
/**
 * Set the layout will wrap content or not.
 *
 * @param scaleEnable if true, the layout will wrap content.
 */
public void setScaleEnable(boolean scaleEnable);

Custom UI for date

You can use default UI for date by SampleVagueAdapter. Default UI only show date.

calendarView.setVagueAdapter(new SampleVagueAdapter());

You can custom UI for date by extend VagueAdapter , e.g. custom UI for checkin.

// layout_checkin_calendar_item must hava a TextView that's id is tv_day_of_month
calendarView.setVagueAdapter(new MyVagueAdapter(R.layout.layout_checkin_calendar_item));

private class MyVagueAdapter extends VagueAdapter<Map<String, Map<String, Checkin>>> {

    /**
     * @params dateLayout layout resource id for date, must hava a TextView that's id is tv_day_of_month
     */
    MyVagueAdapter(@LayoutRes int dateLayout) {
        super(dateLayout);
    }

    @Override
    public void onBindVague(View itemView, int year, @Month int month, @DayOfMonth int dayOfMonth) {
        // do something, show custom data  
    }

    @Override
    public void flagToday(View todayView) {            
        // do something, set a flag for today's view
    }

    @Override
    public void flagNotToday(View dayView, Date date) {
       // do something, set a flag for not today's view
    }
}

License

 Copyright 2017 StoneHui
 
 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.

More Repositories

1

AnimRefreshRecyclerView

下拉刷新和上拉加载更多的RecyclerView,具有下拉和刷新动画。
Java
577
star
2

PageRecyelerViewDemo

横向分页的RecyclerView,带有页码指示器。
Java
282
star
3

WXShareMultiImage

基于无障碍服务实现的微信朋友圈多图分享方案,兼容微信各个版本。
Kotlin
183
star
4

ColorUp

Cocos Creator 微信小游戏《七彩蹦蹦》
JavaScript
76
star
5

FileDownloadDemo

实现功能有多线程下载、断点下载、多任务并行下载、显示下载进度及下载速度等功能,亲测下载速度能与UC浏览器相媲美。
Java
62
star
6

Gank

A Flutter Application for gank.io
Dart
28
star
7

DragDeleteTextView

仿手机QQ消息数拖动删除效果。
Java
25
star
8

gesture_zoom_box

A widget for gesture zoom.
Dart
22
star
9

IBeauty

一个专门看妹子的App,MVP+Retrofit2+RxJava
Java
13
star
10

CropImage

功能:拍照或选择图片库图片并进行剪切
Java
12
star
11

Joystick

Cocos Creator 游戏摇杆(全方向、四方形、八方向、跟随模式)。
JavaScript
7
star
12

TestUninstall

使用jni技术,运行此项目可编译出一个具有监听应用卸载功能的.so库,使用.so库到其他项目时参考此代码进行配置。
Makefile
5
star
13

PythonUtils

Some utils for GitLab
Python
3
star
14

Camera

Based on Camera and Camera2. Support flash, focus, zoom, switch camera, photo, video, default UI, etc.
Java
3
star
15

shichaohui

1
star
16

Shortcut

快捷方式练习,给程序设置多入口,不同入口进入应用显示不同内容。
Java
1
star
17

shichaohui.github.io

My homepage.
JavaScript
1
star