From ac3c85060b2ade29cf0fe7a3bfd9b5e48a91ecee Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 29 Apr 2019 17:45:08 +0300 Subject: [PATCH] prepare to publish --- LICENSE | 201 ++++++++++++++++++ README.md | 24 +++ app/src/main/AndroidManifest.xml | 14 +- .../kakadu/calendar/example/MainActivity.java | 20 +- .../drawable-v24/ic_launcher_foreground.xml | 13 ++ app/src/main/res/layout/activity_main.xml | 14 +- .../res/mipmap-anydpi-v26/ic_launcher.xml | 14 +- app/src/main/res/values/colors.xml | 14 +- app/src/main/res/values/strings.xml | 13 ++ app/src/main/res/values/styles.xml | 13 ++ assets/screen.webp | Bin 0 -> 6642 bytes build.gradle | 4 +- calendarpro/build.gradle | 9 +- calendarpro/publish.gradle | 26 +++ calendarpro/src/main/AndroidManifest.xml | 16 +- .../bz/kakadu/calendar/CalendarTheme.java | 13 ++ .../bz/kakadu/calendar/CalendarViewPager.java | 13 ++ .../main/java/bz/kakadu/calendar/Cell.java | 22 +- .../src/main/java/bz/kakadu/calendar/Day.java | 49 ++++- .../java/bz/kakadu/calendar/DrawUtils.java | 13 ++ .../bz/kakadu/calendar/ICellDecoration.java | 29 +++ .../java/bz/kakadu/calendar/MonthView.java | 13 ++ .../kakadu/calendar/OnDayClickListener.java | 13 ++ .../kakadu/calendar/RangeCellDecoration.java | 29 ++- .../kakadu/calendar/SimpleCellDecoration.java | 14 ++ .../main/res/drawable/calendar_arrow_left.xml | 13 ++ .../res/drawable/calendar_arrow_right.xml | 13 ++ .../main/res/layout/calendar_pager_header.xml | 14 +- .../main/res/layout/calendar_pager_page.xml | 14 +- .../main/res/layout/calendar_view_pager.xml | 14 +- calendarpro/src/main/res/values/attrs.xml | 22 +- calendarpro/src/main/res/values/strings.xml | 3 - 32 files changed, 645 insertions(+), 51 deletions(-) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 assets/screen.webp create mode 100644 calendarpro/publish.gradle delete mode 100644 calendarpro/src/main/res/values/strings.xml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d28dce5 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# calendar-pro +[![Release](https://jitpack.io/v/kakadu-dev/calendar-pro.svg)](https://jitpack.io/#kakadu-dev/calendar-pro) +[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) + +![Files app](assets/screen.webp) + +Android calendar view with custom decoration for each cell. + +## Setup + +Add the dependency in your `build.gradle` file: + +```gradle +repositories { + maven { url "https://jitpack.io" } +} + + dependencies { + debugImplementation 'com.github.RomanTsarou:calendar-pro:1.0.1' + } +``` + + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7c960af..a5a3726 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,4 +1,16 @@ - + + diff --git a/app/src/main/java/bz/kakadu/calendar/example/MainActivity.java b/app/src/main/java/bz/kakadu/calendar/example/MainActivity.java index fed3085..5a2498a 100644 --- a/app/src/main/java/bz/kakadu/calendar/example/MainActivity.java +++ b/app/src/main/java/bz/kakadu/calendar/example/MainActivity.java @@ -1,3 +1,16 @@ +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar.example; import android.os.Bundle; @@ -5,7 +18,6 @@ import android.support.v7.app.AppCompatActivity; import android.view.View; -import bz.kakadu.calendar.CalendarTheme; import bz.kakadu.calendar.CalendarViewPager; import bz.kakadu.calendar.Day; import bz.kakadu.calendar.RangeCellDecoration; @@ -21,14 +33,10 @@ protected void onCreate(Bundle savedInstanceState) { rangeCellDecoration = new RangeCellDecoration(); Day day1 = Day.today().add(-10); Day day2 = Day.today().add(50); - rangeCellDecoration.setBoundsRange(day1, day2); -// int color = DrawUtils.getAttrColor(this, R.attr.colorPrimary); -// rangeCellDecoration.rangeEdgesColor = color; -// rangeCellDecoration.rangeColor = ColorUtils.setAlphaComponent(color, 127); + rangeCellDecoration.setRangeBounds(day1, day2); monthView.setCurrentMonth(day1, false); monthView.addDecoration(rangeCellDecoration); monthView.onDayClickListener = rangeCellDecoration; - CalendarTheme ct = new CalendarTheme(this); } public void dialog(View view) { diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml index 3f118ff..30b4fe0 100644 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -1,3 +1,16 @@ + + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 69b2233..fde1958 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,4 +1,16 @@ - + + #008577 #00574B diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0a73e0c..95f3bbb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,16 @@ + + CalendarPro diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 733c9ba..c7cac31 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,3 +1,16 @@ + + diff --git a/assets/screen.webp b/assets/screen.webp new file mode 100644 index 0000000000000000000000000000000000000000..525c4079fffeeed394a85c8eb59c0b7dc9fc9211 GIT binary patch literal 6642 zcmVv{uWxt%81 zr2ay8nzhMTLu)YwC((v=ovE=nT+@jJAO3IyQ{DOJE~k^>p;aBNK&oSm{9GS=%u+U9 z==bOeO;E-9@a#2E28AW4Y8#-1;Fc;IXQVM{G^0x+0`@3e>=$f0dj@12ILbbFEMwoG zB{L6VN8)hfj}`)H5<)zjjV20}5@jTcK^{&<(UY{RNSL3TO^5&Z1LPLjC)zTX}NIe(LMucXXaF?|hcm`SP z)hZ;yX%a#_oQ)<5l@etlWqCB(V3cZ$$Dvs^KgtOJjoSi;^ED6#@VMW`y~Kq6N*}UM z{rsQG%$!Fg9R9OZ1QbC0CUvgx}X zMXBOa)cbDa1MJsqfO`x%Nriho;Ep#31i{(T2Inryq!-!?WWMWgyZp zNxe(2@>OEft?5t1~*pfv<28%NWH1ml00|j3)}Y?+n4-QSbl4@Dlqq5uVhwb^cT_fIi|S1np48`*2vtzkwVT zP?|CC&=Q)Vi~;urjY^juoA-n*rndLvY@faO+b8dSHp%3 zeRJRdh-05GaDG_#=m||w#rtqwoH2gf7BTP80Ni4BHCIo$li#2vHA5HdilOng3df&e zU#~4M$~i*R1=GN>kA8rZ)eKnTwbLkANnrmC=B9aS^C-yvwS*s4h~RUrz4+TF?|wGP z``?YJDaG(++Zay7f%6}5CInDZ9t8SI9CU8WN90miB=!!D{Q)VdO7Y_z;Mui*f0U-z z_>Kz;0092{?t`#!$$$C&$mG4L*;S?IF%@);MnWL|h$bQzxLDI{4!=-6w%^Zew{d2C z?!z2|Ik-OZ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x@X_%;I3gc^U;!(laWBiMSO3Oqz+b(|h6Bd*Q=0V3 zODV|~aCr{u0u0YbRIvD;b_&hBJaUN5(o4Ss7(*vDL2hG-$bNzx9IU$KGSP?ooOluP zgg~P$qUqZPKMk|U0CIN_#CZGOV>4_;T3SxWVTIOX*4wr=ZxV;NhxhSt?0+<0xk0E)N5U1N^0*Fc`v-@^M{j?1bdGLAplzm{2BZY02Nh#N}&5@cc=*aNT# z8%je}RDN7?PRcUGl+%fJ)2r+L^|n(!dK$g&oL8?KH%$Qyf10$V1>jLi*FCTY>X8Ef zdvrL3f0r`ULDT*=hz+rqk~?5|Y4u~ga$U0kQEsJM3d!{%J#dBT(eoBIOypT#!Fvw= z<_kSW!T%2=R#=CY(NKdoFH*8SqZZC`gZ_5m7sk%olum; zju~S>rO5$k2Q6rAwq0tZ<8#tRPghpFprXSmxOWTUB#WxFid(|&avUeN|3)&9{O)U5CCktZ zjFFx|7#~kt%Pbo#G^yf5RIYrIj0XGDA?&45#)TPd`0YmOVC_~`2M;4$8^25ZdXQ5< z{a_7?s6X#H5L{8qH^zW=NPQ7{{yg2T6XCtdnmv9dDmtTo<${15paBmCHHw)J7CAOwYU9N454WHm7za!M z2NVa=#3PPe`bY-3iX}bcOt6m<#S~dl3R;XM>9byMfE{*`?#IfE4Y|2z9lCY;{c|tn zuw;#{m-)(LN65?nOOt=ZsPYEKL`bW7yFAXaZ`O^I{h~#fzs3y4D0BZCt#5rjJM22u zTpbu}Sf>~L_4-+4dWRbgOgO6;_8Q{iA<=)I&uCe{=Jzyww zZ^5tdH_JX{E3)-CVoYU{epO2E46|S+9#KMIdUZ!AqB9EgruZ?Di1Et}lb!sENVLBb zCyz0kaYLGk+*sp*{n% + + + diff --git a/calendarpro/src/main/java/bz/kakadu/calendar/CalendarTheme.java b/calendarpro/src/main/java/bz/kakadu/calendar/CalendarTheme.java index 017c890..50e7885 100644 --- a/calendarpro/src/main/java/bz/kakadu/calendar/CalendarTheme.java +++ b/calendarpro/src/main/java/bz/kakadu/calendar/CalendarTheme.java @@ -1,3 +1,16 @@ +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar; import android.content.Context; diff --git a/calendarpro/src/main/java/bz/kakadu/calendar/CalendarViewPager.java b/calendarpro/src/main/java/bz/kakadu/calendar/CalendarViewPager.java index 95ea682..5a81cf4 100644 --- a/calendarpro/src/main/java/bz/kakadu/calendar/CalendarViewPager.java +++ b/calendarpro/src/main/java/bz/kakadu/calendar/CalendarViewPager.java @@ -1,3 +1,16 @@ +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar; import android.content.Context; diff --git a/calendarpro/src/main/java/bz/kakadu/calendar/Cell.java b/calendarpro/src/main/java/bz/kakadu/calendar/Cell.java index 51f80f5..cdde6a7 100644 --- a/calendarpro/src/main/java/bz/kakadu/calendar/Cell.java +++ b/calendarpro/src/main/java/bz/kakadu/calendar/Cell.java @@ -1,3 +1,16 @@ +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar; @@ -10,19 +23,10 @@ public final class Cell { final Day day = new Day(); String value; boolean isVisible; - private int drawPos; Cell() { } - public int getDrawPosition() { - return drawPos; - } - - public void setDrawPosition(int pos) { - drawPos = pos; - } - public Day getDay() { return day; } diff --git a/calendarpro/src/main/java/bz/kakadu/calendar/Day.java b/calendarpro/src/main/java/bz/kakadu/calendar/Day.java index 4e83e06..5580b7c 100644 --- a/calendarpro/src/main/java/bz/kakadu/calendar/Day.java +++ b/calendarpro/src/main/java/bz/kakadu/calendar/Day.java @@ -1,12 +1,25 @@ +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar; import android.support.annotation.IntDef; +import android.support.annotation.IntRange; import android.text.format.DateUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Calendar; -import java.util.GregorianCalendar; import static java.util.Calendar.APRIL; import static java.util.Calendar.AUGUST; @@ -22,16 +35,22 @@ import static java.util.Calendar.SEPTEMBER; /** + * Container for date values: day, month, year. + * Hash is a single integer, for example 20161110. * Created on 10.11.2016 * * @author Roman Tsarou */ -@SuppressWarnings("WrongConstant") public class Day implements Comparable, Cloneable { - private static final GregorianCalendar calendar = new GregorianCalendar(); + private static final Calendar calendar = Calendar.getInstance(); private int hash; - public Day(int date, @Month int month, int year) { + /** + * @param date from 1 to 31 + * @param month from {@link Calendar#JANUARY} to {@link Calendar#DECEMBER} + * @param year any + */ + public Day(@IntRange(from = 1, to = 31) int date, @Month int month, int year) { set(date, month, year); } @@ -89,7 +108,7 @@ public int getYear() { @Override public String toString() { - return "Day: " + hash; + return "Day: " + hash; } @Override @@ -97,7 +116,13 @@ public int hashCode() { return hash; } - public Day set(int date, @Month int month, int year) { + /** + * @param date from 1 to 31 + * @param month from {@link Calendar#JANUARY} to {@link Calendar#DECEMBER} + * @param year any + * @return current object + */ + public Day set(@IntRange(from = 1, to = 31) int date, @Month int month, int year) { hash = date + month * 100 + year * 10000; return this; } @@ -125,14 +150,12 @@ public boolean equals(Object obj) { } @Override - protected Day clone() { - Day day = null; + public Day clone() { try { - day = (Day) super.clone(); + return (Day) super.clone(); } catch (CloneNotSupportedException e) { - e.printStackTrace(); + throw new RuntimeException(e); } - return day; } public boolean between(Day first, Day last) { @@ -147,6 +170,10 @@ public boolean before(Day other) { return hashCode() < other.hashCode(); } + /** + * @param target for values (date, month, year) from this day. + * Note: other values (time, etc.) will be reset to 0 + */ public void setTo(Calendar target) { target.clear(); target.set(Calendar.YEAR, getYear()); diff --git a/calendarpro/src/main/java/bz/kakadu/calendar/DrawUtils.java b/calendarpro/src/main/java/bz/kakadu/calendar/DrawUtils.java index 1f7c381..7c2317b 100644 --- a/calendarpro/src/main/java/bz/kakadu/calendar/DrawUtils.java +++ b/calendarpro/src/main/java/bz/kakadu/calendar/DrawUtils.java @@ -1,3 +1,16 @@ +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar; import android.content.Context; diff --git a/calendarpro/src/main/java/bz/kakadu/calendar/ICellDecoration.java b/calendarpro/src/main/java/bz/kakadu/calendar/ICellDecoration.java index 102f679..6335c06 100644 --- a/calendarpro/src/main/java/bz/kakadu/calendar/ICellDecoration.java +++ b/calendarpro/src/main/java/bz/kakadu/calendar/ICellDecoration.java @@ -1,3 +1,16 @@ +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar; import android.graphics.Canvas; @@ -13,7 +26,23 @@ public interface ICellDecoration { void setCalendarTheme(@NonNull CalendarTheme theme); + /** + * Call before draw all cells + * + * @param parent MonthView + * @param canvas of parent view for draw + * @param cellWidth width of each cell + * @param cellHeight height of each cell + */ void onPreDraw(View parent, Canvas canvas, float cellWidth, float cellHeight); + /** + * Call for each cell in MonthView + * + * @param parent MonthView + * @param cell data + * @param canvas of parent view for draw + * @param bounds contains size and position this cell + */ void onCellDraw(View parent, Cell cell, Canvas canvas, RectF bounds); } diff --git a/calendarpro/src/main/java/bz/kakadu/calendar/MonthView.java b/calendarpro/src/main/java/bz/kakadu/calendar/MonthView.java index b762d7a..baf5ff9 100644 --- a/calendarpro/src/main/java/bz/kakadu/calendar/MonthView.java +++ b/calendarpro/src/main/java/bz/kakadu/calendar/MonthView.java @@ -1,3 +1,16 @@ +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar; import android.content.BroadcastReceiver; diff --git a/calendarpro/src/main/java/bz/kakadu/calendar/OnDayClickListener.java b/calendarpro/src/main/java/bz/kakadu/calendar/OnDayClickListener.java index 5f26cde..d072a8c 100644 --- a/calendarpro/src/main/java/bz/kakadu/calendar/OnDayClickListener.java +++ b/calendarpro/src/main/java/bz/kakadu/calendar/OnDayClickListener.java @@ -1,3 +1,16 @@ +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar; import android.view.View; diff --git a/calendarpro/src/main/java/bz/kakadu/calendar/RangeCellDecoration.java b/calendarpro/src/main/java/bz/kakadu/calendar/RangeCellDecoration.java index b336ed3..1631c03 100644 --- a/calendarpro/src/main/java/bz/kakadu/calendar/RangeCellDecoration.java +++ b/calendarpro/src/main/java/bz/kakadu/calendar/RangeCellDecoration.java @@ -1,3 +1,16 @@ +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar; import android.graphics.Canvas; @@ -91,7 +104,7 @@ protected Paint getDayTextPaint(Day day) { return super.getDayTextPaint(day); } - public void setBoundsRange(@Nullable Day min, @Nullable Day max) { + public void setRangeBounds(@Nullable Day min, @Nullable Day max) { minRangeDay = min == null ? null : min.hashCode(); maxRangeDay = max == null ? null : max.hashCode(); checkValues(); @@ -147,14 +160,24 @@ private int getRangeType(int day) { return -1; } + @Nullable + public Integer getRangeDayHashFrom() { + return fromDay; + } + @Nullable public Day getRangeFrom() { - return new Day(fromDay); + return fromDay == null ? null : new Day(fromDay); + } + + @Nullable + public Integer getRangeDayHashTo() { + return toDay; } @Nullable public Day getRangeTo() { - return new Day(toDay); + return toDay == null ? null : new Day(toDay); } @Override diff --git a/calendarpro/src/main/java/bz/kakadu/calendar/SimpleCellDecoration.java b/calendarpro/src/main/java/bz/kakadu/calendar/SimpleCellDecoration.java index f373e89..9139253 100644 --- a/calendarpro/src/main/java/bz/kakadu/calendar/SimpleCellDecoration.java +++ b/calendarpro/src/main/java/bz/kakadu/calendar/SimpleCellDecoration.java @@ -1,3 +1,17 @@ + +/* + * Copyright (c) 2019 Roman Tsarou + * 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 bz.kakadu.calendar; import android.graphics.Canvas; diff --git a/calendarpro/src/main/res/drawable/calendar_arrow_left.xml b/calendarpro/src/main/res/drawable/calendar_arrow_left.xml index 2cbb422..a74ed08 100644 --- a/calendarpro/src/main/res/drawable/calendar_arrow_left.xml +++ b/calendarpro/src/main/res/drawable/calendar_arrow_left.xml @@ -1,3 +1,16 @@ + + + + + + + + + + + @@ -43,7 +55,7 @@ true true ?android:textColorSecondary - 20% + 24% @style/CalendarTitleLayoutStyle @style/CalendarTitleTextAppearance @style/CalendarTitleButtonStyle @@ -56,14 +68,14 @@ ?colorAccent 50% true - 80% - 74% + 96% + 90% true false ?android:textColorPrimary ?android:textColorPrimary 1dp - 80% + 96% LLLL, yyyy diff --git a/calendarpro/src/main/res/values/strings.xml b/calendarpro/src/main/res/values/strings.xml deleted file mode 100644 index 4461817..0000000 --- a/calendarpro/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - calendarpro -