- Android Essentials: Adding Events to the User’s Calendar
- Step 0: Getting Started
- Step 1: Create the Calendar Intent
- Step 2: Seeding Calendar Details
- Step 3: Seeding Calendar Dates and Times
- Step 4: Event Configuration Details
- Step 5: Configuring Recurring Events
- Conclusion
- Android Custom Calendar with events
- marcohc/roboto-calendar-view
- roboto-calendar-view — Deprecated — Use this amazing calendar instead…
- Roboto Calendar View
- Sample
- Compatibility
- Usage
- Gradle
- SimpleMobileTools/Simple-Calendar
- Simple-Calendar — A simple calendar with events, customizable widget and no ads.
- Simple Calendar
- Applandeo/Material-Calendar-View
- Material-Calendar-View — Material Calendar View for Android
- Material-Calendar-View
- Features
- How to migrate from previous version to 1.4.0?
- How to use?
- Adding events with icons:
- Clicks handling:
- Getting a selected days in the picker mode:
- Setting a current date:
- Setting minumum and maximum dates:
- Setting disabled dates:
- Previous and forward page change listeners:
- Customization
- Colors customization:
- Translations:
- Date Picker Dialog
- Getting date handling:
- Customization:
- Changelog
- Version 1.4.0:
- prolificinteractive/material-calendarview
- material-calendarview — A Material design back port of Android’s CalendarView
- Material Calendar View
- Installation
- Usage
- Documentation
- Customization
- Events, Highlighting, Custom Selectors, and More!
- Recent Changes
- Major Change in 1.5.0
- Major Change in 1.4.0
- Riontech/CustomCalendar
- CustomCalendar — Custom Calendar with Decorator and Detail view
- Custom Android Calendar
- #Usage
- TODOs
- MOLO17/CustomizableCalendar
- CustomizableCalendar is a library that allows you to create your calendar, customizing UI and behaviour
- CustomizableCalendar
- Features
- Limitations
- Gradle
- Dependencies
- How to customize
- HeaderView
- WeekDaysView
- SubView
- CalendarRecyclerView
Android Essentials: Adding Events to the User’s Calendar
The latest version of the Android SDK, code-named Ice Cream Sandwich, reached developers this week. For the first time, the SDK provides access to the Calendar application in a legitimate fashion. One of the most common tasks that developers often want to be able to do is create new events in the user’s calendar, so today we’ll show you how.
The Calendar is a common application that users rely upon on their Android devices. Applications can access the Calendar using the new APIs available in Android 4.0. Adding new events to the Calendar is simple and requires no special application permissions.
Note: The user is responsible for configuring the Calendar application with the appropriate Calendar accounts (e.g. Microsoft Exchange).
Step 0: Getting Started
This tutorial assumes you have a project that supports Android 4.0 (API Level 14 compatible) and that you are compiling with the latest tools. It also assumes that you’ve properly configured the Calendar application on the Android emulator (or a suitable device, when one becomes available in the coming weeks).
Step 1: Create the Calendar Intent
In order to prompt the user to create a calendar event in their existing calendar, you’ll need to create the appropriate intent. This intent will launch the Calendar application with a screen that allows them to create a new event. The user must confirm this event and can add or change any of the event data associated with the event.
The intent to create a calendar event is shown below:
This code simply launches the intent. It does not set any of the calendar data associated with the event.
Step 2: Seeding Calendar Details
You can seed the information associated with a calendar event by supplying a number of intent extras. Extras can be used to describe event details, the date and time of the event, as well as calendar event settings like whether the event can be seen by others and whether it is busy or available time. The typical calendar event settings are all available as Extras. For example, the following intent call supplies some title and description information about an event:
Here we set the title, location, and description access for the event using the appropriate intent Extras. These fields will be set in a form that displays for the user to confirm the event in their calendar.
Step 3: Seeding Calendar Dates and Times
Calendar events are associated with specific dates and times. Some events have a specific time window and others are “all day” events. You can specify the date and time of an event using extras as well.
Here we set the event to be an all day event on a specific date. You can also set much more fine-grained events by simply using the two extras for the beginning and ending time.
Step 4: Event Configuration Details
There are several other intent extras you can seed as well. These include whether or not others can see the event (access level) and whether or not the time should be shown as busy or available (availability)
You could set these extras as follows:
Here we include an extra setting to set the access of this event in the calendar to private. We set the availability during the event’s time period to busy (no other events can overlap).
Step 5: Configuring Recurring Events
There are one-time events, like our pig roast, and then there are recurring events, like by-weekly meetings. You can seed the recurrence rule using an intent extra, like this:
The RRULE intent extra takes a standard iCalendar recurrence rule format (see RFC 5544 for details). For example, the one above creates a recurrence rule for an event that occurs every Tuesday and Thursday for 5 weeks.
Conclusion
The Calendar application has been available on the Android platform for a long time, but there have been no documented APIs for accessing it: until now. Android 4.0 (API Level 14) includes a full Calendar content provider which can be used to access the user’s calendar information, provided the application has the appropriate permissions. However, one of the simplest and most common tasks, adding a new event to a user’s calendar, requires no special permissions and is very easy to implement.
Источник
Android Custom Calendar with events
Jun 4, 2018 · 12 min read
Some links for android cutom calendarviews
marcohc/roboto-calendar-view
roboto-calendar-view — Deprecated — Use this amazing calendar instead…
Roboto Calendar View
Android Roboto Calendar View provides an easy and customizable calendar view using the awesome library Calligraphy for fonts
Sample
A sample application is available inside of the library
Compatibility
This library is compatible from API 14.
Usage
Take a look of the sample Activity.
You can override any style and customize your calendar.
Gradle
This library uses the awesome tool
Add the repository to your general build.gradle:
And then add the library in your specific project build.gradle:
SimpleMobileTools/Simple-Calendar
Simple-Calendar — A simple calendar with events, customizable widget and no ads.
Simple Calendar
A simple calendar with events and a customizable widget.
An of f line calendar without any other calendar integration. You can easily create recurring events and setup reminders, it can also display week numbers.
Contains a resizable 4×4 widget where you can customize the color of the text, as well as the alpha and the color of the background.
Contains no ads or unnecessary permissions. It is fully open-source, provides customizable colors.
The Storage permission is needed only for exporting or importing events from .ics files.
The Contacts permission is used only at importing contact birthdays and anniversaries.
This app is just one piece of a bigger series of apps. You can find the rest of them at http://www.simplemobiletools.com
Applandeo/Material-Calendar-View
Material-Calendar-View — Material Calendar View for Android
Material-Calendar-View
Material-Calendar-View is a simple and customizable calendar widget for Android based on Material Design. The widget has two funcionalities: a date picker to select dates (available as an XML widget and a dialog) and a classic calendar. The date picker can work either as a single day picker, many days picker or range picker.
We described a simple usage of the component in this article.
Features
- Material Design
- Single date picker
- Many dates picker
- Range picker
- Events icons
- Fully colors customization
How to migrate from previous version to 1.4.0?
We have renamed setOnPreviousButtonClickListener() and setOnForwardButtonClickListener() so please refer to Previous and forward buttons listeners.
How to use?
Make sure you are using the newest com.android.support:appcompat-v7.
Make sure you have defined the jcenter() repository in project’s build.gradle file:
Add the dependency to module’s build.gradle file:
To your XML layout file add:
Adding events with icons:
Clicks handling:
Getting a selected days in the picker mode:
If you want to get all selected days, especially if you use multi date or range picker you should use the following code:
…or if you want to get the first selected day, for example in case of using single date picker, you can use:
Setting a current date:
Setting minumum and maximum dates:
Setting disabled dates:
Previous and forward page change listeners:
Customization
If you want to use calendar in the picker mode, you have to use the following tags:
- app:type=»one_day_picker»
- app:type=»many_days_picker»
- app:type=»range_picker»
Colors customization:
- Header color: app:headerColor=»[color]»
- Header label color: app:headerLabelColor=»[color]»
- Previous button image resource: app:previousButtonSrc=»[drawable]»
- Forward button image resource: app:forwardButtonSrc=»[drawable]»
- Abbreviations bar color: app:abbreviationsBarColor=»[color]»
- Abbreviations labels color: app:abbreviationsLabelsColor=»[color]»
- Calendar pages color: app:pagesColor=»[color]»
- Selection color in picker mode: app:selectionColor=»[color]»
- Selection label color in picker mode: app:selectionLabelColor=»[color]»
- Days labels color: app:daysLabelsColor=»[color]»
- Color of visible days labels from previous and next month page: app:anotherMonthsDaysLabelsColor=»[color]»
- Disabled days labels color: app:disabledDaysLabelsColor=»[color]»
- Today label color: app:todayLabelColor=»[color]»
Translations:
To translate months names, abbreviations of days, “TODAY”, “OK” and “CANCEL” buttons, just add below tags to your strings.xml file:
Date Picker Dialog
To use another picker type replace CalendarView.ONE_DAY_PICKER with CalendarView.MANY_DAYS_PICKER or CalendarView.RANGE_PICKER .
Getting date handling:
Customization:
Changelog
Version 1.4.0:
- More color customization (abbreviations, calendar pages, labels colors)
- Changed onNavigationButtonClickListeners to onCalendarPageChangeListeners
- Added page change listeners to dialog pickers
- Added onDayClickListener to pickers (not dialog pickers)
- Added ability to insert list of disabled days
prolificinteractive/material-calendarview
material-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 with the platform’s implementation.
Installation
Step 1. Add the JitPack repository to your build file
Step 2. Add the dependency
Usage
- Add MaterialCalendarView into your layouts or view hierarchy.
- Set a OnDateSelectedListener or call MaterialCalendarView.getSelectedDates() when you need it.
Documentation
Make sure to check all the documentation available here.
Customization
One of the aims of this library is to be customizable. The many options include:
Events, Highlighting, Custom Selectors, and More!
All of this and more can be done via the decorator api. Please check out the decorator documentation.
Recent Changes
Major Change in 1.5.0
We recently updated to the latest gradle and decided to move over our libraries to the hosting service Jitpack. Please refer to the installation section for more details.
Major Change in 1.4.0
- Breaking Change: setFirstDayOfWeek , setMin/MaxDate , and setCalendarDisplayMode are moved to a State object. This was necessary because it was unclear that these were not simple setters—individually, they were side effecting and triggered full adapter/date range recalculations. Typical usage of the view involves setting all these invariants up front during onCreate and it was unknown to the user that setting all 4 of these would create a lot of waste. Not to mention certain things were side effecting—some would reset the current day or selected date. As a result, the same 4 methods called in a different order could result in a different state, which is bad.
- For most cases you will simply need to replace setting those invariants with:
- mcv.state().edit() .setFirstDayOfWeek(Calendar.WEDNESDAY) .setMinimumDate(CalendarDay.from(2016, 4, 3)) .setMaximumDate(CalendarDay.from(2016, 5, 12)) .setCalendarDisplayMode(CalendarMode.WEEKS) .commit();
- mcv.state().edit() will retain previously set values; mcv.newState() will create a new state using default values. Calling commit will trigger the rebuild of adapters and date ranges. It is recommended these state changes occur as the first modification to MCV (before configuring anything else like current date or selected date); we make no guarantee those modifications will be retained when the state is modified.
- See CUSTOMIZATION_BUILDER for usage details.
- New: setSelectionMode(SELECTION_MODE_RANGE) was added to allow 2 dates to be selected and have the entire range of dates selected. Much thanks to papageorgiouk for his work on this feature.
Riontech/CustomCalendar
CustomCalendar — Custom Calendar with Decorator and Detail view
Custom Android Calendar
#Usage
Add the dependency to your build.gradle.
Add the indicator to your layout.
Create object of CustomCalendar in your activity
In your acitivty onCreate initialize the object and set eventDate with count. And add it to customCalendar object by using addAnEvent method.
TODOs
- Add Event with Plus button
- Adding Reminders for Event, Birthday, etc
- Awesome UI-UX
MOLO17/CustomizableCalendar
CustomizableCalendar is a library that allows you to create your calendar, customizing UI and behaviour
CustomizableCalendar
This library allows you to create a completely customizable calendar.
You can use CustomizableCalendar to create your calendar, customizing UI and behaviour.
Features
- Custom header (should be implemented by the user);
- Custom sub view (month name by default);
- Custom weekly days view;
- Custom date view;
- Possibility to implement selection on day click;
- Possibility to implement weekly day calculation;
- Receive updates of Calendar (with AUCalendar);
- Every change to AUCalendar is notified and automatically refreshes UI;
Limitations
- Only portrait orientation is supported
Gradle
Dependencies
- RecyclerView
- Joda-Time
- RxJava2
- ButterKnife used on version ViewInteractor interface (you can find the explanation in the How to customize > Java section).
After that go in the Activity/Fragment where you added the CustomizableCalendar View; here you should specify the first month and the last month, to do this, create a Calendar (located in com.molo17.customizablecalendar.library.model ) object.
An example of CustomizableCalendar init is the following:
How to customize
If you want to customize the components you should create a separeted layout and add the reference to the customizable_calendar View with the tag app:layout=»@layout/your_layout»
An example of a custom layout is the following:
NOTE that ids must not be different from the ones above, so:
- @android:id/primary for HeaderView;
- @android:id/text1 for WeekDaysView;
- @android:id/text2 for SubView;
- @android:id/content for CalendarRecyclerView;
HeaderView
First (red) rectangle of the screenshot above.
It’s a RelativeLayout , you should create your own layout.
WeekDaysView
Third (light blue) rectangle of the screenshot above.
It’s a RecyclerView , the ViewHolder item is already implemented.
You can create your own ViewHolder layout using a RelativeLayout with a TextView that has @android:id/summary as id.
SubView
Second (green) rectangle of the screenshot above.
It’s a RelativeLayout , implemented by default with the name of the month centered.
If you want to create your own layout make sure to have a TextView with id @android:id/summary .
CalendarRecyclerView
Fourth (blue) rectangle of the screenshot above.
It’s a RelativeLayout , implemented by default with a LinearLayout (with a GridLayout inside) for the month and a RelativeLayout for the day.
If you want to create your own month layout you can specify app:month_layout=»@layout/your_layout» for the month and app:cell_layout=»@layout/your_layout» for the day.
Make sure to use @android:id/widget_frame as id for the GridView and @android:id/background , @android:id/startSelectingText , @android:id/stopSelectingText , @android:id/title respectively for single selection background, first day selection background (in multiple selection mode), last day selection background (in multiple selection mode) and the TextView where the day is displayed.
All code customization can be applied using the ViewInteractor .
Here are listed all of the methods with a small description:
Источник