Skip to content

Commit

Permalink
Update License
Browse files Browse the repository at this point in the history
Modify README
Minor changes
  • Loading branch information
jonatansalas committed Jan 17, 2017
1 parent 2a2cac3 commit c17dbf2
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 178 deletions.
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016 BlackBox Vision

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.
116 changes: 14 additions & 102 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,16 @@

#Material Calendar View ![Build Status](https://travis-ci.org/BlackBoxVision/material-calendar-view.svg?branch=master) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Material%20Calendar%20View-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/2715) [![Join the chat at https://gitter.im/jonisaa/material-calendar-view](https://badges.gitter.im/jonisaa/material-calendar-view.svg)](https://gitter.im/jonisaa/material-calendar-view?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Material Calendar View is a Library based on the GitHub project: [Custom Calendar View](https://github.com/npanigrahy/Custom-Calendar-View)

I found [Custom Calendar View](https://github.com/npanigrahy/Custom-Calendar-View) as a really interesting project. But when I started using Custom Calendar View I’ve found that it needed some modifications in order to work as I expected.

So I decided to get involved onto Custom Calendar View to get the modifications I
needed. *(Thanks to [Npanigrahy](https://github.com/npanigrahy))*

Nowadays my project supports this features:
> - Compatibility with Android API 8+
> - Swipe gesture-based navigation
> - 'Next' and 'Previous' month-based navigation
> - Full customization of calendar from XML file, or setters.
> - User-allowed to handle events when changes month and day selection
using two listeners.
> - Show/hide next/previous month overflow days.
> - User-allowed modify Typeface of the Calendar View by using setTypeface()
method.
> - Unlimited customizations for Day of the Month using custom Decorators.
> - Add Roboto Fonts files and a Util class to make this fonts accessible. *(This probably increase library size)*
----------
Features in Process
-------------
In order to make the Calendar more customizable and Interactive, the next is
a list of some features that I want to add:
> - Provide two CalendarViews, one build in Java Calendar API, and the other in JODA Time API
> - Synchonize Events with Google Calendar ContentProvider
> - Add Ripple Effects when the user touches a day.
> - Add two layouts for CalendarView: first one that supports only Swipe navigation without buttons; the second one will support Swipe, and back/next button navigation (actually the default view).
----------
6th November 2015
-------------
Announcing the draft of a new release v1.2.2.The changes applied are the next:
>- BugFix of ![issue1](https://github.com/jonisaa/MaterialCalendarView/issues/1), now CalendarView should not break activity when displaying for Chinese Locale. Speccially thanks to @maddie who solve submiting a pull request
----------
4th November 2015
-------------
Announcing the draft of a new release v1.2.1. The changes applied are the next:
>- Deleted unused resources to reduce library file size.
>- Added RobotoFonts to the Assets folder.
>- Added a String file handling all path to RobotoFonts.
>- Added a Util class to get the Roboto typefaces called TypefaceUtil.
>- Better performance on Swipe by making some adjustments.
>- Added setBackButtonColor method, it allows you to change back arrow color.
>- Added setNextButtonColor method, it allows you to change next arrow color
>- Added setBackButtonDrawable method, it allows you to change back button drawable.
>- Added setNextButtonDrawable method, it allows you to change next button drawable.
>- Modified the month title show format from "MONTH_NAME" to "MONTH_NAME + ' ' + YEAR"
>- BugFix: Retain current day style even if you swipe to another month and come back to actual month.
>- Added method findViewByDate(), it receives a Date as param and returns a DayView object (Custom TextView). It lets you style dayView as you want.
>- Refactor of some methods in order to clarify code readability.
>- markCurrentDay is now renamed to setCurrentDay().
>- markCurrentDateAsSelected is now renamed to setDateAsSelected().
MaterialCalendarView is a prettier and simpler, material design calendar that allows full customization and it's backwards compatible with API 11+.

----------
Screenshots
-------------
<img src="https://raw.githubusercontent.com/SAMSistemas/MaterialCalendarView/master/screenshots/calendars.png" height="425" width="100%">

----------
Screencast
-------------
<img src="https://i.imgur.com/ViolZD2.gif" height="550" width="100%" style="align: center;">

----------
Adding to your Project
-------------
Nowadays the library current stable version is 1.2.2.
##Installation

### For Gradle:
**Step 1:** you must add the JitPack repository to your build file. Type the
Expand Down Expand Up @@ -118,12 +58,11 @@ resolvers += "jitpack" at "https://jitpack.io"
```java
libraryDependencies += "com.github.BlackBoxVision" % "material-calendar-view" % "v1.2.3"
```
----------
Using Material Calendar View library
-------------
This project includes a Sample App that shows you the true power of this library. If you want to know more, feel free to clone, deploy and play with it. Else I’ll give you a little code snippets.

##Usage example

Pay attention to the following:

```xml
<io.blackbox_vision.calendarview.widget.CalendarView
android:id="@+id/calendar_view"
Expand All @@ -132,7 +71,9 @@ Pay attention to the following:
android:background="@color/colorPrimary">
</io.blackbox_vision.calendarview.widget.CalendarView>
```

The above code snippet will show the simple Calendar View on the default layout. Now, you can use the following attributes if you want to customize the appearance of calendar:

```xml
<io.blackbox_vision.calendarview.widget.CalendarView
android:id="@+id/calendar_view"
Expand Down Expand Up @@ -190,45 +131,16 @@ final DayView dayView = calendarView.findViewByDate(new Date(System.currentTimeM
if(null != dayView)
Toast.makeText(getApplicationContext(), "Today is: " + dayView.getText().toString() + "/" + calendarView.getCurrentMonth() + "/" + calendarView.getCurrentYear(), Toast.LENGTH_SHORT).show();
```
----------
Known issues
-------------

I’ve made a lot of testand I’ve found no issues. This library I’ve built againts travis and run the sample app in the supported API emulators. But maybe you can find an Issue that i can't detect or whatever.
##Issues

If you do so, please, let me know. I will be happy to solve it in order to help you.
If you found a bug, or you have an answer, or whatever. Please, open an [issue](https://github.com/BlackBoxVision/material-calendar-view/issues). I will do the best to fix it, or help you.

----------
Specially Thanks
-------------
Thanks to Mai Arrojo, who colaborate by my side to make English README file more understandable. We are working actually in the library code documentantion. She is good with translations. If you want to contact her for a job opportunity mail her to: [email protected]
##Contributing

----------
Contact Me
-------------
If you like this library, and want me to add some features in order to make it better just mail me to [email protected] or [email protected]. I’ll make it count.
Of course, if you see something that you want to upgrade from this library, or a bug that needs to be solved, **PRs are welcome!**

----------
License
-------------
This library is distributed under **Apache License 2**, feel free to do any modification.
##License

Distributed under the **MIT license**. See [LICENSE](https://github.com/BlackBoxVision/material-calendar-view/blob/master/LICENSE) for more information.

```
/*
* Copyright (C) 2015 ImanoWeb {link: http://imanoweb.com}.
* Copyright (C) 2015 SAMSistemas {link: http://www.samsistemas.com.ar}
* Copyright (C) 2015 Jonisaa {link: http://the-android-developer.blogspot.com.ar}.
*
* 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.
*/
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@

import io.blackbox_vision.materialcalendarview.view.DayView;

/**
* @author jonatan.salas
*/

public interface DayDecorator {

/**
*
* @param cell
*/
void decorate(@NonNull DayView cell);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,22 @@
import java.util.Calendar;
import java.util.Locale;

/**
* @author jonatan.salas
*/
public class CalendarUtils {

/**
*
* @param c1
* @param c2
* @return
*/

public final class CalendarUtils {

private CalendarUtils() { }

public static boolean isSameMonth(Calendar c1, Calendar c2) {
return !(c1 == null || c2 == null) &&
(c1.get(Calendar.ERA) == c2.get(Calendar.ERA) &&
(c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) &&
(c1.get(Calendar.MONTH) == c2.get(Calendar.MONTH)));
}

/**
*
* @param calendar
* @return
*/
public static boolean isToday(Calendar calendar) {
return isSameDay(calendar, Calendar.getInstance());
}

/**
*
* @param cal1
* @param cal2
* @return
*/
public static boolean isSameDay(Calendar cal1, Calendar cal2) {
if (cal1 == null || cal2 == null)
throw new IllegalArgumentException("The dates must not be null");
Expand All @@ -47,25 +30,13 @@ public static boolean isSameDay(Calendar cal1, Calendar cal2) {
(cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR)));
}

/**
*
* @param context
* @param firstDayOfWeek
* @return
*/
public static Calendar getTodayCalendar(Context context, int firstDayOfWeek) {
Calendar currentCalendar = Calendar.getInstance(context.getResources().getConfiguration().locale);
currentCalendar.setFirstDayOfWeek(firstDayOfWeek);

return currentCalendar;
}

/**
*
* @param currentCalendar
* @param firstDayOfWeek
* @return
*/
public static int getMonthOffset(Calendar currentCalendar, int firstDayOfWeek) {
final Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(firstDayOfWeek);
Expand All @@ -86,12 +57,6 @@ public static int getMonthOffset(Calendar currentCalendar, int firstDayOfWeek) {
}
}

/**
*
* @param weekIndex
* @param calendar
* @return
*/
public static int getWeekIndex(int weekIndex, Calendar calendar) {
int firstDayWeekPosition = calendar.getFirstDayOfWeek();
if (firstDayWeekPosition == 1) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
* Copyright (C) 2015 Jonatan Ezequiel Salas
*
* 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.
*/
package io.blackbox_vision.materialcalendarview.view;


Expand Down Expand Up @@ -57,6 +42,7 @@
import io.blackbox_vision.materialcalendarview.decor.DayDecorator;
import io.blackbox_vision.materialcalendarview.utils.CalendarUtils;


/***
* Custom CalendarView class.
*
Expand Down Expand Up @@ -498,11 +484,12 @@ private void setDaysInCalendar() {

DayView dayView;
ViewGroup dayOfMonthContainer;

for (int i = 1; i < 43; i++) {
dayOfMonthContainer = (ViewGroup) view.findViewWithTag(getContext().getString(R.string.day_of_month_container) + i);
dayView = (DayView) view.findViewWithTag(getContext().getString(R.string.day_of_month_text) + i);
if (dayView == null)
continue;

if (dayView == null) continue;

//Apply the default styles
dayOfMonthContainer.setOnClickListener(null);
Expand All @@ -528,19 +515,21 @@ private void setDaysInCalendar() {
}
}

if(isCommonDay) {
if (isCommonDay) {
dayView.setTextColor(dayOfWeekTextColor);
}

} else {
dayView.setBackgroundColor(disabledDayBackgroundColor);
dayView.setTextColor(disabledDayTextColor);

if (!isOverflowDateVisible())
if (!isOverflowDateVisible()) {
dayView.setVisibility(View.GONE);
else if (i >= 36 && ((float) monthEndIndex / 7.0f) >= 1) {
} else if (i >= 36 && ((float) monthEndIndex / 7.0f) >= 1) {
dayView.setVisibility(View.GONE);
}
}

dayView.decorate();

//Set the current day color
Expand All @@ -554,6 +543,7 @@ else if (i >= 36 && ((float) monthEndIndex / 7.0f) >= 1) {
// If the last week row has no visible days, hide it or show it in case
ViewGroup weekRow = (ViewGroup) view.findViewWithTag("weekRow6");
dayView = (DayView) view.findViewWithTag("dayOfMonthText36");

if (dayView.getVisibility() != VISIBLE) {
weekRow.setVisibility(GONE);
} else {
Expand All @@ -570,6 +560,7 @@ private void clearDayOfTheMonthStyle(Date currentDate) {
final DayView dayView = findViewByCalendar(calendar);
dayView.setBackgroundColor(calendarBackgroundColor);
isCommonDay = true;

if(totalDayOfWeekend().length != 0) {
for (int weekend : totalDayOfWeekend()) {
if (calendar.get(Calendar.DAY_OF_WEEK) == weekend) {
Expand Down Expand Up @@ -763,6 +754,7 @@ private void setScrollState(int newState) {

private void requestParentDisallowInterceptTouchEvent(boolean disallowIntercept) {
final ViewParent parent = getParent();

if (parent != null) {
parent.requestDisallowInterceptTouchEvent(disallowIntercept);
}
Expand Down Expand Up @@ -1050,7 +1042,6 @@ public interface OnDateLongClickListener {
void onDateLongClick(@NonNull Date selectedDate);
}


/**
* Interface that define a method to implement to handle
* a month changed event.
Expand Down
Loading

0 comments on commit c17dbf2

Please sign in to comment.