├── .gitignore ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── DemoGif.gif ├── DemoGifTwo.gif ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── view │ │ └── calender │ │ └── horizontal │ │ └── umar │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── view │ │ │ └── calender │ │ │ └── horizontal │ │ │ └── umar │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable-v24 │ │ └── 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 │ └── view │ └── calender │ └── horizontal │ └── umar │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── horizontalcalendarview ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── view │ │ └── calender │ │ └── horizontal │ │ └── umar │ │ └── horizontalcalendarview │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── view │ │ │ └── calender │ │ │ └── horizontal │ │ │ └── umar │ │ │ └── horizontalcalendarview │ │ │ ├── CalAdapter.java │ │ │ ├── CallBack.java │ │ │ ├── DayDateMonthYearModel.java │ │ │ ├── HorizontalCalendarListener.java │ │ │ ├── HorizontalCalendarView.java │ │ │ ├── HorizontalPaginationScroller.java │ │ │ └── material │ │ │ └── MaterialCalAdapter.java │ └── res │ │ ├── drawable │ │ ├── background_selected_day.xml │ │ ├── currect_date_background.xml │ │ ├── date_picker_border.xml │ │ ├── ic_appointment_back.xml │ │ ├── ic_appointment_next.xml │ │ ├── ic_three_dots.xml │ │ └── selected_background.xml │ │ ├── layout │ │ ├── custom_calender_layout.xml │ │ ├── custom_day_layout.xml │ │ └── material_custom_day_layout.xml │ │ └── values │ │ ├── color.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── view │ └── calender │ └── horizontal │ └── umar │ └── horizontalcalendarview │ └── ExampleUnitTest.java ├── horizontalcalendarviewlibrary ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── view │ │ └── calender │ │ └── horizontal │ │ └── umar │ │ └── horizontalcalendarlibrary │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── view │ └── calender │ └── horizontal │ └── umar │ └── horizontalcalendarlibrary │ └── ExampleUnitTest.java ├── settings.gradle └── ss ├── DemoGif.gif ├── DemoGifTwo.gif └── material_ui.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/libraries 5 | /.idea/modules.xml 6 | /.idea/workspace.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybringback22/HorizontalCalendarView-Android-/69b8b95af50e5b3cf3d8c38d5ffe105274a08f39/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 22 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /DemoGif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybringback22/HorizontalCalendarView-Android-/69b8b95af50e5b3cf3d8c38d5ffe105274a08f39/DemoGif.gif -------------------------------------------------------------------------------- /DemoGifTwo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mybringback22/HorizontalCalendarView-Android-/69b8b95af50e5b3cf3d8c38d5ffe105274a08f39/DemoGifTwo.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 mybringback22 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 | # Horizontal Calendar View - Android 2 | Horizontal Calender View is android library. 3 | 4 | ## Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | ## Using Horizontal Calendar View 18 | ### XML 19 | 20 | Add the followling code to your XML file 21 | 22 | ```xml 23 | 27 | 28 | 29 | ``` 30 | 31 | ### Java 32 | 33 | Now you can get the referance of the HorizontalCalendarView in the kotlin 34 | 35 | ```kotlin 36 | val hcv = findViewById(R.id.horizontalcalendarview) 37 | hcv.setContext(this@MainActivity) 38 | ``` 39 | 40 | To hide the left right contorls you can use the following method 41 | 42 | ```kotlin 43 | hcv.showControls(false) 44 | ``` 45 | 46 | To turn on material style UI (third screenshot) 47 | 48 | ```kotlin 49 | hcv.setMaterialStyle(true) 50 | ``` 51 | 52 | To change week days namming from M, T, W, T, F, S, S to Mon, Tue, Wed, Th, Fri, Sat, Sun 53 | 54 | ```kotlin 55 | hcv.setWeekNameMode(CalAdapter.WeekNameMode.MEDIUM) 56 | ``` 57 | 58 | To change the color of the left and right control use the following 59 | 60 | ```kotlin 61 | hcv.setControlTint(R.color.colorAccent) 62 | ``` 63 | 64 | To change the background color of the Horizontal Calendar View use the following 65 | 66 | ```kotlin 67 | hcv.setBackgroundColor(resources.getColor(R.color.colorPrimary)) 68 | ``` 69 | 70 | To change the Text color of the Horizontal Calendar View use the following 71 | 72 | ```kotlin 73 | hcv.changeAccent(R.color.white) 74 | ``` 75 | 76 | ## Getting Swipe or Touch Feedback 77 | To get the feedback from the touches and swipes of Calender implement ` HorizontalCalendarListener ` activity or fragment 78 | ```kotlin 79 | class MainActivity : AppCompatActivity() , HorizontalCalendarListener { 80 | 81 | } 82 | 83 | ``` 84 | 85 | 86 | Overide the following method 87 | - updateMonthOnScroll 88 | - newDateSelected 89 | 90 | ### updateMonthOnScroll 91 | ```kotlin 92 | override fun updateMonthOnScroll(selectedDate: DayDateMonthYearModel?) { 93 | currentMonthTextView.text = ""+ selectedDate?.month + " " + selectedDate?.year 94 | } 95 | 96 | ``` 97 | 98 | ### newDateSelected 99 | ```kotlin 100 | override fun newDateSelected(selectedDate: DayDateMonthYearModel?) { 101 | Toast.makeText(CONTEXT ,selectedDate?.date +""+ selectedDate?.month + " " + selectedDate?.year , Toast.LENGTH_LONG).show() 102 | } 103 | 104 | ``` 105 | 106 | ## DayDateMonthYearModel 107 | 108 | `DayDateMonthYearModel` is a custom data class that is used in the library and is returned as the parameter the override method 109 | ```java 110 | public class DayDateMonthYearModel { 111 | public String date; 112 | public String month; 113 | public String year; 114 | public String day; 115 | public String monthNumeric; 116 | public Boolean isToday; 117 | } 118 | ``` 119 | 120 | ### Complete MainActivity.kt 121 | 122 | ```kotlin 123 | class MainActivity : AppCompatActivity() , HorizontalCalendarListener { 124 | 125 | 126 | 127 | lateinit var currentMonthTextView : TextView 128 | override fun onCreate(savedInstanceState: Bundle?) { 129 | super.onCreate(savedInstanceState) 130 | setContentView(R.layout.activity_main) 131 | currentMonthTextView = findViewById(R.id.month) 132 | val hcv = findViewById(R.id.horizontalcalendarview) 133 | hcv.setContext(this@MainActivity) 134 | hcv.setBackgroundColor(resources.getColor(R.color.colorPrimary)) 135 | hcv.showControls(false) 136 | hcv.setControlTint(R.color.colorAccent) 137 | hcv.changeAccent(R.color.white) 138 | } 139 | 140 | override fun updateMonthOnScroll(selectedDate: DayDateMonthYearModel?) { 141 | currentMonthTextView.text = ""+ selectedDate?.month + " " + selectedDate?.year 142 | 143 | } 144 | 145 | override fun newDateSelected(selectedDate: DayDateMonthYearModel?) { 146 | Toast.makeText(this@MainActivity ,selectedDate?.date +""+ selectedDate?.month + " " + selectedDate?.year , Toast.LENGTH_LONG).show() 147 | } 148 | 149 | } 150 | ``` 151 | 152 | 153 | ### Complete activity_main.xml 154 | ```xml 155 | 156 | 164 | 165 | 176 | 177 | 181 | 182 | 183 | 184 | 185 | ``` 186 | 187 | ## License 188 | MIT - License 189 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | android { 8 | compileSdkVersion 28 9 | defaultConfig { 10 | applicationId "com.view.calender.horizontal.umar" 11 | minSdkVersion 21 12 | targetSdkVersion 28 13 | versionCode 1 14 | versionName "1.0" 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 28 | implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' 29 | implementation 'com.android.support.constraint:constraint-layout:1.1.2' 30 | implementation project(':horizontalcalendarview') 31 | testImplementation 'junit:junit:4.12' 32 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 33 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 34 | } 35 | -------------------------------------------------------------------------------- /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/view/calender/horizontal/umar/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.view.calender.horizontal.umar 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.view.calender.horizontal.umar", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/view/calender/horizontal/umar/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.view.calender.horizontal.umar 2 | 3 | import android.os.Bundle 4 | import android.support.v7.app.AppCompatActivity 5 | import android.widget.Button 6 | import android.widget.TextView 7 | import android.widget.Toast 8 | import com.view.calender.horizontal.umar.horizontalcalendarview.CalAdapter 9 | import com.view.calender.horizontal.umar.horizontalcalendarview.DayDateMonthYearModel 10 | import com.view.calender.horizontal.umar.horizontalcalendarview.HorizontalCalendarListener 11 | import com.view.calender.horizontal.umar.horizontalcalendarview.HorizontalCalendarView 12 | 13 | class MainActivity : AppCompatActivity(), HorizontalCalendarListener { 14 | 15 | private lateinit var textView: TextView 16 | lateinit var button: Button 17 | private var controlsShown = true 18 | 19 | override fun onCreate(savedInstanceState: Bundle?) { 20 | super.onCreate(savedInstanceState) 21 | setContentView(R.layout.activity_main) 22 | textView = findViewById(R.id.month) 23 | button = findViewById(R.id.button) 24 | val hcv = findViewById(R.id.hcv) 25 | hcv.setContext(this@MainActivity) 26 | hcv.setBackgroundColor(resources.getColor(R.color.background)) 27 | hcv.setMaterialStyle(true) 28 | hcv.setWeekNameMode(CalAdapter.WeekNameMode.MEDIUM) 29 | hcv.showControls(false) 30 | hcv.setControlTint(R.color.colorAccent) 31 | hcv.changeAccent(R.color.text_color) 32 | 33 | button.setOnClickListener { 34 | if (controlsShown) { 35 | hcv.showControls(false) 36 | button.text = "Show Controls" 37 | } else { 38 | hcv.showControls(true) 39 | button.text = "Hide Controls" 40 | } 41 | controlsShown = !controlsShown 42 | } 43 | } 44 | 45 | override fun updateMonthOnScroll(selectedDate: DayDateMonthYearModel?) { 46 | val value = "" + selectedDate?.month + " " + selectedDate?.year 47 | textView.text = value 48 | 49 | } 50 | 51 | override fun newDateSelected(selectedDate: DayDateMonthYearModel?) { 52 | Toast.makeText(this@MainActivity, selectedDate?.date + "" + selectedDate?.month + " " + selectedDate?.year, Toast.LENGTH_LONG).show() 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /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 | 10 | 11 | 22 | 23 | 27 | 28 | 29 | 30 |