├── .github └── workflows │ └── android.yml ├── .gitignore ├── .idea ├── caches │ ├── build_file_checksums.ser │ └── gradle_models.ser ├── copyright │ └── Shrikanth_Ravi.xml ├── dictionaries │ └── shrikanthravi.xml ├── encodings.xml ├── gradle.xml ├── markdown-doclet.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── CollapsibleCalendarViewVideo.mov ├── LICENSE ├── README.md ├── _config.yml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── shrikanthravi │ │ └── collapsiblecalendarview │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── shrikanthravi │ │ │ └── collapsiblecalendarview │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable-v24 │ │ ├── circle_white_solid_background.xml │ │ ├── circle_white_stroke_background.xml │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── shrikanthravi │ └── collapsiblecalendarview │ └── ExampleUnitTest.java ├── build.gradle ├── collapsiblecalendarview2 ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── shrikanthravi │ │ └── collapsiblecalendarview │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── shrikanthravi │ │ │ └── collapsiblecalendarview │ │ │ ├── data │ │ │ ├── CalendarAdapter.kt │ │ │ ├── Day.java │ │ │ └── Event.java │ │ │ ├── view │ │ │ ├── BounceAnimator.kt │ │ │ ├── ExpandIconView.java │ │ │ ├── LockScrollView.kt │ │ │ └── SwipeTouchListener.kt │ │ │ └── widget │ │ │ ├── CollapsibleCalendar.kt │ │ │ └── UICalendar.kt │ └── res │ │ ├── anim │ │ └── bounce.xml │ │ ├── drawable-hdpi │ │ ├── dot_icon.png │ │ ├── down_arrow_icon.png │ │ ├── left_icon.png │ │ └── right_icon.png │ │ ├── drawable-mdpi │ │ ├── dot_icon.png │ │ ├── down_arrow_icon.png │ │ ├── left_icon.png │ │ └── right_icon.png │ │ ├── drawable-xhdpi │ │ ├── calender_icon.png │ │ ├── dot_icon.png │ │ ├── down_arrow_icon.png │ │ ├── left_icon.png │ │ └── right_icon.png │ │ ├── drawable-xxhdpi │ │ ├── dot_icon.png │ │ ├── down_arrow_icon.png │ │ ├── left_icon.png │ │ └── right_icon.png │ │ ├── drawable │ │ ├── circle_black_solid_background.xml │ │ ├── circle_black_stroke_background.xml │ │ ├── circle_white_solid_background.xml │ │ ├── circle_white_stroke_background.xml │ │ └── ic_calendar.xml │ │ ├── layout │ │ ├── day_layout.xml │ │ ├── layout_day_of_week.xml │ │ └── widget_collapsible_calendarview.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── dimens.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── shrikanthravi │ └── collapsiblecalendarview │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: Android CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v1 12 | - name: set up JDK 1.8 13 | uses: actions/setup-java@v1 14 | with: 15 | java-version: 1.8 16 | - name: Build with Gradle 17 | run: ./gradlew :clean collapsiblecalendarview:assemble 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | /.idea/* 11 | -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/caches/gradle_models.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/.idea/caches/gradle_models.ser -------------------------------------------------------------------------------- /.idea/copyright/Shrikanth_Ravi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/dictionaries/shrikanthravi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/markdown-doclet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Android 51 | 52 | 53 | 54 | 55 | Android 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 67 | 68 | 69 | 70 | 71 | 72 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/.idea/vcs.xml -------------------------------------------------------------------------------- /CollapsibleCalendarViewVideo.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/CollapsibleCalendarViewVideo.mov -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Shrikanth Ravi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![alt text](https://drive.google.com/uc?id=1Q3SOQu77RizHUGqpyUfAhDofDMUYniOr) 2 | 3 | [![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com) 4 | 5 | Buy Me a Coffee at ko-fi.com 6 | 7 | 8 | ### Not being maintained. PRs are welcome 9 | 10 | 11 | [![Android Arsenal]( https://img.shields.io/badge/Android%20Arsenal-Collapsible--Calendar--View--Android-green.svg?style=flat )]( https://android-arsenal.com/details/1/6829 ) 12 | 13 | ### Version 14 | [![](https://jitpack.io/v/shrikanth7698/Collapsible-Calendar-View-Android.svg)](https://jitpack.io/#shrikanth7698/Collapsible-Calendar-View-Android) 15 | 16 | ### Installation 17 | 18 | * **Gradle** 19 | 20 | Add it in your root build.gradle at the end of repositories: 21 | ```gradle 22 | allprojects { 23 | repositories { 24 | ... 25 | maven { url 'https://jitpack.io' } 26 | } 27 | } 28 | ``` 29 | 30 | Add the dependency in your app build.gradle 31 | ```gradle 32 | dependencies { 33 | implementation 'com.github.shrikanth7698:Collapsible-Calendar-View-Android:v1.0.3' 34 | } 35 | ``` 36 | 37 | * **Maven** 38 | 39 | Add the JitPack repository to your build file 40 | ```gradle 41 | 42 | 43 | jitpack.io 44 | https://jitpack.io 45 | 46 | 47 | ``` 48 | 49 | Add the dependency 50 | ```gradle 51 | 52 | com.github.shrikanth7698 53 | Collapsible-Calendar-View-Android 54 | v1.0.0 55 | 56 | ``` 57 | 58 | 59 | 60 | ### Usage 61 | 62 | Drop the Collapsible CalendarView in your XML layout as is shown below: 63 | ```xml 64 | 68 | 69 | ``` 70 | 71 | And then in your Activity or fragment 72 | ```java 73 | final CollapsibleCalendar collapsibleCalendar = findViewById(R.id.calendarView); 74 | collapsibleCalendar.setCalendarListener(new CollapsibleCalendar.CalendarListener() { 75 | @Override 76 | public void onDaySelect() { 77 | Day day = viewCalendar.getSelectedDay(); 78 | Log.i(getClass().getName(), "Selected Day: " 79 | + day.getYear() + "/" + (day.getMonth() + 1) + "/" + day.getDay()); 80 | } 81 | 82 | @Override 83 | public void onItemClick(View view) { 84 | 85 | } 86 | 87 | @Override 88 | public void onDataUpdate() { 89 | 90 | } 91 | 92 | @Override 93 | public void onMonthChange() { 94 | 95 | } 96 | 97 | @Override 98 | public void onWeekChange(int i) { 99 | 100 | } 101 | }); 102 | ``` 103 | 104 | ### Customization 105 | 106 | 107 | ```xml 108 | 120 | 121 | ``` 122 | 123 | 124 | 125 | ### License 126 | ``` 127 | MIT License 128 | 129 | Copyright (c) 2018 Shrikanth Ravi 130 | 131 | Permission is hereby granted, free of charge, to any person obtaining a copy 132 | of this software and associated documentation files (the "Software"), to deal 133 | in the Software without restriction, including without limitation the rights 134 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 135 | copies of the Software, and to permit persons to whom the Software is 136 | furnished to do so, subject to the following conditions: 137 | 138 | The above copyright notice and this permission notice shall be included in all 139 | copies or substantial portions of the Software. 140 | 141 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 142 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 143 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 144 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 145 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 146 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 147 | SOFTWARE. 148 | ``` 149 | 150 | 151 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman 2 | plugins: 3 | - jekyll-seo-tag 4 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | 6 | android { 7 | compileSdkVersion 29 8 | 9 | kotlinOptions { 10 | jvmTarget = '1.8' 11 | } 12 | 13 | defaultConfig { 14 | applicationId "com.shrikanthravi.collapsiblecalendarview" 15 | minSdkVersion 21 16 | targetSdkVersion 29 17 | versionCode 1 18 | versionName "1.0" 19 | compileOptions { 20 | sourceCompatibility JavaVersion.VERSION_1_8 21 | targetCompatibility JavaVersion.VERSION_1_8 22 | } 23 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 24 | } 25 | dexOptions { 26 | preDexLibraries = false 27 | } 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | } 35 | 36 | dependencies { 37 | implementation fileTree(dir: 'libs', include: ['*.jar']) 38 | implementation 'androidx.appcompat:appcompat:1.1.0' 39 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 40 | testImplementation 'junit:junit:4.12' 41 | androidTestImplementation 'androidx.test:runner:1.2.0' 42 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 43 | implementation project(':collapsiblecalendarview2') 44 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 45 | } 46 | repositories { 47 | mavenCentral() 48 | } 49 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/shrikanthravi/collapsiblecalendarview/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | 9 | import static org.junit.Assert.*; 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * @see Testing documentation 15 | */ 16 | @RunWith(AndroidJUnit4.class) 17 | public class ExampleInstrumentedTest { 18 | @Test 19 | public void useAppContext() throws Exception { 20 | // Context of the app under test. 21 | Context appContext = InstrumentationRegistry.getTargetContext(); 22 | 23 | assertEquals("com.shrikanthravi.collapsiblecalendarview", appContext.getPackageName()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/shrikanthravi/collapsiblecalendarview/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview 2 | 3 | import android.graphics.Color 4 | import androidx.appcompat.app.AppCompatActivity 5 | import android.os.Bundle 6 | import android.util.Log 7 | import android.view.MotionEvent 8 | import android.view.View 9 | import android.widget.RelativeLayout 10 | import android.widget.ScrollView 11 | import android.widget.TextView 12 | import androidx.constraintlayout.widget.ConstraintLayout 13 | import com.shrikanthravi.collapsiblecalendarview.data.Day 14 | import com.shrikanthravi.collapsiblecalendarview.view.OnSwipeTouchListener 15 | 16 | import com.shrikanthravi.collapsiblecalendarview.widget.CollapsibleCalendar 17 | import com.shrikanthravi.collapsiblecalendarview.widget.UICalendar 18 | 19 | import java.util.Calendar 20 | import java.util.Date 21 | import java.util.GregorianCalendar 22 | 23 | 24 | class MainActivity : AppCompatActivity(){ 25 | companion object{ 26 | var TAG = "MainActivity"; 27 | } 28 | 29 | lateinit var collapsibleCalendar:CollapsibleCalendar 30 | 31 | 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | setContentView(R.layout.activity_main) 35 | supportActionBar!!.elevation = 0f 36 | window.statusBarColor = resources.getColor(R.color.google_red) 37 | var relativeLayout = findViewById(R.id.scrollView) 38 | var textView = findViewById(R.id.tv_date) 39 | 40 | collapsibleCalendar = findViewById(R.id.collapsibleCalendarView) 41 | relativeLayout.setOnTouchListener(object:OnSwipeTouchListener(this@MainActivity){ 42 | override fun onSwipeRight() { 43 | collapsibleCalendar.nextDay() 44 | } 45 | 46 | override fun onSwipeLeft() { 47 | collapsibleCalendar.prevDay() 48 | } 49 | 50 | override fun onSwipeTop() { 51 | if(collapsibleCalendar.expanded){ 52 | collapsibleCalendar.collapse(400) 53 | } 54 | } 55 | 56 | override fun onSwipeBottom() { 57 | if(!collapsibleCalendar.expanded){ 58 | collapsibleCalendar.expand(400) 59 | } 60 | } 61 | }); 62 | //To hide or show expand icon 63 | collapsibleCalendar.setExpandIconVisible(true) 64 | val today = GregorianCalendar() 65 | collapsibleCalendar.addEventTag(today.get(Calendar.YEAR), today.get(Calendar.MONTH), today.get(Calendar.DAY_OF_MONTH)) 66 | today.add(Calendar.DATE, 1) 67 | collapsibleCalendar.selectedDay = Day(today.get(Calendar.YEAR), today.get(Calendar.MONTH), today.get(Calendar.DAY_OF_MONTH)) 68 | collapsibleCalendar.addEventTag(today.get(Calendar.YEAR), today.get(Calendar.MONTH), today.get(Calendar.DAY_OF_MONTH), Color.BLUE) 69 | collapsibleCalendar.params = CollapsibleCalendar.Params(0, 100) 70 | collapsibleCalendar.setCalendarListener(object : CollapsibleCalendar.CalendarListener { 71 | override fun onDayChanged() { 72 | 73 | } 74 | 75 | override fun onClickListener() { 76 | if(collapsibleCalendar.expanded){ 77 | collapsibleCalendar.collapse(400) 78 | } 79 | else{ 80 | collapsibleCalendar.expand(400) 81 | } 82 | } 83 | 84 | override fun onDaySelect() { 85 | textView.text = collapsibleCalendar.selectedDay?.toUnixTime().toString() 86 | } 87 | 88 | override fun onItemClick(v: View) { 89 | 90 | } 91 | 92 | override fun onDataUpdate() { 93 | 94 | } 95 | 96 | override fun onMonthChange() { 97 | 98 | } 99 | 100 | override fun onWeekChange(position: Int) { 101 | 102 | } 103 | }) 104 | 105 | 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/circle_white_solid_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/circle_white_stroke_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 32 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #304FFE 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CollapsibleCalendarView 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/shrikanthravi/collapsiblecalendarview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.3.50' 5 | 6 | repositories { 7 | google() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.5.0' 12 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | 15 | 16 | // NOTE: Do not place your application dependencies here; they belong 17 | // in the individual module build.gradle files 18 | } 19 | } 20 | 21 | allprojects { 22 | repositories { 23 | google() 24 | jcenter() 25 | maven { url 'https://jitpack.io' } 26 | } 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-android' 5 | group = 'com.github.shrikanth7698' 6 | version = '1.0.3' 7 | 8 | android { 9 | compileSdkVersion 29 10 | 11 | kotlinOptions { 12 | jvmTarget = '1.8' 13 | } 14 | 15 | defaultConfig { 16 | minSdkVersion 21 17 | targetSdkVersion 29 18 | versionCode 1 19 | versionName "1.0" 20 | 21 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 22 | compileOptions { 23 | sourceCompatibility JavaVersion.VERSION_1_8 24 | targetCompatibility JavaVersion.VERSION_1_8 25 | } 26 | 27 | } 28 | dexOptions { 29 | preDexLibraries = false 30 | } 31 | 32 | buildTypes { 33 | release { 34 | minifyEnabled false 35 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 36 | } 37 | } 38 | 39 | } 40 | 41 | dependencies { 42 | implementation fileTree(dir: 'libs', include: ['*.jar']) 43 | 44 | implementation 'androidx.appcompat:appcompat:1.1.0' 45 | testImplementation 'junit:junit:4.12' 46 | androidTestImplementation 'androidx.test:runner:1.2.0' 47 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 48 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 49 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 50 | implementation 'androidx.cardview:cardview:1.0.0' 51 | } 52 | repositories { 53 | mavenCentral() 54 | } 55 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/androidTest/java/com/shrikanthravi/collapsiblecalendarview/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.shrikanthravi.collapsiblecalendarview.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/java/com/shrikanthravi/collapsiblecalendarview/data/CalendarAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview.data 2 | 3 | import android.content.Context 4 | import android.graphics.PorterDuff 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.widget.ImageView 8 | import android.widget.TextView 9 | 10 | import com.shrikanthravi.collapsiblecalendarview.R 11 | 12 | import java.util.ArrayList 13 | import java.util.Calendar 14 | 15 | /** 16 | * Created by shrikanthravi on 06/03/18. 17 | */ 18 | 19 | class CalendarAdapter(context: Context, cal: Calendar) { 20 | private var mFirstDayOfWeek = 0 21 | var calendar: Calendar 22 | private val mInflater: LayoutInflater 23 | 24 | private val mItemList = ArrayList() 25 | private val mViewList = ArrayList() 26 | var mEventList = ArrayList() 27 | 28 | // public methods 29 | val count: Int 30 | get() = mItemList.size 31 | 32 | init { 33 | this.calendar = cal.clone() as Calendar 34 | this.calendar.set(Calendar.DAY_OF_MONTH, 1) 35 | 36 | mInflater = LayoutInflater.from(context) 37 | 38 | refresh() 39 | } 40 | 41 | fun getItem(position: Int): Day { 42 | return mItemList[position] 43 | } 44 | 45 | fun getView(position: Int): View { 46 | return mViewList[position] 47 | } 48 | 49 | fun setFirstDayOfWeek(firstDayOfWeek: Int) { 50 | mFirstDayOfWeek = firstDayOfWeek 51 | } 52 | 53 | fun addEvent(event: Event) { 54 | mEventList.add(event) 55 | } 56 | 57 | fun refresh() { 58 | // clear data 59 | mItemList.clear() 60 | mViewList.clear() 61 | 62 | // set calendar 63 | val year = calendar.get(Calendar.YEAR) 64 | val month = calendar.get(Calendar.MONTH) 65 | 66 | calendar.set(year, month, 1) 67 | 68 | val lastDayOfMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH) 69 | val firstDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1 70 | 71 | // generate day list 72 | val offset = 0 - (firstDayOfWeek - mFirstDayOfWeek) + 1 73 | val length = Math.ceil(((lastDayOfMonth - offset + 1).toFloat() / 7).toDouble()).toInt() * 7 74 | for (i in offset until length + offset) { 75 | val numYear: Int 76 | val numMonth: Int 77 | val numDay: Int 78 | 79 | val tempCal = Calendar.getInstance() 80 | if (i <= 0) { // prev month 81 | if (month == 0) { 82 | numYear = year - 1 83 | numMonth = 11 84 | } else { 85 | numYear = year 86 | numMonth = month - 1 87 | } 88 | tempCal.set(numYear, numMonth, 1) 89 | numDay = tempCal.getActualMaximum(Calendar.DAY_OF_MONTH) + i 90 | } else if (i > lastDayOfMonth) { // next month 91 | if (month == 11) { 92 | numYear = year + 1 93 | numMonth = 0 94 | } else { 95 | numYear = year 96 | numMonth = month + 1 97 | } 98 | tempCal.set(numYear, numMonth, 1) 99 | numDay = i - lastDayOfMonth 100 | } else { 101 | numYear = year 102 | numMonth = month 103 | numDay = i 104 | } 105 | 106 | val day = Day(numYear, numMonth, numDay) 107 | 108 | val view = mInflater.inflate(R.layout.day_layout, null) 109 | val txtDay = view.findViewById(R.id.txt_day) as TextView 110 | val imgEventTag = view.findViewById(R.id.img_event_tag) as ImageView 111 | 112 | txtDay.text = day.day.toString() 113 | if (day.month != calendar.get(Calendar.MONTH)) { 114 | txtDay.alpha = 0.3f 115 | } 116 | 117 | for (j in mEventList.indices) { 118 | val event = mEventList[j] 119 | if (day.year == event.year 120 | && day.month == event.month 121 | && day.day == event.day) { 122 | imgEventTag.visibility = View.VISIBLE 123 | imgEventTag.setColorFilter(event.color, PorterDuff.Mode.SRC_ATOP) 124 | } 125 | } 126 | 127 | mItemList.add(day) 128 | mViewList.add(view) 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/java/com/shrikanthravi/collapsiblecalendarview/data/Day.java: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview.data; 2 | 3 | import android.content.Intent; 4 | import android.os.Parcel; 5 | import android.os.Parcelable; 6 | 7 | import java.util.Calendar; 8 | import java.util.Date; 9 | 10 | /** 11 | * Created by shrikanthravi on 06/03/18. 12 | */ 13 | 14 | public class Day implements Parcelable{ 15 | 16 | private int mYear; 17 | private int mMonth; 18 | private int mDay; 19 | 20 | public Day(int year, int month, int day){ 21 | this.mYear = year; 22 | this.mMonth = month; 23 | this.mDay = day; 24 | } 25 | 26 | public int getMonth(){ 27 | return mMonth; 28 | } 29 | 30 | public int getYear(){ 31 | return mYear; 32 | } 33 | 34 | public int getDay(){ 35 | return mDay; 36 | } 37 | 38 | 39 | 40 | public Day(Parcel in){ 41 | int[] data = new int[3]; 42 | in.readIntArray(data); 43 | this.mYear = data[0]; 44 | this.mMonth = data[1]; 45 | this.mYear = data[2]; 46 | } 47 | 48 | @Override 49 | public int describeContents() { 50 | return 0; 51 | } 52 | 53 | @Override 54 | public void writeToParcel(Parcel dest, int flags) { 55 | dest.writeIntArray(new int[] {this.mYear, 56 | this.mMonth, 57 | this.mDay}); 58 | } 59 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { 60 | public Day createFromParcel(Parcel in) { 61 | return new Day(in); 62 | } 63 | 64 | public Day[] newArray(int size) { 65 | return new Day[size]; 66 | } 67 | }; 68 | 69 | public long toUnixTime(){ 70 | Date date = new Date(this.mYear, this.mMonth, this.mDay); 71 | return date.getTime(); 72 | } 73 | 74 | public int getDiff(){ 75 | Calendar todayCal = Calendar.getInstance(); 76 | Day day = new Day(todayCal.get(Calendar.YEAR), todayCal.get(Calendar.MONTH),todayCal.get(Calendar.DAY_OF_MONTH)); 77 | return (int)( (this.toUnixTime() - day.toUnixTime()) 78 | / (1000 * 60 * 60 * 24) ); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/java/com/shrikanthravi/collapsiblecalendarview/data/Event.java: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview.data; 2 | 3 | /** 4 | * Created by shrikanthravi on 06/03/18. 5 | */ 6 | 7 | public class Event { 8 | private int mYear; 9 | private int mMonth; 10 | private int mDay; 11 | private int mColor; 12 | 13 | public Event(int year, int month, int day){ 14 | this.mYear = year; 15 | this.mMonth = month; 16 | this.mDay = day; 17 | } 18 | 19 | public Event(int year, int month, int day, int color){ 20 | this.mYear = year; 21 | this.mMonth = month; 22 | this.mDay = day; 23 | this.mColor=color; 24 | } 25 | 26 | public int getMonth(){ 27 | return mMonth; 28 | } 29 | 30 | public int getYear(){ 31 | return mYear; 32 | } 33 | 34 | public int getDay(){ 35 | return mDay; 36 | } 37 | 38 | public int getColor() { 39 | return mColor; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/java/com/shrikanthravi/collapsiblecalendarview/view/BounceAnimator.kt: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview.view 2 | 3 | class BounceAnimator(amplitude: Double, frequency: Double) : android.view.animation.Interpolator { 4 | private var mAmplitude = 1.0 5 | private var mFrequency = 10.0 6 | 7 | init { 8 | mAmplitude = amplitude 9 | mFrequency = frequency 10 | } 11 | 12 | override fun getInterpolation(time: Float): Float { 13 | return (-1.0 * Math.pow(Math.E, -time / mAmplitude) * 14 | Math.cos(mFrequency * time) + 1).toFloat() 15 | } 16 | } -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/java/com/shrikanthravi/collapsiblecalendarview/view/ExpandIconView.java: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview.view; 2 | 3 | 4 | /* 5 | * Copyright (C) 2016 Evgenii Zagumennyi 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | 21 | import android.animation.ArgbEvaluator; 22 | import android.animation.ValueAnimator; 23 | import android.content.Context; 24 | import android.content.res.TypedArray; 25 | import android.graphics.Canvas; 26 | import android.graphics.Color; 27 | import android.graphics.Paint; 28 | import android.graphics.Path; 29 | import android.graphics.Point; 30 | import android.os.Build; 31 | import androidx.annotation.FloatRange; 32 | import androidx.annotation.IntDef; 33 | import androidx.annotation.NonNull; 34 | import androidx.annotation.Nullable; 35 | import android.util.AttributeSet; 36 | import android.view.View; 37 | import android.view.animation.DecelerateInterpolator; 38 | 39 | import com.shrikanthravi.collapsiblecalendarview.R; 40 | 41 | import java.lang.annotation.Retention; 42 | import java.lang.annotation.RetentionPolicy; 43 | 44 | import static android.graphics.Paint.ANTI_ALIAS_FLAG; 45 | 46 | public class ExpandIconView extends View { 47 | 48 | private static final float MORE_STATE_ALPHA = -45f; 49 | private static final float LESS_STATE_ALPHA = 45f; 50 | private static final float DELTA_ALPHA = 90f; 51 | private static final float THICKNESS_PROPORTION = 5f / 36f; 52 | private static final float PADDING_PROPORTION = 4f / 24f; 53 | private static final long DEFAULT_ANIMATION_DURATION = 150; 54 | 55 | @IntDef({ 56 | MORE, 57 | LESS, 58 | INTERMEDIATE 59 | }) 60 | @Retention(RetentionPolicy.SOURCE) 61 | public @interface State { 62 | } 63 | 64 | public static final int MORE = 0; 65 | public static final int LESS = 1; 66 | private static final int INTERMEDIATE = 2; 67 | 68 | @State 69 | private int state; 70 | private float alpha = MORE_STATE_ALPHA; 71 | private float centerTranslation = 0f; 72 | @FloatRange(from = 0.f, to = 1.f) 73 | private float fraction = 0f; 74 | private float animationSpeed; 75 | 76 | private boolean switchColor = false; 77 | private int color = Color.BLACK; 78 | private int colorMore; 79 | private int colorLess; 80 | private int colorIntermediate; 81 | 82 | @NonNull 83 | private final Paint paint; 84 | private final Point left = new Point(); 85 | private final Point right = new Point(); 86 | private final Point center = new Point(); 87 | private final Point tempLeft = new Point(); 88 | private final Point tempRight = new Point(); 89 | 90 | private final boolean useDefaultPadding; 91 | private int padding; 92 | 93 | private final Path path = new Path(); 94 | @Nullable 95 | private ValueAnimator arrowAnimator; 96 | 97 | public void setColor(int color){ 98 | this.colorLess = color; 99 | this.colorMore = color; 100 | this.colorIntermediate = color; 101 | invalidate(); 102 | 103 | } 104 | 105 | public ExpandIconView(@NonNull Context context) { 106 | this(context, null); 107 | } 108 | 109 | public ExpandIconView(@NonNull Context context, @Nullable AttributeSet attrs) { 110 | this(context, attrs, 0); 111 | } 112 | 113 | public ExpandIconView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 114 | super(context, attrs, defStyleAttr); 115 | 116 | TypedArray array = getContext().getTheme().obtainStyledAttributes(attrs, 117 | R.styleable.ExpandIconView, 118 | 0, 0); 119 | 120 | final boolean roundedCorners; 121 | final long animationDuration; 122 | try { 123 | roundedCorners = array.getBoolean(R.styleable.ExpandIconView_eiv_roundedCorners, false); 124 | switchColor = array.getBoolean(R.styleable.ExpandIconView_eiv_switchColor, false); 125 | color = array.getColor(R.styleable.ExpandIconView_eiv_color, Color.BLACK); 126 | colorMore = array.getColor(R.styleable.ExpandIconView_eiv_colorMore, Color.BLACK); 127 | colorLess = array.getColor(R.styleable.ExpandIconView_eiv_colorLess, Color.BLACK); 128 | colorIntermediate = array.getColor(R.styleable.ExpandIconView_eiv_colorIntermediate, -1); 129 | animationDuration = array.getInteger(R.styleable.ExpandIconView_eiv_animationDuration, (int) DEFAULT_ANIMATION_DURATION); 130 | padding = array.getDimensionPixelSize(R.styleable.ExpandIconView_eiv_padding, -1); 131 | useDefaultPadding = (padding == -1); 132 | } finally { 133 | array.recycle(); 134 | } 135 | 136 | { 137 | paint = new Paint(ANTI_ALIAS_FLAG); 138 | paint.setColor(color); 139 | paint.setStyle(Paint.Style.STROKE); 140 | paint.setDither(true); 141 | if (roundedCorners) { 142 | paint.setStrokeJoin(Paint.Join.ROUND); 143 | paint.setStrokeCap(Paint.Cap.ROUND); 144 | } 145 | } 146 | 147 | animationSpeed = DELTA_ALPHA / animationDuration; 148 | setState(MORE, false); 149 | } 150 | 151 | public void switchState() { 152 | switchState(true); 153 | } 154 | 155 | /** 156 | * Changes state and updates view 157 | * 158 | * @param animate Indicates thaw state will be changed with animation or not 159 | */ 160 | public void switchState(boolean animate) { 161 | final int newState; 162 | switch (state) { 163 | case MORE: 164 | newState = LESS; 165 | break; 166 | case LESS: 167 | newState = MORE; 168 | break; 169 | case INTERMEDIATE: 170 | newState = getFinalStateByFraction(); 171 | break; 172 | default: 173 | throw new IllegalArgumentException("Unknown state [" + state + "]"); 174 | } 175 | setState(newState, animate); 176 | } 177 | 178 | /** 179 | * Set one of two states and updates view 180 | * 181 | * @param state {@link #MORE} or {@link #LESS} 182 | * @param animate Indicates thaw state will be changed with animation or not 183 | * @throws IllegalArgumentException if {@param state} is invalid 184 | */ 185 | public void setState(@State int state, boolean animate) { 186 | this.state = state; 187 | if (state == MORE) { 188 | fraction = 0f; 189 | } else if (state == LESS) { 190 | fraction = 1f; 191 | } else { 192 | throw new IllegalArgumentException("Unknown state, must be one of STATE_MORE = 0, STATE_LESS = 1"); 193 | } 194 | updateArrow(animate); 195 | } 196 | 197 | /** 198 | * Set current fraction for arrow and updates view 199 | * 200 | * @param fraction Must be value from 0f to 1f {@link #MORE} state value is 0f, {@link #LESS} 201 | * state value is 1f 202 | * @throws IllegalArgumentException if fraction is less than 0f or more than 1f 203 | */ 204 | public void setFraction(@FloatRange(from = 0.f, to = 1.f) float fraction, boolean animate) { 205 | if (fraction < 0f || fraction > 1f) { 206 | throw new IllegalArgumentException("Fraction value must be from 0 to 1f, fraction=" + fraction); 207 | } 208 | 209 | if (this.fraction == fraction) { 210 | return; 211 | } 212 | 213 | this.fraction = fraction; 214 | if (fraction == 0f) { 215 | state = MORE; 216 | } else if (fraction == 1f) { 217 | state = LESS; 218 | } else { 219 | state = INTERMEDIATE; 220 | } 221 | 222 | updateArrow(animate); 223 | } 224 | 225 | /** 226 | * Set duration of icon animation from state {@link #MORE} to state {@link #LESS} 227 | * 228 | * @param animationDuration 229 | */ 230 | public void setAnimationDuration(long animationDuration) { 231 | animationSpeed = DELTA_ALPHA / animationDuration; 232 | } 233 | 234 | @Override 235 | protected void onDraw(Canvas canvas) { 236 | super.onDraw(canvas); 237 | canvas.translate(0, centerTranslation); 238 | canvas.drawPath(path, paint); 239 | } 240 | 241 | @Override 242 | protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { 243 | super.onSizeChanged(width, height, oldWidth, oldHeight); 244 | calculateArrowMetrics(width, height); 245 | updateArrowPath(); 246 | } 247 | 248 | private void calculateArrowMetrics(int width, int height) { 249 | final int arrowMaxWidth = (height >= width ? width : height); 250 | if (useDefaultPadding) { 251 | padding = (int) (PADDING_PROPORTION * arrowMaxWidth); 252 | } 253 | final int arrowWidth = arrowMaxWidth - 2 * padding; 254 | float thickness = (int) (arrowWidth * THICKNESS_PROPORTION); 255 | paint.setStrokeWidth(thickness); 256 | 257 | center.set(width / 2, height / 2); 258 | left.set(center.x - arrowWidth / 2, center.y); 259 | right.set(center.x + arrowWidth / 2, center.y); 260 | } 261 | 262 | private void updateArrow(boolean animate) { 263 | float toAlpha = MORE_STATE_ALPHA + (fraction * DELTA_ALPHA); 264 | if (animate) { 265 | animateArrow(toAlpha); 266 | } else { 267 | cancelAnimation(); 268 | alpha = toAlpha; 269 | if (switchColor) { 270 | updateColor(new ArgbEvaluator()); 271 | } 272 | updateArrowPath(); 273 | invalidate(); 274 | } 275 | } 276 | 277 | private void updateArrowPath() { 278 | path.reset(); 279 | if (left != null && right != null) { 280 | rotate(left, -alpha, tempLeft); 281 | rotate(right, alpha, tempRight); 282 | centerTranslation = (center.y - tempLeft.y) / 2; 283 | path.moveTo(tempLeft.x, tempLeft.y); 284 | path.lineTo(center.x, center.y); 285 | path.lineTo(tempRight.x, tempRight.y); 286 | } 287 | } 288 | 289 | private void animateArrow(float toAlpha) { 290 | cancelAnimation(); 291 | 292 | final ValueAnimator valueAnimator = ValueAnimator.ofFloat(alpha, toAlpha); 293 | valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 294 | private final ArgbEvaluator colorEvaluator = new ArgbEvaluator(); 295 | 296 | @Override 297 | public void onAnimationUpdate(ValueAnimator valueAnimator) { 298 | alpha = (float) valueAnimator.getAnimatedValue(); 299 | updateArrowPath(); 300 | if (switchColor) { 301 | updateColor(colorEvaluator); 302 | } 303 | postInvalidateOnAnimationCompat(); 304 | } 305 | }); 306 | valueAnimator.setInterpolator(new DecelerateInterpolator()); 307 | valueAnimator.setDuration(calculateAnimationDuration(toAlpha)); 308 | valueAnimator.start(); 309 | 310 | arrowAnimator = valueAnimator; 311 | } 312 | 313 | private void cancelAnimation() { 314 | if (arrowAnimator != null && arrowAnimator.isRunning()) { 315 | arrowAnimator.cancel(); 316 | } 317 | } 318 | 319 | private void updateColor(@NonNull ArgbEvaluator colorEvaluator) { 320 | float fraction; 321 | int colorFrom; 322 | int colorTo; 323 | if (colorIntermediate != -1) { 324 | colorFrom = alpha <= 0f ? colorMore : colorIntermediate; 325 | colorTo = alpha <= 0f ? colorIntermediate : colorLess; 326 | fraction = alpha <= 0 ? (1 + alpha / 45f) : alpha / 45f; 327 | } else { 328 | colorFrom = colorMore; 329 | colorTo = colorLess; 330 | fraction = (alpha + 45f) / 90f; 331 | } 332 | color = (int) colorEvaluator.evaluate(fraction, colorFrom, colorTo); 333 | paint.setColor(color); 334 | } 335 | 336 | private long calculateAnimationDuration(float toAlpha) { 337 | return (long) (Math.abs(toAlpha - alpha) / animationSpeed); 338 | } 339 | 340 | private void rotate(@NonNull Point startPosition, double degrees, @NonNull Point target) { 341 | double angle = Math.toRadians(degrees); 342 | int x = (int) (center.x + (startPosition.x - center.x) * Math.cos(angle) - 343 | (startPosition.y - center.y) * Math.sin(angle)); 344 | 345 | int y = (int) (center.y + (startPosition.x - center.x) * Math.sin(angle) + 346 | (startPosition.y - center.y) * Math.cos(angle)); 347 | 348 | target.set(x, y); 349 | } 350 | 351 | @State 352 | private int getFinalStateByFraction() { 353 | if (fraction <= .5f) { 354 | return MORE; 355 | } else { 356 | return LESS; 357 | } 358 | } 359 | 360 | private void postInvalidateOnAnimationCompat() { 361 | final long fakeFrameTime = 10; 362 | if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { 363 | postInvalidateOnAnimation(); 364 | } else { 365 | postInvalidateDelayed(fakeFrameTime); 366 | } 367 | } 368 | } 369 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/java/com/shrikanthravi/collapsiblecalendarview/view/LockScrollView.kt: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview.view 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.util.AttributeSet 6 | import android.view.MotionEvent 7 | import android.widget.ScrollView 8 | 9 | /** 10 | * Created by shrikanthravi on 07/03/18. 11 | */ 12 | 13 | class LockScrollView : ScrollView { 14 | constructor(context: Context) : super(context) {} 15 | constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {} 16 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {} 17 | var swipeTouchListener: OnSwipeTouchListener? = null 18 | fun setParams(swipeTouchListener: OnSwipeTouchListener){ 19 | this.swipeTouchListener = swipeTouchListener 20 | } 21 | 22 | override fun onInterceptTouchEvent(ev: MotionEvent): Boolean { 23 | swipeTouchListener?.onTouch(this, ev).let { 24 | if(it==null){ 25 | return false; 26 | } 27 | else { 28 | return it 29 | } 30 | } 31 | } 32 | 33 | @SuppressLint("ClickableViewAccessibility") 34 | override fun onTouchEvent(ev: MotionEvent): Boolean { 35 | super.onTouchEvent(ev) 36 | return true 37 | } 38 | } -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/java/com/shrikanthravi/collapsiblecalendarview/view/SwipeTouchListener.kt: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview.view 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.view.GestureDetector 6 | import android.view.GestureDetector.SimpleOnGestureListener 7 | import android.view.MotionEvent 8 | import android.view.View 9 | import android.view.View.OnTouchListener 10 | 11 | abstract class OnSwipeTouchListener(ctx: Context) : OnTouchListener { 12 | 13 | private val gestureDetector: GestureDetector 14 | 15 | init { 16 | gestureDetector = GestureDetector(ctx, GestureListener()) 17 | } 18 | 19 | @SuppressLint("ClickableViewAccessibility") 20 | override fun onTouch(v: View, event: MotionEvent): Boolean { 21 | return gestureDetector.onTouchEvent(event) 22 | } 23 | 24 | private inner class GestureListener : SimpleOnGestureListener() { 25 | 26 | override fun onDown(e: MotionEvent): Boolean { 27 | return false 28 | } 29 | 30 | override fun onFling(e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean { 31 | var result = false 32 | try { 33 | val diffY = e2.y - e1.y 34 | val diffX = e2.x - e1.x 35 | if (Math.abs(diffX) > Math.abs(diffY)) { 36 | if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) { 37 | if (diffX > 0) { 38 | onSwipeRight() 39 | } else { 40 | onSwipeLeft() 41 | } 42 | result = true 43 | } 44 | } else if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) { 45 | if (diffY > 0) { 46 | onSwipeBottom() 47 | } else { 48 | onSwipeTop() 49 | } 50 | result = true 51 | } 52 | } catch (exception: Exception) { 53 | exception.printStackTrace() 54 | } 55 | 56 | return result 57 | } 58 | 59 | } 60 | 61 | companion object { 62 | 63 | private val SWIPE_THRESHOLD = 100 64 | private val SWIPE_VELOCITY_THRESHOLD = 100 65 | } 66 | 67 | abstract fun onSwipeRight() 68 | 69 | abstract fun onSwipeLeft() 70 | 71 | abstract fun onSwipeTop() 72 | 73 | abstract fun onSwipeBottom() 74 | } -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/java/com/shrikanthravi/collapsiblecalendarview/widget/CollapsibleCalendar.kt: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview.widget 2 | 3 | /** 4 | * Created by shrikanthravi on 07/03/18. 5 | */ 6 | 7 | 8 | import android.content.Context 9 | import android.graphics.Color 10 | import android.os.Handler 11 | import android.util.AttributeSet 12 | import android.view.View 13 | import android.view.ViewGroup 14 | import android.view.animation.Animation 15 | import android.view.animation.AnimationUtils 16 | import android.view.animation.Transformation 17 | import android.widget.LinearLayout 18 | import android.widget.TableLayout 19 | import android.widget.TableRow 20 | import android.widget.TextView 21 | import com.shrikanthravi.collapsiblecalendarview.R 22 | import com.shrikanthravi.collapsiblecalendarview.data.CalendarAdapter 23 | import com.shrikanthravi.collapsiblecalendarview.data.Day 24 | import com.shrikanthravi.collapsiblecalendarview.data.Event 25 | import com.shrikanthravi.collapsiblecalendarview.view.BounceAnimator 26 | import com.shrikanthravi.collapsiblecalendarview.view.ExpandIconView 27 | import java.text.DateFormatSymbols 28 | import java.text.SimpleDateFormat 29 | import java.util.* 30 | 31 | 32 | class CollapsibleCalendar : UICalendar, View.OnClickListener { 33 | override fun changeToToday() { 34 | val calendar = Calendar.getInstance() 35 | val calenderAdapter = CalendarAdapter(context, calendar); 36 | calenderAdapter.mEventList = mAdapter!!.mEventList 37 | calenderAdapter.setFirstDayOfWeek(firstDayOfWeek) 38 | val today = GregorianCalendar() 39 | this.selectedItem = null 40 | this.selectedItemPosition = -1 41 | this.selectedDay = Day(today.get(Calendar.YEAR), today.get(Calendar.MONTH), today.get(Calendar.DAY_OF_MONTH)) 42 | mCurrentWeekIndex = suitableRowIndex 43 | setAdapter(calenderAdapter) 44 | } 45 | 46 | override fun onClick(view: View?) { 47 | view?.let { 48 | mListener.let { mListener -> 49 | if (mListener == null) { 50 | expandIconView.performClick() 51 | } else { 52 | mListener.onClickListener() 53 | } 54 | } 55 | } 56 | } 57 | 58 | private var mAdapter: CalendarAdapter? = null 59 | private var mListener: CalendarListener? = null 60 | 61 | var expanded = false 62 | 63 | private var mInitHeight = 0 64 | 65 | private val mHandler = Handler() 66 | private var mIsWaitingForUpdate = false 67 | 68 | private var mCurrentWeekIndex: Int = 0 69 | 70 | private val suitableRowIndex: Int 71 | get() { 72 | if (selectedItemPosition != -1) { 73 | val view = mAdapter!!.getView(selectedItemPosition) 74 | val row = view.parent as TableRow 75 | 76 | return mTableBody.indexOfChild(row) 77 | } else if (todayItemPosition != -1) { 78 | val view = mAdapter!!.getView(todayItemPosition) 79 | val row = view.parent as TableRow 80 | 81 | return mTableBody.indexOfChild(row) 82 | } else { 83 | return 0 84 | } 85 | } 86 | 87 | val year: Int 88 | get() = mAdapter!!.calendar.get(Calendar.YEAR) 89 | 90 | val month: Int 91 | get() = mAdapter!!.calendar.get(Calendar.MONTH) 92 | 93 | /** 94 | * The date has been selected and can be used on Calender Listener 95 | */ 96 | var selectedDay: Day? = null 97 | get() { 98 | if (selectedItem == null) { 99 | val cal = Calendar.getInstance() 100 | val day = cal.get(Calendar.DAY_OF_MONTH) 101 | val month = cal.get(Calendar.MONTH) 102 | val year = cal.get(Calendar.YEAR) 103 | return Day( 104 | year, 105 | month + 1, 106 | day) 107 | } 108 | return Day( 109 | selectedItem!!.year, 110 | selectedItem!!.month, 111 | selectedItem!!.day) 112 | } 113 | set(value: Day?) { 114 | field = value 115 | redraw() 116 | } 117 | 118 | var selectedItemPosition: Int = -1 119 | get() { 120 | var position = -1 121 | for (i in 0 until mAdapter!!.count) { 122 | val day = mAdapter!!.getItem(i) 123 | 124 | if (isSelectedDay(day)) { 125 | position = i 126 | break 127 | } 128 | } 129 | if (position == -1) { 130 | position = todayItemPosition 131 | } 132 | return position 133 | } 134 | 135 | val todayItemPosition: Int 136 | get() { 137 | var position = -1 138 | for (i in 0 until mAdapter!!.count) { 139 | val day = mAdapter!!.getItem(i) 140 | 141 | if (isToday(day)) { 142 | position = i 143 | break 144 | } 145 | } 146 | return position 147 | } 148 | 149 | override var state: Int 150 | get() = super.state 151 | set(state) { 152 | super.state = state 153 | if (state == STATE_COLLAPSED) { 154 | expanded = false 155 | } 156 | if (state == STATE_EXPANDED) { 157 | expanded = true 158 | } 159 | } 160 | 161 | constructor(context: Context) : super(context) { 162 | init(context) 163 | } 164 | 165 | constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { 166 | init(context) 167 | } 168 | 169 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { 170 | init(context) 171 | } 172 | 173 | protected fun init(context: Context) { 174 | 175 | 176 | val cal = Calendar.getInstance() 177 | val adapter = CalendarAdapter(context, cal) 178 | setAdapter(adapter) 179 | 180 | 181 | // bind events 182 | 183 | mBtnPrevMonth.setOnClickListener { prevMonth() } 184 | 185 | mBtnNextMonth.setOnClickListener { nextMonth() } 186 | 187 | mBtnPrevWeek.setOnClickListener { prevWeek() } 188 | 189 | mBtnNextWeek.setOnClickListener { nextWeek() } 190 | 191 | mTodayIcon.setOnClickListener { changeToToday() } 192 | 193 | expandIconView.setState(ExpandIconView.MORE, true) 194 | 195 | 196 | expandIconView.setOnClickListener { 197 | if (expanded) { 198 | collapse(400) 199 | } else { 200 | expand(400) 201 | } 202 | } 203 | 204 | this.post { collapseTo(mCurrentWeekIndex) } 205 | 206 | 207 | } 208 | 209 | override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { 210 | super.onMeasure(widthMeasureSpec, heightMeasureSpec) 211 | 212 | mInitHeight = mTableBody.measuredHeight 213 | 214 | if (mIsWaitingForUpdate) { 215 | redraw() 216 | mHandler.post { collapseTo(mCurrentWeekIndex) } 217 | mIsWaitingForUpdate = false 218 | if (mListener != null) { 219 | mListener!!.onDataUpdate() 220 | } 221 | } 222 | } 223 | 224 | override fun redraw() { 225 | // redraw all views of week 226 | val rowWeek = mTableHead.getChildAt(0) as TableRow? 227 | if (rowWeek != null) { 228 | for (i in 0 until rowWeek.childCount) { 229 | (rowWeek.getChildAt(i) as TextView).setTextColor(textColor) 230 | } 231 | } 232 | // redraw all views of day 233 | if (mAdapter != null) { 234 | for (i in 0 until mAdapter!!.count) { 235 | val day = mAdapter!!.getItem(i) 236 | val view = mAdapter!!.getView(i) 237 | val txtDay = view.findViewById(R.id.txt_day) as TextView 238 | txtDay.setBackgroundColor(Color.TRANSPARENT) 239 | txtDay.setTextColor(textColor) 240 | 241 | // set today's item 242 | if (isToday(day)) { 243 | txtDay.setBackgroundDrawable(todayItemBackgroundDrawable) 244 | txtDay.setTextColor(todayItemTextColor) 245 | } 246 | 247 | // set the selected item 248 | if (isSelectedDay(day)) { 249 | txtDay.setBackgroundDrawable(selectedItemBackgroundDrawable) 250 | txtDay.setTextColor(selectedItemTextColor) 251 | } 252 | } 253 | } 254 | } 255 | 256 | override fun reload() { 257 | mAdapter?.let { mAdapter -> 258 | mAdapter.refresh() 259 | val calendar = Calendar.getInstance() 260 | val tempDatePattern: String 261 | if (calendar.get(Calendar.YEAR) != mAdapter.calendar.get(Calendar.YEAR)) { 262 | tempDatePattern = "MMMM YYYY" 263 | } else { 264 | tempDatePattern = datePattern 265 | } 266 | // reset UI 267 | val dateFormat = SimpleDateFormat(tempDatePattern, getCurrentLocale(context)) 268 | dateFormat.timeZone = mAdapter.calendar.timeZone 269 | mTxtTitle.text = dateFormat.format(mAdapter.calendar.time) 270 | mTableHead.removeAllViews() 271 | mTableBody.removeAllViews() 272 | 273 | var rowCurrent: TableRow 274 | rowCurrent = TableRow(context) 275 | rowCurrent.layoutParams = TableLayout.LayoutParams( 276 | ViewGroup.LayoutParams.MATCH_PARENT, 277 | ViewGroup.LayoutParams.WRAP_CONTENT) 278 | for (i in 0..6) { 279 | val view = mInflater.inflate(R.layout.layout_day_of_week, null) 280 | val txtDayOfWeek = view.findViewById(R.id.txt_day_of_week) as TextView 281 | txtDayOfWeek.setText(DateFormatSymbols().getShortWeekdays()[(i + firstDayOfWeek) % 7 + 1]) 282 | view.layoutParams = TableRow.LayoutParams( 283 | 0, 284 | ViewGroup.LayoutParams.WRAP_CONTENT, 285 | 1f) 286 | rowCurrent.addView(view) 287 | } 288 | mTableHead.addView(rowCurrent) 289 | 290 | // set day view 291 | for (i in 0 until mAdapter.count) { 292 | 293 | if (i % 7 == 0) { 294 | rowCurrent = TableRow(context) 295 | rowCurrent.layoutParams = TableLayout.LayoutParams( 296 | ViewGroup.LayoutParams.MATCH_PARENT, 297 | ViewGroup.LayoutParams.WRAP_CONTENT) 298 | mTableBody.addView(rowCurrent) 299 | } 300 | val view = mAdapter.getView(i) 301 | view.layoutParams = TableRow.LayoutParams( 302 | 0, 303 | ViewGroup.LayoutParams.WRAP_CONTENT, 304 | 1f) 305 | params.let { params -> 306 | if (params != null && (mAdapter.getItem(i).diff < params.prevDays || mAdapter.getItem(i).diff > params.nextDaysBlocked)) { 307 | view.isClickable = false 308 | view.alpha = 0.3f 309 | } else { 310 | view.setOnClickListener { v -> onItemClicked(v, mAdapter.getItem(i)) } 311 | } 312 | } 313 | rowCurrent.addView(view) 314 | } 315 | 316 | redraw() 317 | mIsWaitingForUpdate = true 318 | } 319 | } 320 | 321 | fun onItemClicked(view: View, day: Day) { 322 | select(day) 323 | 324 | val cal = mAdapter!!.calendar 325 | 326 | val newYear = day.year 327 | val newMonth = day.month 328 | val oldYear = cal.get(Calendar.YEAR) 329 | val oldMonth = cal.get(Calendar.MONTH) 330 | if (newMonth != oldMonth) { 331 | cal.set(day.year, day.month, 1) 332 | 333 | if (newYear > oldYear || newMonth > oldMonth) { 334 | mCurrentWeekIndex = 0 335 | } 336 | if (newYear < oldYear || newMonth < oldMonth) { 337 | mCurrentWeekIndex = -1 338 | } 339 | if (mListener != null) { 340 | mListener!!.onMonthChange() 341 | } 342 | reload() 343 | } 344 | 345 | if (mListener != null) { 346 | mListener!!.onItemClick(view) 347 | } 348 | } 349 | 350 | // public methods 351 | fun setAdapter(adapter: CalendarAdapter) { 352 | mAdapter = adapter 353 | adapter.setFirstDayOfWeek(firstDayOfWeek) 354 | 355 | reload() 356 | 357 | // init week 358 | mCurrentWeekIndex = suitableRowIndex 359 | } 360 | 361 | fun addEventTag(numYear: Int, numMonth: Int, numDay: Int) { 362 | mAdapter!!.addEvent(Event(numYear, numMonth, numDay, eventColor)) 363 | 364 | reload() 365 | } 366 | 367 | fun addEventTag(numYear: Int, numMonth: Int, numDay: Int, color: Int) { 368 | mAdapter!!.addEvent(Event(numYear, numMonth, numDay, color)) 369 | 370 | 371 | reload() 372 | } 373 | 374 | fun prevMonth() { 375 | val cal = mAdapter!!.calendar 376 | params.let { 377 | if (it != null && (Calendar.getInstance().get(Calendar.YEAR) * 12 + Calendar.getInstance().get(Calendar.MONTH) + it.prevDays / 30) > (cal.get(Calendar.YEAR) * 12 + cal.get(Calendar.MONTH))) { 378 | val myAnim = AnimationUtils.loadAnimation(context, R.anim.bounce) 379 | val interpolator = BounceAnimator(0.1, 10.0) 380 | myAnim.setInterpolator(interpolator) 381 | mTableBody.startAnimation(myAnim) 382 | mTableHead.startAnimation(myAnim) 383 | return 384 | } 385 | if (cal.get(Calendar.MONTH) == cal.getActualMinimum(Calendar.MONTH)) { 386 | cal.set(cal.get(Calendar.YEAR) - 1, cal.getActualMaximum(Calendar.MONTH), 1) 387 | } else { 388 | cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) - 1) 389 | } 390 | reload() 391 | if (mListener != null) { 392 | mListener!!.onMonthChange() 393 | } 394 | } 395 | 396 | } 397 | 398 | fun nextMonth() { 399 | val cal = mAdapter!!.calendar 400 | params.let { 401 | if (it != null && (Calendar.getInstance().get(Calendar.YEAR) * 12 + Calendar.getInstance().get(Calendar.MONTH) + it.nextDaysBlocked / 30) < (cal.get(Calendar.YEAR) * 12 + cal.get(Calendar.MONTH))) { 402 | val myAnim = AnimationUtils.loadAnimation(context, R.anim.bounce) 403 | val interpolator = BounceAnimator(0.1, 10.0) 404 | myAnim.setInterpolator(interpolator) 405 | mTableBody.startAnimation(myAnim) 406 | mTableHead.startAnimation(myAnim) 407 | return 408 | } 409 | if (cal.get(Calendar.MONTH) == cal.getActualMaximum(Calendar.MONTH)) { 410 | cal.set(cal.get(Calendar.YEAR) + 1, cal.getActualMinimum(Calendar.MONTH), 1) 411 | } else { 412 | cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) + 1) 413 | } 414 | reload() 415 | if (mListener != null) { 416 | mListener!!.onMonthChange() 417 | } 418 | } 419 | } 420 | 421 | fun nextDay() { 422 | if (selectedItemPosition == mAdapter!!.count - 1) { 423 | nextMonth() 424 | mAdapter!!.getView(0).performClick() 425 | reload() 426 | mCurrentWeekIndex = 0 427 | collapseTo(mCurrentWeekIndex) 428 | } else { 429 | mAdapter!!.getView(selectedItemPosition + 1).performClick() 430 | if (((selectedItemPosition + 1 - mAdapter!!.calendar.firstDayOfWeek) / 7) > mCurrentWeekIndex) { 431 | nextWeek() 432 | } 433 | } 434 | mListener?.onDayChanged() 435 | } 436 | 437 | fun prevDay() { 438 | if (selectedItemPosition == 0) { 439 | prevMonth() 440 | mAdapter!!.getView(mAdapter!!.count - 1).performClick() 441 | reload() 442 | return; 443 | } else { 444 | mAdapter!!.getView(selectedItemPosition - 1).performClick() 445 | if (((selectedItemPosition - 1 + mAdapter!!.calendar.firstDayOfWeek) / 7) < mCurrentWeekIndex) { 446 | prevWeek() 447 | } 448 | } 449 | mListener?.onDayChanged() 450 | } 451 | 452 | fun prevWeek() { 453 | if (mCurrentWeekIndex - 1 < 0) { 454 | mCurrentWeekIndex = -1 455 | prevMonth() 456 | } else { 457 | mCurrentWeekIndex-- 458 | collapseTo(mCurrentWeekIndex) 459 | } 460 | } 461 | 462 | fun nextWeek() { 463 | if (mCurrentWeekIndex + 1 >= mTableBody.childCount) { 464 | mCurrentWeekIndex = 0 465 | nextMonth() 466 | } else { 467 | mCurrentWeekIndex++ 468 | collapseTo(mCurrentWeekIndex) 469 | } 470 | } 471 | 472 | fun isSelectedDay(day: Day?): Boolean { 473 | return (day != null 474 | && selectedItem != null 475 | && day.year == selectedItem!!.year 476 | && day.month == selectedItem!!.month 477 | && day.day == selectedItem!!.day) 478 | } 479 | 480 | fun isToday(day: Day?): Boolean { 481 | val todayCal = Calendar.getInstance() 482 | return (day != null 483 | && day.year == todayCal.get(Calendar.YEAR) 484 | && day.month == todayCal.get(Calendar.MONTH) 485 | && day.day == todayCal.get(Calendar.DAY_OF_MONTH)) 486 | } 487 | 488 | /** 489 | * collapse in milliseconds 490 | */ 491 | open fun collapse(duration: Int) { 492 | 493 | if (state == STATE_EXPANDED) { 494 | state = STATE_PROCESSING 495 | 496 | mLayoutBtnGroupMonth.visibility = View.GONE 497 | mLayoutBtnGroupWeek.visibility = View.VISIBLE 498 | mBtnPrevWeek.isClickable = false 499 | mBtnNextWeek.isClickable = false 500 | 501 | val index = suitableRowIndex 502 | mCurrentWeekIndex = index 503 | 504 | val currentHeight = mInitHeight 505 | val targetHeight = mTableBody.getChildAt(index).measuredHeight 506 | var tempHeight = 0 507 | for (i in 0 until index) { 508 | tempHeight += mTableBody.getChildAt(i).measuredHeight 509 | } 510 | val topHeight = tempHeight 511 | 512 | val anim = object : Animation() { 513 | override fun applyTransformation(interpolatedTime: Float, t: Transformation) { 514 | 515 | mScrollViewBody.layoutParams.height = if (interpolatedTime == 1f) 516 | targetHeight 517 | else 518 | currentHeight - ((currentHeight - targetHeight) * interpolatedTime).toInt() 519 | mScrollViewBody.requestLayout() 520 | 521 | if (mScrollViewBody.measuredHeight < topHeight + targetHeight) { 522 | val position = topHeight + targetHeight - mScrollViewBody.measuredHeight 523 | mScrollViewBody.smoothScrollTo(0, position) 524 | } 525 | 526 | if (interpolatedTime == 1f) { 527 | state = UICalendar.Companion.STATE_COLLAPSED 528 | 529 | mBtnPrevWeek.isClickable = true 530 | mBtnNextWeek.isClickable = true 531 | } 532 | } 533 | } 534 | anim.duration = duration.toLong() 535 | startAnimation(anim) 536 | } 537 | 538 | expandIconView.setState(ExpandIconView.MORE, true) 539 | reload() 540 | } 541 | 542 | private fun collapseTo(index: Int) { 543 | var index = index 544 | if (state == STATE_COLLAPSED) { 545 | if (index == -1) { 546 | index = mTableBody.childCount - 1 547 | } 548 | mCurrentWeekIndex = index 549 | 550 | val targetHeight = mTableBody.getChildAt(index).measuredHeight 551 | var tempHeight = 0 552 | for (i in 0 until index) { 553 | tempHeight += mTableBody.getChildAt(i).measuredHeight 554 | } 555 | val topHeight = tempHeight 556 | 557 | mScrollViewBody.layoutParams.height = targetHeight 558 | mScrollViewBody.requestLayout() 559 | 560 | mHandler.post { mScrollViewBody.smoothScrollTo(0, topHeight) } 561 | 562 | 563 | if (mListener != null) { 564 | mListener!!.onWeekChange(mCurrentWeekIndex) 565 | } 566 | } 567 | } 568 | 569 | fun expand(duration: Int) { 570 | if (state == STATE_COLLAPSED) { 571 | state = STATE_PROCESSING 572 | 573 | mLayoutBtnGroupMonth.visibility = View.VISIBLE 574 | mLayoutBtnGroupWeek.visibility = View.GONE 575 | mBtnPrevMonth.isClickable = false 576 | mBtnNextMonth.isClickable = false 577 | 578 | val currentHeight = mScrollViewBody.measuredHeight 579 | val targetHeight = mInitHeight 580 | 581 | val anim = object : Animation() { 582 | override fun applyTransformation(interpolatedTime: Float, t: Transformation) { 583 | 584 | mScrollViewBody.layoutParams.height = if (interpolatedTime == 1f) 585 | LinearLayout.LayoutParams.WRAP_CONTENT 586 | else 587 | currentHeight - ((currentHeight - targetHeight) * interpolatedTime).toInt() 588 | mScrollViewBody.requestLayout() 589 | 590 | if (interpolatedTime == 1f) { 591 | state = STATE_EXPANDED 592 | 593 | mBtnPrevMonth.isClickable = true 594 | mBtnNextMonth.isClickable = true 595 | } 596 | } 597 | } 598 | anim.duration = duration.toLong() 599 | startAnimation(anim) 600 | } 601 | 602 | expandIconView.setState(ExpandIconView.LESS, true) 603 | reload() 604 | } 605 | 606 | fun select(day: Day) { 607 | selectedItem = Day(day.year, day.month, day.day) 608 | 609 | redraw() 610 | 611 | if (mListener != null) { 612 | mListener!!.onDaySelect() 613 | } 614 | } 615 | 616 | fun setStateWithUpdateUI(state: Int) { 617 | this@CollapsibleCalendar.state = state 618 | 619 | if (state != state) { 620 | mIsWaitingForUpdate = true 621 | requestLayout() 622 | } 623 | } 624 | 625 | // callback 626 | fun setCalendarListener(listener: CalendarListener) { 627 | mListener = listener 628 | } 629 | 630 | interface CalendarListener { 631 | 632 | // triggered when a day is selected programmatically or clicked by user. 633 | fun onDaySelect() 634 | 635 | // triggered only when the views of day on calendar are clicked by user. 636 | fun onItemClick(v: View) 637 | 638 | // triggered when the data of calendar are updated by changing month or adding events. 639 | fun onDataUpdate() 640 | 641 | // triggered when the month are changed. 642 | fun onMonthChange() 643 | 644 | // triggered when the week position are changed. 645 | fun onWeekChange(position: Int) 646 | 647 | fun onClickListener() 648 | 649 | fun onDayChanged() 650 | } 651 | 652 | fun setExpandIconVisible(visible: Boolean) { 653 | if (visible) { 654 | expandIconView.visibility = View.VISIBLE 655 | } else { 656 | expandIconView.visibility = View.GONE 657 | } 658 | } 659 | 660 | data class Params(val prevDays: Int, val nextDaysBlocked: Int) 661 | 662 | var params: Params? = null 663 | set(value) { 664 | field = value 665 | } 666 | } 667 | 668 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/java/com/shrikanthravi/collapsiblecalendarview/widget/UICalendar.kt: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview.widget 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.content.res.TypedArray 6 | import android.graphics.Color 7 | import android.graphics.PorterDuff 8 | import android.util.AttributeSet 9 | import android.view.LayoutInflater 10 | import android.view.View 11 | import android.widget.* 12 | import androidx.constraintlayout.widget.ConstraintLayout 13 | import com.shrikanthravi.collapsiblecalendarview.R 14 | import com.shrikanthravi.collapsiblecalendarview.data.Day 15 | import com.shrikanthravi.collapsiblecalendarview.view.ExpandIconView 16 | import com.shrikanthravi.collapsiblecalendarview.view.LockScrollView 17 | import com.shrikanthravi.collapsiblecalendarview.view.OnSwipeTouchListener 18 | import java.util.* 19 | import android.os.Build 20 | 21 | 22 | 23 | @SuppressLint("ClickableViewAccessibility") 24 | abstract class UICalendar constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : ScrollView(context, attrs, defStyleAttr) { 25 | 26 | constructor(context: Context) : this(context, null, 0) 27 | constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0) 28 | 29 | protected var mInflater: LayoutInflater 30 | 31 | // UI 32 | protected var mLayoutRoot: LinearLayout 33 | protected var mTxtTitle: TextView 34 | protected var mTableHead: TableLayout 35 | protected var mScrollViewBody: LockScrollView 36 | protected var mTableBody: TableLayout 37 | protected var mLayoutBtnGroupMonth: RelativeLayout 38 | protected var mLayoutBtnGroupWeek: RelativeLayout 39 | protected var mBtnPrevMonth: ImageView 40 | protected var mBtnNextMonth: ImageView 41 | protected var mBtnPrevWeek: ImageView 42 | protected var mBtnNextWeek: ImageView 43 | protected var expandIconView: ExpandIconView 44 | protected var clEntireTextView: LinearLayout 45 | protected var mTodayIcon : ImageView 46 | var datePattern = "MMMM" 47 | set(value: String) { 48 | field = value 49 | 50 | } 51 | // Attributes 52 | var isShowWeek = true 53 | set(showWeek) { 54 | field = showWeek 55 | 56 | if (showWeek) { 57 | mTableHead.visibility = View.VISIBLE 58 | } else { 59 | mTableHead.visibility = View.GONE 60 | } 61 | } 62 | var firstDayOfWeek = SUNDAY 63 | set(firstDayOfWeek) { 64 | field = firstDayOfWeek 65 | reload() 66 | } 67 | var hideArrow = true 68 | set(value: Boolean) { 69 | field = value 70 | hideButton() 71 | } 72 | open var state = STATE_COLLAPSED 73 | set(state) { 74 | field = state 75 | 76 | if (this.state == STATE_EXPANDED) { 77 | mLayoutBtnGroupMonth.visibility = View.VISIBLE 78 | mLayoutBtnGroupWeek.visibility = View.GONE 79 | } 80 | if (this.state == STATE_COLLAPSED) { 81 | mLayoutBtnGroupMonth.visibility = View.GONE 82 | mLayoutBtnGroupWeek.visibility = View.VISIBLE 83 | } 84 | } 85 | 86 | var textColor = Color.BLACK 87 | set(textColor) { 88 | field = textColor 89 | redraw() 90 | 91 | mTxtTitle.setTextColor(this.textColor) 92 | } 93 | var primaryColor = Color.WHITE 94 | set(primaryColor) { 95 | field = primaryColor 96 | redraw() 97 | 98 | mLayoutRoot.setBackgroundColor(this.primaryColor) 99 | } 100 | 101 | var todayItemTextColor = Color.BLACK 102 | set(todayItemTextColor) { 103 | field = todayItemTextColor 104 | redraw() 105 | } 106 | var todayItemBackgroundDrawable = resources.getDrawable(R.drawable.circle_black_stroke_background) 107 | set(todayItemBackgroundDrawable) { 108 | field = todayItemBackgroundDrawable 109 | redraw() 110 | } 111 | var selectedItemTextColor = Color.WHITE 112 | set(selectedItemTextColor) { 113 | field = selectedItemTextColor 114 | redraw() 115 | } 116 | var selectedItemBackgroundDrawable = resources.getDrawable(R.drawable.circle_black_solid_background) 117 | set(selectedItemBackground) { 118 | field = selectedItemBackground 119 | redraw() 120 | } 121 | 122 | /** 123 | * This can be used to defined the left icon drawable other than predefined icon 124 | */ 125 | var buttonLeftDrawable = resources.getDrawable(R.drawable.left_icon) 126 | set(buttonLeftDrawable) { 127 | field = buttonLeftDrawable 128 | mBtnPrevMonth.setImageDrawable(buttonLeftDrawable) 129 | mBtnPrevWeek.setImageDrawable(buttonLeftDrawable) 130 | } 131 | 132 | /** 133 | * This can be used to set the drawable for the right icon, other than predefined icon 134 | */ 135 | var buttonRightDrawable = resources.getDrawable(R.drawable.right_icon) 136 | set(buttonRightDrawable) { 137 | field = buttonRightDrawable 138 | mBtnNextMonth.setImageDrawable(buttonRightDrawable) 139 | mBtnNextWeek.setImageDrawable(buttonRightDrawable) 140 | } 141 | 142 | var selectedItem: Day? = null 143 | 144 | private var mButtonLeftDrawableTintColor = Color.BLACK 145 | private var mButtonRightDrawableTintColor = Color.BLACK 146 | 147 | private var mExpandIconColor = Color.BLACK 148 | var eventColor = Color.BLACK 149 | private set(eventColor) { 150 | field = eventColor 151 | redraw() 152 | 153 | } 154 | 155 | fun getSwipe(context: Context): OnSwipeTouchListener { 156 | return object : OnSwipeTouchListener(context) { 157 | override fun onSwipeTop() { 158 | if (state == STATE_EXPANDED) 159 | expandIconView.performClick() 160 | } 161 | 162 | override fun onSwipeLeft() { 163 | if (state == STATE_COLLAPSED) { 164 | mBtnNextWeek.performClick() 165 | } else if (state == STATE_EXPANDED) { 166 | mBtnNextMonth.performClick() 167 | } 168 | } 169 | 170 | override fun onSwipeRight() { 171 | if (state == STATE_COLLAPSED) { 172 | mBtnPrevWeek.performClick() 173 | } else if (state == STATE_EXPANDED) { 174 | mBtnPrevMonth.performClick() 175 | } 176 | } 177 | 178 | override fun onSwipeBottom() { 179 | if (state == STATE_COLLAPSED) 180 | expandIconView.performClick() 181 | } 182 | } 183 | } 184 | 185 | fun getCurrentLocale(context: Context): Locale { 186 | return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 187 | context.resources.configuration.locales.get(0) 188 | } else { 189 | 190 | context.resources.configuration.locale 191 | } 192 | } 193 | 194 | init { 195 | mInflater = LayoutInflater.from(context) 196 | 197 | // load rootView from xml 198 | val rootView = mInflater.inflate(R.layout.widget_collapsible_calendarview, this, true) 199 | 200 | // init UI 201 | mLayoutRoot = rootView.findViewById(R.id.layout_root) 202 | mTxtTitle = rootView.findViewById(R.id.txt_title) 203 | mTodayIcon = rootView.findViewById(R.id.today_icon) 204 | mTableHead = rootView.findViewById(R.id.table_head) 205 | mTableBody = rootView.findViewById(R.id.table_body) 206 | mLayoutBtnGroupMonth = rootView.findViewById(R.id.layout_btn_group_month) 207 | mLayoutBtnGroupWeek = rootView.findViewById(R.id.layout_btn_group_week) 208 | mBtnPrevMonth = rootView.findViewById(R.id.btn_prev_month) 209 | mBtnNextMonth = rootView.findViewById(R.id.btn_next_month) 210 | mBtnPrevWeek = rootView.findViewById(R.id.btn_prev_week) 211 | mBtnNextWeek = rootView.findViewById(R.id.btn_next_week) 212 | mScrollViewBody = rootView.findViewById(R.id.scroll_view_body) 213 | expandIconView = rootView.findViewById(R.id.expandIcon) 214 | clEntireTextView = rootView.findViewById(R.id.cl_title) 215 | clEntireTextView.setOnTouchListener(View.OnTouchListener { view, motionEvent -> 216 | expandIconView.performClick() 217 | }) 218 | mLayoutRoot.setOnTouchListener(getSwipe(context)); 219 | mScrollViewBody.setOnTouchListener(getSwipe(context)) 220 | mScrollViewBody.setParams(getSwipe(context)) 221 | val attributes = context.theme.obtainStyledAttributes( 222 | attrs, R.styleable.UICalendar, defStyleAttr, 0) 223 | setAttributes(attributes) 224 | attributes.recycle() 225 | } 226 | 227 | protected abstract fun redraw() 228 | protected abstract fun reload() 229 | private fun hideButton() { 230 | mBtnNextWeek.visibility = View.GONE 231 | mBtnPrevWeek.visibility = View.GONE 232 | mBtnNextMonth.visibility = View.GONE 233 | mBtnPrevMonth.visibility = View.GONE 234 | } 235 | 236 | protected fun setAttributes(attrs: TypedArray) { 237 | // set attributes by the values from XML 238 | //setStyle(attrs.getInt(R.styleable.UICalendar_style, mStyle)); 239 | isShowWeek = attrs.getBoolean(R.styleable.UICalendar_showWeek, isShowWeek) 240 | firstDayOfWeek = attrs.getInt(R.styleable.UICalendar_firstDayOfWeek, firstDayOfWeek) 241 | hideArrow = attrs.getBoolean(R.styleable.UICalendar_hideArrows, hideArrow) 242 | datePattern = attrs.getString(R.styleable.UICalendar_datePattern).let { 243 | if (it == null) 244 | datePattern 245 | else { 246 | it 247 | } 248 | } 249 | state = attrs.getInt(R.styleable.UICalendar_state, state) 250 | 251 | textColor = attrs.getColor(R.styleable.UICalendar_textColor, textColor) 252 | primaryColor = attrs.getColor(R.styleable.UICalendar_primaryColor, primaryColor) 253 | 254 | eventColor = attrs.getColor(R.styleable.UICalendar_eventColor, eventColor) 255 | 256 | 257 | todayItemTextColor = attrs.getColor( 258 | R.styleable.UICalendar_todayItem_textColor, todayItemTextColor) 259 | var todayItemBackgroundDrawable = attrs.getDrawable(R.styleable.UICalendar_todayItem_background) 260 | if (todayItemBackgroundDrawable != null) { 261 | this.todayItemBackgroundDrawable = todayItemBackgroundDrawable 262 | } else { 263 | this.todayItemBackgroundDrawable = todayItemBackgroundDrawable 264 | } 265 | 266 | selectedItemTextColor = attrs.getColor( 267 | R.styleable.UICalendar_selectedItem_textColor, selectedItemTextColor) 268 | var selectedItemBackgroundDrawable = attrs.getDrawable(R.styleable.UICalendar_selectedItem_background) 269 | if (selectedItemBackgroundDrawable != null) { 270 | this.selectedItemBackgroundDrawable = selectedItemBackgroundDrawable 271 | } else { 272 | this.selectedItemBackgroundDrawable = selectedItemBackgroundDrawable 273 | } 274 | 275 | var buttonLeftDrawable = attrs.getDrawable(R.styleable.UICalendar_buttonLeft_drawable) 276 | if (buttonLeftDrawable != null) { 277 | buttonLeftDrawable = buttonLeftDrawable 278 | } else { 279 | buttonLeftDrawable = this.buttonLeftDrawable 280 | } 281 | 282 | var buttonRightDrawable = attrs.getDrawable(R.styleable.UICalendar_buttonRight_drawable) 283 | if (buttonRightDrawable != null) { 284 | buttonRightDrawable = buttonRightDrawable 285 | } else { 286 | buttonRightDrawable = this.buttonRightDrawable 287 | } 288 | 289 | setButtonLeftDrawableTintColor(attrs.getColor(R.styleable.UICalendar_buttonLeft_drawableTintColor, mButtonLeftDrawableTintColor)) 290 | setButtonRightDrawableTintColor(attrs.getColor(R.styleable.UICalendar_buttonRight_drawableTintColor, mButtonRightDrawableTintColor)) 291 | setExpandIconColor(attrs.getColor(R.styleable.UICalendar_expandIconColor, mExpandIconColor)) 292 | val selectedItem: Day? = null 293 | } 294 | 295 | fun setButtonLeftDrawableTintColor(color: Int) { 296 | this.mButtonLeftDrawableTintColor = color 297 | mBtnPrevMonth.drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP) 298 | mBtnPrevWeek.drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP) 299 | redraw() 300 | } 301 | 302 | fun setButtonRightDrawableTintColor(color: Int) { 303 | 304 | this.mButtonRightDrawableTintColor = color 305 | mBtnNextMonth.drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP) 306 | mBtnNextWeek.drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP) 307 | redraw() 308 | } 309 | 310 | fun setExpandIconColor(color: Int) { 311 | this.mExpandIconColor = color 312 | expandIconView.setColor(color) 313 | } 314 | 315 | abstract fun changeToToday() 316 | 317 | companion object { 318 | 319 | 320 | // Day of Week 321 | val SUNDAY = 0 322 | val MONDAY = 1 323 | val TUESDAY = 2 324 | val WEDNESDAY = 3 325 | val THURSDAY = 4 326 | val FRIDAY = 5 327 | val SATURDAY = 6 328 | // State 329 | val STATE_EXPANDED = 0 330 | val STATE_COLLAPSED = 1 331 | val STATE_PROCESSING = 2 332 | } 333 | 334 | 335 | } 336 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/anim/bounce.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-hdpi/dot_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-hdpi/dot_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-hdpi/down_arrow_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-hdpi/down_arrow_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-hdpi/left_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-hdpi/left_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-hdpi/right_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-hdpi/right_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-mdpi/dot_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-mdpi/dot_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-mdpi/down_arrow_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-mdpi/down_arrow_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-mdpi/left_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-mdpi/left_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-mdpi/right_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-mdpi/right_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-xhdpi/calender_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-xhdpi/calender_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-xhdpi/dot_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-xhdpi/dot_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-xhdpi/down_arrow_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-xhdpi/down_arrow_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-xhdpi/left_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-xhdpi/left_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-xhdpi/right_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-xhdpi/right_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-xxhdpi/dot_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-xxhdpi/dot_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-xxhdpi/down_arrow_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-xxhdpi/down_arrow_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-xxhdpi/left_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-xxhdpi/left_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable-xxhdpi/right_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/collapsiblecalendarview2/src/main/res/drawable-xxhdpi/right_icon.png -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable/circle_black_solid_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable/circle_black_stroke_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable/circle_white_solid_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable/circle_white_stroke_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/drawable/ic_calendar.xml: -------------------------------------------------------------------------------- 1 | 6 | 13 | 20 | 27 | 34 | 35 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/layout/day_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 26 | 27 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/layout/layout_day_of_week.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/layout/widget_collapsible_calendarview.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 16 | 17 | 25 | 26 | 34 | 35 | 36 | 37 | 42 | 43 | 51 | 52 | 60 | 61 | 62 | 67 | 68 | 83 | 84 | 97 | 101 | 111 | 112 | 113 | 114 | 118 | 119 | 120 | 125 | 126 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 36dp 6 | 36dp 7 | 8 | 9 | 24dp 10 | 24dp 11 | 120dp 12 | 1dp 13 | 14 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CollapsibleCalendarView 3 | 4 | MON 5 | TUE 6 | WED 7 | THU 8 | FRI 9 | SAT 10 | SUN 11 | 12 | -------------------------------------------------------------------------------- /collapsiblecalendarview2/src/test/java/com/shrikanthravi/collapsiblecalendarview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.shrikanthravi.collapsiblecalendarview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | android.enableJetifier=true 13 | android.useAndroidX=true 14 | org.gradle.jvmargs=-Xmx1536m 15 | 16 | # When configured, Gradle will run in incubating parallel mode. 17 | # This option should only be used with decoupled projects. More details, visit 18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 19 | # org.gradle.parallel=true 20 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shrikanth7698/Collapsible-Calendar-View-Android/0eecfda79ca3dfb526e7861d63c3dbfa3943e5a4/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 17 11:13:18 EDT 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':collapsiblecalendarview2' 2 | --------------------------------------------------------------------------------