Giter VIP home page Giter VIP logo

easycalendar's Introduction

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.

easycalendar's People

Contributors

shichaohui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easycalendar's Issues

Change date text color and change DayViewDecorator

I want to change the text color of date and also want to change day view background view like DayViewDecorator .

I have checked this library but there is no any specific method to do that.

So please give me some solution.

我看不到整個日曆日期明智

我無法顯示滿月的日曆日期。我已經用過了

calendarView.setShowOverflowDate(true);
calendarView.setScaleEnable(true);

但它不工作。

issue importing

I get this:

Unable to load class 'org.gradle.api.internal.component.Usage'. Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

image

Change Day Week Label

please add function to change the days week label, something like setDaysWeekLabel(String[] weekArr), thank you

Calendar height varies with month swipes

My calendar height is going to vary for different months while swipe.

For decemeber 2017 month the height is different. I have used following method to overcome with it but none of them are working for me.

   calendarView.setCanDrag(false);
   calendarView.setScaleEnable(true);
   calendarView.setShowOverflowDate(true);
   calendarView.setCanFling(false);

Also, I have applied divider between dates. It works well too but the one issue is there is no separator between week layout and calendar. Instead of separator is showing at bottom which no need.

Thanks.

Have a fixed height for each date cell

Hi,

Is there a way to have a fixed height for each date cell in the calendar?
For example, following the example folder, there is a file named layout_action_calendar_item which render each calendar cell, is there a way to set a fixed height for those cells?

I'm trying with:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="49dp"
    android:layout_height="88dp">

    <TextView
        android:id="@id/tv_day_of_month"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:gravity="center"
        android:lineSpacingExtra="12sp"
        android:textColor="@color/colorBlack"
        android:textSize="12sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
    </android.support.v7.widget.RecyclerView>
</android.support.constraint.ConstraintLayout>

But seems to be not working. Any help will be appreciate it

set a particular date directly.

how to open directly selected date in this lib.

For example, the current date is 13/12/2017. I want to display 13/01/2017 (my selected date ) directly when the calendar open. like need to open jan in the calendar.

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.