Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/obilet/cosmocalendar
Calendar component for Android application.
https://github.com/obilet/cosmocalendar
Last synced: 24 days ago
JSON representation
Calendar component for Android application.
- Host: GitHub
- URL: https://github.com/obilet/cosmocalendar
- Owner: oBilet
- License: mit
- Created: 2021-09-01T11:45:58.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-25T07:09:37.000Z (30 days ago)
- Last Synced: 2024-11-25T08:19:41.262Z (30 days ago)
- Language: Java
- Size: 1.9 MB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CosmoCalendar
[![GitHub license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/AppliKeySolutions/CosmoCalendar/blob/master/LICENSE)Made by [Applikey Solutions](https://applikeysolutions.com) and updated by Mustafa Bayram & Serhat Öztürk.
![](pictures/cosmo-calendar.png)
* [Usage](#usage)
* [Customization](#customization)
* [Common](#common)
* [Selection](#selection)
* [Current day](#current-day)
* [Navigation buttons](#navigation-buttons)
* [Weekend days](#weekend-days)
* [Connected days](#connected-days)
* [Holidays pins](#holidays-pins)
* [Holidays for month view](#holidays-for-month-view)
* [Custom date color determinators](#custom-date-color-determinators)
* [Disabled days](#disabled-days)
* [Month change listener](#month-change-listener)
* [Calendar dialog](#calendar-dialog)
* [Demo](#demo)
* [Release Notes](#release-notes)
* [Contact Us](#contact-us)
* [License](#license)# Usage
```xml
implementation 'com.github.oBilet:CosmoCalendar:2.0'
```# Customization
### Common
* calendarOrientation - Possible values: HORIZONTAL, VERTICAL
* calendarBackgroundColor
* monthTextColor
* otherDayTextColor
* dayTextColor
* firstDayOfTheWeek
* weekDayTitleTextColo
* showDaysOfWeek - Defines if we need to display week day titles for every month
* showDaysOfWeekTitle - Defines if we need to display week day title for whole calendar
### Selection
* selectionType - Possible values: SINGLE, MULTIPLE, RANGE, NONE
* selectedDayTextColor
* selectedDayBackgroundColor
* selectedDayBackgroundStartColor - Background color of START day from selected range
* selectedDayBackgroundEndColor - Background color of END day from selected range
* selectionBarMonthTextColor
### Current day
* currentDayTextColor
* currentDayIconRes
* currentDaySelectedIconRes
### Navigation buttons
* previousMonthIconRes
* nextMonthIconRes
### Weekend days
* weekendDays
```java
calendarView.setWeekendDays(new HashSet(){{
add(Calendar.THURSDAY);
add(Calendar.TUESDAY);
}});
```
* weekendDayTextColor
### Connected days
(Performance problems occur on multiple holidays. Instead, it is recommended to use the setHolidaysPins function, which is in version 2.0.)
You can add some days for example holidays:
```java
//Set days you want to connect
Calendar calendar = Calendar.getInstance();
Set days = new TreeSet<>();
days.add(calendar.getTimeInMillis());
...
//Define colors
int textColor = Color.parseColor("#ff0000");
int selectedTextColor = Color.parseColor("#ff4000");
int disabledTextColor = Color.parseColor("#ff8000");
ConnectedDays connectedDays = new ConnectedDays(days, textColor, selectedTextColor, disabledTextColor);//Connect days to calendar
calendarView.addConnectedDays(connectedDays);
```
and customize them:
* connectedDayIconRes;
* connectedDaySelectedIconRes;
* connectedDayIconPosition (TOP/BOTTOM);
```java
calendarView.setConnectedDayIconPosition(ConnectedDayIconPosition.TOP);
```### Holidays pins
You can add some days for example holidays:```java
//Set days you want to connectviewBinding.datePickerCalendarView.setConnectedDayIconPosition(ConnectedDayIconPosition.TOP_RIGHT);
viewBinding.datePickerCalendarView.setConnectedDayIconRes(R.drawable.blue_circle_holiday);HashMap holidaysPins
holidaysPins.put("2024-11-11","2024-11-11") // yyyy-mm-dd
datePickerCalendarView.setHolidaysPins(holidaysPins)
```
![](pictures/addholidayspins.png)### Holidays for month view
You can add some days for example holidays:```java
//Set days you want to connectHashMap> holidaysMap
holidaysMap.put("2024-01", listOf("1 Ocak - Yılbaşı")) //yyyy-mm (all holidays that belongs to the selected month)
holidaysMap.put("2024-03", listOf("29 Mart - Ramazan bayramı arefesi", "30-31 Mart Ramazan bayramı"))
datePickerCalendarView.setHolidays(sholidaysMap);
```
![](pictures/addholidayspins.png)### Custom date color determinators
It allows the background of any day to be set in the desired color. Since this background disappears when the selection is made, prices can be specified on any day.
```java
//Set days you want to desireprivate Map calendarPriceInfoItems = new HashMap<>(); //yyyy-mm-dd , ContextCompat.getColor(context, R.color.pale_red) selected color resource id
holidaysMap.put("2024-01-02", ContextCompat.getColor(context, R.color.pale_green))
holidaysMap.put("2024-01-03", ContextCompat.getColor(context, R.color.pale_green))datePickerCalendarView.setDeterminators(calendarPriceInfoItems);
```
![](pictures/determinators.png)
### Disabled days
You can add days so that you can not select them:
```java
Set disabledDaysSet = new HashSet<>();
disabledDaysSet.add(System.currentTimeMillis());
calendarView.setDisabledDays(disabledDaysSet);
```
#### Disabled days criteria
- month criteria range:
```java
//from 1st to 5th day of the month
calendarView.setDisabledDaysCriteria(new DisabledDaysCriteria(1, 5, DisabledDaysCriteriaType.DAYS_OF_MONTH));
```
- week criteria range:
```java
//from Monday to Friday
DisabledDaysCriteria criteria = new DisabledDaysCriteria(Calendar.MONDAY, Calendar.FRIDAY, DisabledDaysCriteriaType.DAYS_OF_WEEK);
calendarView.setDisabledDaysCriteria(criteria);
```
* disabledDayTextColor - Text color of disabled day
### Month change listener
```java
calendarView.setOnMonthChangeListener(new OnMonthChangeListener() {
@Override
public void onMonthChanged(Month month) {
}
});
```### Calendar dialog
```java
new CalendarDialog(this, new OnDaysSelectionListener() {
@Override
public void onDaysSelected(List selectedDays) {
}
}).show();
```
# Demo
Single Choice | Multiple
:-------------------------:|:-------------------------:
![](pictures/Calendar-single_2.jpg) | ![](pictures/Calendar-multiple-years_2.jpg)
Range | Customized
![](pictures/Calendar-range-years_2.jpg) | ![](pictures/Calendar-dialogue-dark_2.jpg)# Release Notes
### 1.0.0
- Release version.### 1.0.1
- Functionality optimization
- Added disabled days criteria feature
- Added more customization for connected days (selected/unselected icon, top/bottom position for icon)### 1.0.2
- Added "NONE" selection type
- The functionality of creating months is optimized
- Added OnMonthChangeListener### 1.0.3
- Fixed crash on swipe
- Connected days logic changed. Now you can add multiple connected day lists!### 1.0.4
- Fixed small bugs### 2.0
- Holidays pins, Determinators improvements done
- Performance improvements# Contact Us
You can always contact us via [email protected] We are open for any inquiries regarding our libraries and controls, new open-source projects and other ways of contributing to the community. If you have used our component in your project we would be extremely happy if you write us your feedback and let us know about it!
# License
MIT License
Copyright (c) 2017 Applikey Solutions
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.