Android calendar view (like card)

Overview

Android Arsenal

API

android-calendar-card (Google Play Demo)

Android calendar view (like card) Simple and easy to modify

Author: Michał Szwarc

CalendarCard screenshot 2

#CalendarCardPager

CalendarCardPager screenshot2

License

Copyright 2013-2015 Michał Szwarc

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.
You might also like...
📅 Material Design Calendar compatible with API 11+
📅 Material Design Calendar compatible with API 11+

Prettier and simpler Material Design CalendarView MaterialCalendarView is a prettier and simpler, material design calendar that allows full customiz

JetCalendarView - A calendar library for Jetpack Compose
JetCalendarView - A calendar library for Jetpack Compose

JetCalendar WIP 2022 Hit Refresh! Calendar view ❤️ Jetpack Compose License Copyr

Wheel-like spinner widget for Android

Update Dec 2016 Library is discontinued There's still a lot of wheel libraries out there. Update Oct 2014 I am thinking of rewriting this control. Upd

A material-styled android view that provisions picking of a date, time & recurrence option, all from a single user-interface.
A material-styled android view that provisions picking of a date, time & recurrence option, all from a single user-interface.

SublimePicker A customizable view that provisions picking of a date, time & recurrence option, all from a single user-interface. You can also view 'Su

Jetlime - A simple library for TimeLine view in Android
Jetlime - A simple library for TimeLine view in Android

JetLime ⏱️ A simple yet highly customizable library for showing a TimeLine view

Color-My-View-App - Layouts - ColorMyViews app
Color-My-View-App - Layouts - ColorMyViews app

Layouts - ColorMyViews app This is the second toy app for lesson 2 of the Androi

A Material design back port of Android's CalendarView
A Material design back port of Android's CalendarView

Material Calendar View A Material design back port of Android's CalendarView. The goal is to have a Material look and feel, rather than 100% parity wi

Pick a date or time on Android in style
Pick a date or time on Android in style

Material DateTime Picker - Select a time/date in style Material DateTime Picker tries to offer you the date and time pickers as shown in the Material

[NO LONGER MAINTAINED] Android library for better Picker DialogFragments
[NO LONGER MAINTAINED] Android library for better Picker DialogFragments

/!\ This Project is no longer maintained /!\ DialogFragments modeled after the AOSP Clock and Calendar apps to improve UX for picking time, date, numb

Comments
  • Last Months dates

    Last Months dates

    Last months dates go to 32. Looking at your screenshots it didn't do it at one point but does it now. Know of a fix? I don't mind fixing for you but since it seems to be rather recent maybe it's something you could just roll back. 2014-01-28-23-08-03 1

    opened by steff2632 5
  • Need to show previous month also previous year

    Need to show previous month also previous year

    how to show previous month and previous year of month as usual now show in your project current month and next month also next year of month...please help me

    opened by Debdeep1234 0
  • Is it possible to show from Sunday to Monday?

    Is it possible to show from Sunday to Monday?

    Thank @kenumir so much for this best Calendar library.

    I custom your calendar and show correctly from Monday to Sunday with respective day.

    Now I want show from Sunday to Monday.

    • I'm able to show the Title from Sunday to Monday.
    • But the Day not show respectively with.

    I try to set locale or setFirstDayOfWeek but looks not work as I thought.

    in CalendarCard.java

     private void updateCells(boolean isRefresh, ArrayList<CardGridItem> o) {
                   Calendar cal;
                   Integer counter = 0;
    
            if (mCalendarDateDisplay != null)	cal = (Calendar) mCalendarDateDisplay.clone();
            else	cal = Calendar.getInstance();
    
            /*
             * Set specified specifiedMonth to refresh if have
             */
            if (isRefresh)  cal.set(Calendar.MONTH, getSpecifiedMonth());
            cal.set(Calendar.DAY_OF_MONTH, 1);
    
            int daySpacing = getDaySpacing(cal.get(Calendar.DAY_OF_WEEK));
    
            /*
             DAY IN PREVIOUS MONTH
              */
            if (daySpacing > 0) {
                Calendar mCalPrevMonth = (Calendar)cal.clone();
    
                mCalPrevMonth.add(Calendar.MONTH, -1);
                mCalPrevMonth.set(Calendar.DAY_OF_MONTH, mCalPrevMonth.getActualMaximum(Calendar.DAY_OF_MONTH) - daySpacing + 1);
    
                for(int i=0; i<daySpacing; i++) {
                    CheckableLayout cell = cells.get(counter);
                    cell.setTag(
                            new CardGridItem(mCalPrevMonth.get(Calendar.DAY_OF_MONTH), mCalPrevMonth.get(Calendar.MONTH), mCalPrevMonth.get(Calendar.YEAR))
                                    .setEnabled(isValidMonth(mCalPrevMonth))
                                    .setDiffMonth(true)
                                    .setSaturday(isSaturday(mCalPrevMonth))
                                    .setSunday(isSunday(mCalPrevMonth))
                                    .setTransferToSpecifiedMonth(true));
    
                    /*
                    Need check previous month is out of range or not
                    - If Yes, should disable cell
                     - If no, allow select previous and transfer to previous month
                     */
                    cell.setEnabled(isValidMonth(mCalPrevMonth));
    
                    (mOnItemRender == null ? mOnItemRenderDefault : mOnItemRender).onRender(cell, (CardGridItem)cell.getTag());
                    counter++;
                    mCalPrevMonth.add(Calendar.DAY_OF_MONTH, 1);
                }
            }
    
            /*
            DAY IN CURRENT MONTH
             */
            // Reset first day & last day in Card array for checking & update new items from API
            int firstDay = cal.get(Calendar.DAY_OF_MONTH);
    
            cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
    
            int lastDay = cal.get(Calendar.DAY_OF_MONTH) + 1;
    
            Calendar mCalCurrentMonth = Calendar.getInstance();
            int currentDay = mCalCurrentMonth.get(Calendar.MONTH) == cal.get(Calendar.MONTH) ?
                    mCalCurrentMonth.get(Calendar.DAY_OF_MONTH) :
                    cal.get(Calendar.DAY_OF_MONTH);
    
            for (int i = firstDay; i < lastDay; i++) {
    
                cal.set(Calendar.DAY_OF_MONTH, i - 1);
    
                Calendar date = (Calendar) cal.clone();
                date.add(Calendar.DAY_OF_MONTH, 1);
    
                CheckableLayout cell = cells.get(counter);
    
                /*
                Change to logic disable from first day to current day to show respective color
                */
                CardGridItem item = new CardGridItem(i, date.get(Calendar.MONTH), date.get(Calendar.YEAR))
                        .setEnabled(isValidDay(date))
                        .setDate(date)
                        .setSaturday(isSaturday(date))
                        .setSunday(isSunday(date));
    
                cell.setTag(item);
    
                /*
                Change to logic disable from first day to current day
                - Return true if current month not equal to specified Month
                - Return true if current month equal to specified Month && i > current day of current Month
                - Otherwise return false
                 */
                boolean isDiffMonth = mCalCurrentMonth.get(Calendar.MONTH) != getSpecifiedMonth();
                boolean isSameMonth = mCalCurrentMonth.get(Calendar.MONTH) == getSpecifiedMonth();
                boolean isSameYear = mCalCurrentMonth.get(Calendar.YEAR) == getSpecifiedYear();
                cell.setEnabled(isSameYear
                        && (isDiffMonth || (isSameMonth && i > currentDay)));
                cell.setVisibility(View.VISIBLE);
    
                (mOnItemRender == null ? mOnItemRenderDefault : mOnItemRender).onRender(cell, (CardGridItem) cell.getTag());
                counter++;
            }
    
            /*
            DAY IN NEXT MONTH
             */
            if (mCalendarDateDisplay != null)	cal = (Calendar) mCalendarDateDisplay.clone();
            else	cal = Calendar.getInstance();
    
            Calendar mCalNextMonth = (Calendar)cal.clone();
    
            cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
    
            daySpacing = getDaySpacingEnd(cal.get(Calendar.DAY_OF_WEEK));
    
            if (daySpacing > 0) {
    
                mCalNextMonth.add(Calendar.MONTH, 1);
                mCalNextMonth.set(Calendar.DAY_OF_MONTH, 1);
    
                for(int i=0; i<daySpacing; i++) {
                    CheckableLayout cell = cells.get(counter);
    
                    cell.setTag(new CardGridItem(i + 1, mCalNextMonth.get(Calendar.MONTH), mCalNextMonth.get(Calendar.YEAR))
                            .setEnabled(true)
                            .setDiffMonth(true)
                            .setSaturday(isSaturday(mCalNextMonth))
                            .setSunday(isSunday(mCalNextMonth))
                            .setTransferToSpecifiedMonth(true));
                    cell.setEnabled(true);
                    cell.setVisibility(View.VISIBLE);
    
                    (mOnItemRender == null ? mOnItemRenderDefault : mOnItemRender).onRender(cell, (CardGridItem)cell.getTag());
    
                    counter++;
                    mCalNextMonth.add(Calendar.DAY_OF_MONTH, 1);
                }
            }
    
            if (counter < cells.size()) {
                for(int i=counter; i<cells.size(); i++) {
                    cells.get(i).setVisibility(View.GONE);
                }
            }
        }`
    
    Therefore I post this enhancement,
    Please help me detail how to do this?
    
    Thank you,
    enhancement 
    opened by huytower 1
  • Problem with pager version

    Problem with pager version

    On load the cells are rectangle in the first two pages, go to page 3 and they are square, go back to page 1 and the these cells are now square, is there a way of keeping the cells square at all times

    opened by stoddayy 1
Releases(v1.0)
Owner
Michał Szwarc
I work in @Replaio
Michał Szwarc
Kalendar - A calendar to integrate Calendar with Custom design in your jetpack compose project

Kalendar - An Elementary Compose Calendar. This is a calendar to integrate Calen

Himanshu Singh 494 Jan 2, 2023
An android library which provides a compact calendar view much like the one used in google calenders.

CompactCalendarView CompactCalendarView is a simple calendar view which provides scrolling between months. It's based on Java's Date and Calendar clas

SundeepK 1.5k Dec 9, 2022
A TimelineView that will help you create event timelines in apps just like the Google Calendar DayView

TimelineView A TimelineView that will help you create event timelines in apps just like the Google Calendar DayView A library that allows you to creat

Amit Krishna A 10 May 12, 2022
Standalone Android widget for picking a single date from a calendar view.

TimesSquare for Android Standalone Android widget for picking a single date from a calendar view. Usage Include CalendarPickerView in your layout XML.

Square 4.4k Dec 20, 2022
A lightweight monthly calendar view for Android, fully written in Kotlin. Designed to meet the minimum demands for typical calendars.

Light Calendar View A lightweight monthly calendar view for Android, fully written in Kotlin. Designed to meet the minimum demands for typical calenda

Recruit Marketing Partners Co.,Ltd 444 Dec 9, 2022
Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.

Android Week View Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling. Fea

Raquib-ul Alam (Kanak) 3.4k Jan 3, 2023
A better calendar for Android

Caldroid Caldroid is a fragment that display calendar with dates in a month. Caldroid can be used as embedded fragment, or as dialog fragment. User ca

Roomorama 1.4k Jan 5, 2023
CalEF (Calendar Entry Formatter) : Select an entry in Android-Kalender and send/share the entry's content as human readable text.

CalEF (Calendar Entry Formatter) Select an entry in Android-Kalender and send/share the entry's content as human readable text. Usually calendar entri

k3b 6 Aug 17, 2022
Fully customizable Calendar/DatePicker for Android/Kotlin

AMCalendar - Android Date (Range) Picker AMCalendar is a fully customisable widget for picking dates and ranges based on the native Calendar. It's an

null 6 Oct 18, 2022
📅 Material Design Calendar compatible with API 11+

> Prettier and simpler Material Design CalendarView MaterialCalendarView is a prettier and simpler, material design calendar that allows full customiz

BlackBox Vision 365 Nov 21, 2022