├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── libraries │ ├── animated_vector_drawable_23_4_0.xml │ ├── appcompat_v7_23_4_0.xml │ ├── design_23_4_0.xml │ ├── gson_2_6_2.xml │ ├── hamcrest_core_1_3.xml │ ├── junit_4_12.xml │ ├── recyclerview_v7_23_4_0.xml │ ├── support_annotations_23_4_0.xml │ ├── support_v4_23_4_0.xml │ └── support_vector_drawable_23_4_0.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml ├── vcs.xml └── workspace.xml ├── README.md ├── build.gradle ├── calendar ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── riontech │ │ └── calendar │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── riontech │ │ │ └── calendar │ │ │ ├── CalendarConstant.java │ │ │ ├── CustomCalendar.java │ │ │ ├── Singleton.java │ │ │ ├── adapter │ │ │ ├── CalendarDataAdapter.java │ │ │ ├── CalendarGridviewAdapter.java │ │ │ └── ViewPagerAdapter.java │ │ │ ├── dao │ │ │ ├── CalendarDecoratorDao.java │ │ │ ├── CalendarResponse.java │ │ │ ├── Event.java │ │ │ ├── EventData.java │ │ │ ├── SectionDataViewHolder.java │ │ │ ├── SectionTitleViewHolder.java │ │ │ └── dataAboutDate.java │ │ │ ├── fragment │ │ │ └── CalendarFragment.java │ │ │ └── utils │ │ │ └── CalendarUtils.java │ └── res │ │ ├── drawable-hdpi │ │ ├── ic_add.png │ │ ├── ic_arrow_left.png │ │ └── ic_arrow_right.png │ │ ├── drawable-land │ │ ├── circle_decorator.xml │ │ ├── circle_decorator_white.xml │ │ ├── circle_shape.xml │ │ ├── circle_shape_selected.xml │ │ ├── ic_cont_failed.png │ │ └── list_item_background.xml │ │ ├── drawable-mdpi │ │ ├── ic_add.png │ │ ├── ic_arrow_left.png │ │ └── ic_arrow_right.png │ │ ├── drawable-xhdpi │ │ ├── ic_add.png │ │ ├── ic_arrow_left.png │ │ └── ic_arrow_right.png │ │ ├── drawable-xxhdpi │ │ ├── ic_add.png │ │ ├── ic_arrow_left.png │ │ └── ic_arrow_right.png │ │ ├── drawable-xxxhdpi │ │ ├── ic_add.png │ │ ├── ic_arrow_left.png │ │ └── ic_arrow_right.png │ │ ├── drawable │ │ ├── circle_decorator.xml │ │ ├── circle_decorator_white.xml │ │ ├── circle_shape.xml │ │ ├── circle_shape_selected.xml │ │ ├── ic_cont_failed.png │ │ └── list_item_background.xml │ │ ├── layout-land │ │ └── layout_viewpager_recyclerview.xml │ │ ├── layout │ │ ├── calendar_item.xml │ │ ├── fragement.xml │ │ ├── layout_viewpager_recyclerview.xml │ │ ├── row_event_desc.xml │ │ └── row_event_header.xml │ │ └── values │ │ ├── attr.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── riontech │ └── calendar │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── sample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── riontech │ │ └── sample │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── riontech │ │ │ └── sample │ │ │ └── MainActivity.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── riontech │ └── sample │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | 38 | # Keystore files 39 | *.jks 40 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | CustomCalendar -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | -------------------------------------------------------------------------------- /.idea/libraries/animated_vector_drawable_23_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_23_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.idea/libraries/design_23_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/gson_2_6_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/recyclerview_v7_23_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_23_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_23_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/libraries/support_vector_drawable_23_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 26 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 53 | 54 | 55 | 56 | 57 | 1.8 58 | 59 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Custom Android Calendar 2 | 3 | ![gif](http://riontech.com/library/calendar/calendar.gif) 4 | 5 | #Usage 6 | --- 7 | Maven repo 8 | ``` 9 | maven { 10 | url "https://dl.bintray.com/riontech/maven" 11 | } 12 | ``` 13 | Add the dependency to your build.gradle. 14 | ``` 15 | dependencies { 16 | compile 'com.riontech:calendar:1.0' 17 | } 18 | ``` 19 | Add the indicator to your layout. 20 | 21 | ``` 22 | 30 | ``` 31 | 32 | Create object of CustomCalendar in your activity 33 | ``` 34 | private CustomCalendar customCalendar; 35 | ``` 36 | 37 | In your acitivty onCreate initialize the object and set eventDate with count. 38 | And add it to customCalendar object by using addAnEvent method. 39 | ``` 40 | @Override 41 | protected void onCreate(Bundle savedInstanceState) { 42 | super.onCreate(savedInstanceState); 43 | setContentView(R.layout.activity_main); 44 | customCalendar = (CustomCalendar) findViewById(R.id.customCalendar); 45 | 46 | String[] arr = {"2016-06-10", "2016-06-11", "2016-06-15", "2016-06-16", "2016-06-25"}; 47 | for (int i = 0; i < 5; i++) { 48 | int eventCount = 3; 49 | customCalendar.addAnEvent(arr[i], eventCount, getEventDataList(eventCount)); 50 | } 51 | } 52 | ``` 53 | 54 | # TODOs 55 | * Add Event with Plus button 56 | * Adding Reminders for Event, Birthday, etc 57 | * Awesome UI-UX 58 | 59 | Developed By 60 | --- 61 | * Keyur - 62 | * G+ [Keyur Ashra](https://plus.google.com/u/0/+KeyurAshra) 63 | * LinkedIn [Keyur Ashra](https://www.linkedin.com/in/keyurashra) 64 | 65 | License 66 | --- 67 | 68 | Copyright 2016 Riontech 69 | 70 | Licensed under the Apache License, Version 2.0 (the "License"); 71 | you may not use this file except in compliance with the License. 72 | You may obtain a copy of the License at 73 | 74 | http://www.apache.org/licenses/LICENSE-2.0 75 | 76 | Unless required by applicable law or agreed to in writing, software 77 | distributed under the License is distributed on an "AS IS" BASIS, 78 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 79 | See the License for the specific language governing permissions and 80 | limitations under the License. 81 | 82 | 83 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.1.2' 9 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4' 10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | jcenter() 20 | } 21 | } 22 | 23 | task clean(type: Delete) { 24 | delete rootProject.buildDir 25 | } 26 | -------------------------------------------------------------------------------- /calendar/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /calendar/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.3" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 23 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | testCompile 'junit:junit:4.12' 24 | compile 'com.android.support:appcompat-v7:23.4.0' 25 | compile 'com.android.support:recyclerview-v7:23.4.0' 26 | compile 'com.google.code.gson:gson:2.6.2' 27 | compile 'com.android.support:design:23.4.0' 28 | } 29 | 30 | 31 | ext { 32 | bintrayRepo = 'maven' 33 | bintrayName = 'CustomCalendar' 34 | 35 | publishedGroupId = 'com.riontech' 36 | libraryName = 'Custom Calendar' 37 | artifact = 'calendar' 38 | 39 | libraryDescription = 'Custom calendar library for Android' 40 | 41 | siteUrl = 'https://github.com/Riontech/CustomCalendar' 42 | gitUrl = 'https://github.com/Riontech/CustomCalendar.git' 43 | 44 | libraryVersion = '1.0' 45 | 46 | developerId = 'riontech' 47 | developerName = 'Keyur Ashra' 48 | developerEmail = 'keyuraashra@gmail.com' 49 | 50 | licenseName = 'The Apache Software License, Version 2.0' 51 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 52 | allLicenses = ["Apache-2.0"] 53 | } 54 | 55 | // Place it at the end of the file 56 | apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' 57 | apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle' 58 | 59 | 60 | -------------------------------------------------------------------------------- /calendar/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /calendar/src/androidTest/java/com/riontech/calendar/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /calendar/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/CalendarConstant.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar; 2 | 3 | /** 4 | * Created by Dhaval Soneji on 25/5/16. 5 | */ 6 | public class CalendarConstant { 7 | 8 | public static final String PREFERENCE_NAME = "com.calendarlibrary"; 9 | public static final String EVENT = PREFERENCE_NAME + "event"; 10 | } 11 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/CustomCalendar.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.content.res.Configuration; 6 | import android.content.res.TypedArray; 7 | import android.os.Build; 8 | import android.support.v4.app.FragmentActivity; 9 | import android.support.v4.app.FragmentManager; 10 | import android.support.v4.view.ViewPager; 11 | import android.support.v7.widget.LinearLayoutManager; 12 | import android.support.v7.widget.RecyclerView; 13 | import android.util.AttributeSet; 14 | import android.util.Log; 15 | import android.view.LayoutInflater; 16 | import android.view.View; 17 | import android.widget.ImageView; 18 | import android.widget.LinearLayout; 19 | import android.widget.TextView; 20 | 21 | import com.riontech.calendar.adapter.CalendarDataAdapter; 22 | import com.riontech.calendar.adapter.ViewPagerAdapter; 23 | import com.riontech.calendar.dao.Event; 24 | import com.riontech.calendar.dao.EventData; 25 | import com.riontech.calendar.fragment.CalendarFragment; 26 | import com.riontech.calendar.utils.CalendarUtils; 27 | import com.riontech.calendar.R; 28 | 29 | import java.text.ParseException; 30 | import java.text.SimpleDateFormat; 31 | import java.util.ArrayList; 32 | import java.util.Calendar; 33 | import java.util.Date; 34 | import java.util.GregorianCalendar; 35 | 36 | /** 37 | * Created by Dhaval Soneji on 2/6/16. 38 | */ 39 | public class CustomCalendar extends LinearLayout { 40 | private static final String TAG = CustomCalendar.class.getSimpleName(); 41 | private String mStartMonth; 42 | private String mEndMonth; 43 | private ViewPager mViewPager; 44 | private ViewPagerAdapter mAdapter; 45 | private int mTotalMonthCount; 46 | private int mDuplicateTotalMonthCount; 47 | private int mCurrentPosition; 48 | private RecyclerView mRvCalendar; 49 | private LinearLayoutManager mLinearLayoutManager; 50 | private TextView mTxtEventMessage; 51 | private TextView mTxtFailed; 52 | private ImageView mImgFailed; 53 | private ArrayList mEventList; 54 | private boolean isValidAttr = true; 55 | 56 | private Context mContext; 57 | private AttributeSet mAttributeSet = null; 58 | 59 | public CustomCalendar(Context context) { 60 | super(context); 61 | LayoutInflater.from(context).inflate(R.layout.layout_viewpager_recyclerview, this); 62 | Calendar calendar = Calendar.getInstance(); 63 | mStartMonth = "1, " + String.valueOf(calendar.get(Calendar.YEAR)); 64 | mEndMonth = "12, " + String.valueOf(calendar.get(Calendar.YEAR)); 65 | mContext = context; 66 | initViews(); 67 | } 68 | 69 | public CustomCalendar(Context context, AttributeSet attrs) { 70 | super(context, attrs); 71 | LayoutInflater.from(context).inflate(R.layout.layout_viewpager_recyclerview, this); 72 | mContext = context; 73 | mAttributeSet = attrs; 74 | initViews(); 75 | } 76 | 77 | public CustomCalendar(Context context, AttributeSet attrs, int defStyleAttr) { 78 | super(context, attrs, defStyleAttr); 79 | LayoutInflater.from(context).inflate(R.layout.layout_viewpager_recyclerview, this); 80 | mContext = context; 81 | mAttributeSet = attrs; 82 | initViews(); 83 | } 84 | 85 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 86 | public CustomCalendar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 87 | super(context, attrs, defStyleAttr, defStyleRes); 88 | LayoutInflater.from(context).inflate(R.layout.layout_viewpager_recyclerview, this); 89 | this.mContext = context; 90 | this.mAttributeSet = attrs; 91 | initViews(); 92 | } 93 | 94 | private void initViews() { 95 | if (mAttributeSet != null) { 96 | TypedArray a = mContext.getTheme().obtainStyledAttributes(mAttributeSet, 97 | R.styleable.CustomCalendar, 0, 0); 98 | try { 99 | String startMonth = a.getString(R.styleable.CustomCalendar_startMonth); 100 | String startYear = a.getString(R.styleable.CustomCalendar_startYear); 101 | String endMonth = a.getString(R.styleable.CustomCalendar_endMonth); 102 | String endYear = a.getString(R.styleable.CustomCalendar_endYear); 103 | 104 | validateAttributes(startMonth, startYear, endMonth, endYear); 105 | 106 | mStartMonth = startMonth + ", " + startYear; 107 | mEndMonth = endMonth + ", " + endYear; 108 | } finally { 109 | a.recycle(); 110 | } 111 | } 112 | mViewPager = (ViewPager) findViewById(R.id.viewPager); 113 | mTxtEventMessage = (TextView) findViewById(R.id.txtEventMessage); 114 | mImgFailed = (ImageView) findViewById(R.id.imgFailed); 115 | mTxtFailed = (TextView) findViewById(R.id.txtCalendarMessage); 116 | mRvCalendar = (RecyclerView) findViewById(R.id.rvCalendar); 117 | 118 | if (!isValidAttr) { 119 | invalidAttributes(getResources().getString(R.string.invalid_attribute)); 120 | return; 121 | } 122 | 123 | /* 124 | first time setup calendar currentMonth 125 | */ 126 | Singleton.getInstance().setMonth((GregorianCalendar) GregorianCalendar.getInstance()); 127 | Singleton.getInstance().setCurrentDate( 128 | CalendarUtils.getCalendarDBFormat().format(Calendar.getInstance().getTime())); 129 | Singleton.getInstance().setTodayDate( 130 | CalendarUtils.getCalendarDBFormat().format(Calendar.getInstance().getTime())); 131 | 132 | mEventList = new ArrayList(); 133 | 134 | mLinearLayoutManager = new LinearLayoutManager(mContext); 135 | mRvCalendar.setLayoutManager(mLinearLayoutManager); 136 | Singleton.getInstance().setStartMonth(mStartMonth); 137 | Singleton.getInstance().setEndMonth(mEndMonth); 138 | 139 | setupCalendar(Singleton.getInstance().getStartMonth(), Singleton.getInstance().getEndMonth()); 140 | 141 | Singleton.getInstance().setEventManager(mEventList); 142 | } 143 | 144 | private void validateAttributes(String startMonth, String startYear, String endMonth, String endYear) { 145 | if (Integer.parseInt(startMonth) < 1 || Integer.parseInt(startMonth) > 12) { 146 | isValidAttr = false; 147 | } 148 | if (Integer.parseInt(endMonth) < 1 || Integer.parseInt(endMonth) > 12) { 149 | isValidAttr = false; 150 | } 151 | } 152 | 153 | private void invalidAttributes(String message) { 154 | mViewPager.setVisibility(GONE); 155 | mTxtEventMessage.setVisibility(GONE); 156 | mRvCalendar.setVisibility(GONE); 157 | mImgFailed.setVisibility(VISIBLE); 158 | mTxtFailed.setText(message); 159 | mTxtFailed.setVisibility(VISIBLE); 160 | } 161 | 162 | public void addAnEvent(String eventDate, int eventCount, ArrayList eventData) { 163 | if (!isValidAttr) 164 | return; 165 | 166 | Event date = new Event(); 167 | date.setDate(eventDate); 168 | date.setCount(String.valueOf(eventCount)); 169 | date.setEventData(eventData); 170 | 171 | mEventList.add(date); 172 | Singleton.getInstance().setEventManager(mEventList); 173 | } 174 | 175 | private void setupCalendar(String startMonth, String endMonth) { 176 | String temp[] = endMonth.split(","); 177 | int a = Integer.parseInt(temp[0]); 178 | String b = temp[1]; 179 | a = a + 1; 180 | mStartMonth = startMonth; 181 | mEndMonth = String.valueOf(a) + ", " + b; 182 | 183 | SimpleDateFormat sdf = new SimpleDateFormat("MM, yyyy"); 184 | Calendar currentCalendar = Calendar.getInstance(); 185 | Calendar startCalendar = Calendar.getInstance(); 186 | Calendar endCalendar = Calendar.getInstance(); 187 | 188 | Date startDate = null; 189 | Date endDate = null; 190 | 191 | try { 192 | 193 | startDate = sdf.parse(mStartMonth); 194 | endDate = sdf.parse(mEndMonth); 195 | startCalendar.setTime(startDate); 196 | endCalendar.setTime(endDate); 197 | } catch (ParseException e) { 198 | Log.e(TAG, e.getMessage(), e); 199 | } 200 | 201 | int diffYear = endCalendar.get(Calendar.YEAR) - startCalendar.get(Calendar.YEAR); 202 | mTotalMonthCount = diffYear * 12 + endCalendar.get(Calendar.MONTH) - startCalendar.get(Calendar.MONTH); 203 | mDuplicateTotalMonthCount = mTotalMonthCount; 204 | int diffCurrentYear = currentCalendar.get(Calendar.YEAR) - startCalendar.get(Calendar.YEAR); 205 | int diffCurrentMonth = diffCurrentYear * 12 + currentCalendar.get(Calendar.MONTH) - startCalendar.get(Calendar.MONTH); 206 | mCurrentPosition = diffCurrentMonth; 207 | 208 | FragmentActivity fragmentActivity = (FragmentActivity) mContext; 209 | FragmentManager fm = fragmentActivity.getSupportFragmentManager(); 210 | 211 | mAdapter = new ViewPagerAdapter(fm, mTotalMonthCount, this); 212 | mViewPager.setOffscreenPageLimit(1); 213 | mViewPager.setAdapter(mAdapter); 214 | 215 | mViewPager.setCurrentItem(diffCurrentMonth); 216 | mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { 217 | 218 | @Override 219 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 220 | } 221 | 222 | @Override 223 | public void onPageSelected(int position) { 224 | if (position <= mDuplicateTotalMonthCount && position >= 0) { 225 | if (position > mCurrentPosition) { 226 | Singleton.getInstance().setIsSwipeViewPager(1); 227 | 228 | ((CalendarFragment) mAdapter.getRegisteredFragment(position)).setNextMonth(); 229 | ((CalendarFragment) mAdapter.getRegisteredFragment(position)).refreshCalendar(); 230 | } else { 231 | Singleton.getInstance().setIsSwipeViewPager(0); 232 | 233 | ((CalendarFragment) mAdapter.getRegisteredFragment(position)).setPreviousMonth(); 234 | ((CalendarFragment) mAdapter.getRegisteredFragment(position)).refreshCalendar(); 235 | } 236 | mCurrentPosition = position; 237 | } 238 | } 239 | 240 | @Override 241 | public void onPageScrollStateChanged(int state) { 242 | 243 | } 244 | }); 245 | } 246 | 247 | /** 248 | * @param dateData 249 | */ 250 | public void setDateSelectionData(ArrayList dateData) { 251 | 252 | mRvCalendar.setVisibility(View.VISIBLE); 253 | mTxtEventMessage.setVisibility(View.GONE); 254 | mTxtEventMessage.setText(""); 255 | ArrayList items = new ArrayList<>(); 256 | items.clear(); 257 | if (dateData.size() > 0) { 258 | for (int i = 0; i < dateData.size(); i++) { 259 | if (dateData.get(i).getSection() != null && !dateData.get(i).getSection().isEmpty()) { 260 | if (dateData.get(i).getSection() instanceof String) { 261 | items.add(dateData.get(i).getSection()); 262 | } 263 | } 264 | if (dateData.size() > 0) { 265 | for (int j = 0; j < dateData.get(i).getData().size(); j++) { 266 | ArrayList list = new ArrayList<>(); 267 | 268 | if (dateData.get(i).getData().get(j).getRemarks() != null) 269 | list.add(dateData.get(i).getData().get(j).getRemarks()); 270 | else 271 | list.add(""); 272 | if (dateData.get(i).getData().get(j).getSubject() != null) 273 | list.add(dateData.get(i).getData().get(j).getSubject()); 274 | else 275 | list.add(""); 276 | if (dateData.get(i).getData().get(j).getSubmissionDate() != null) 277 | list.add(dateData.get(i).getData().get(j).getSubmissionDate()); 278 | else 279 | list.add(""); 280 | if (dateData.get(i).getData().get(j).getTitle() != null) 281 | list.add(dateData.get(i).getData().get(j).getTitle()); 282 | else 283 | list.add(""); 284 | items.add(list); 285 | } 286 | } 287 | } 288 | } 289 | if (items.size() == 0) { 290 | mRvCalendar.setVisibility(View.GONE); 291 | try { 292 | Date dateTemp = CalendarUtils.getCalendarDBFormat().parse(Singleton.getInstance().getCurrentDate()); 293 | mTxtEventMessage.setText(getResources().getString(R.string.no_events) + " (" + CalendarUtils.getCalendarDateFormat().format(dateTemp) + ")"); 294 | } catch (ParseException e) { 295 | Log.e(TAG, e.getMessage(), e); 296 | } 297 | mTxtEventMessage.setVisibility(View.VISIBLE); 298 | } else { 299 | mRvCalendar.setLayoutManager(mLinearLayoutManager); 300 | mRvCalendar.setAdapter(new CalendarDataAdapter(items)); 301 | } 302 | } 303 | 304 | @Override 305 | protected void onConfigurationChanged(Configuration newConfig) { 306 | super.onConfigurationChanged(newConfig); 307 | // Checks the orientation of the screen for landscape and portrait 308 | if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { 309 | Log.d(TAG, "screenOrientation: landscape"); 310 | } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { 311 | Log.d(TAG, "screenOrientation: portrait"); 312 | } 313 | } 314 | } 315 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/Singleton.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar; 2 | 3 | import com.riontech.calendar.dao.Event; 4 | 5 | import java.util.ArrayList; 6 | import java.util.GregorianCalendar; 7 | 8 | /** 9 | * Created by Dhaval Soneji on 3/6/16. 10 | */ 11 | public class Singleton { 12 | private final static String TAG = Singleton.class.getSimpleName(); 13 | private static Singleton mInstance = null; 14 | private GregorianCalendar mMonth; 15 | private String mCurrentDate; 16 | private String mTodayDate; 17 | private int mIsSwipeViewPager = 2; 18 | private String startMonth; 19 | private String endMonth; 20 | private ArrayList mEventManager; 21 | 22 | public Singleton() { 23 | 24 | } 25 | 26 | public static Singleton getInstance() { 27 | if (mInstance == null) { 28 | mInstance = new Singleton(); 29 | } 30 | return mInstance; 31 | } 32 | 33 | public GregorianCalendar getMonth() { 34 | return mMonth; 35 | } 36 | 37 | public void setMonth(GregorianCalendar month) { 38 | this.mMonth = month; 39 | } 40 | 41 | public String getCurrentDate() { 42 | return mCurrentDate; 43 | } 44 | 45 | public void setCurrentDate(String mCurrentDate) { 46 | this.mCurrentDate = mCurrentDate; 47 | } 48 | 49 | public String getTodayDate() { 50 | return mTodayDate; 51 | } 52 | 53 | public void setTodayDate(String mTodayDate) { 54 | this.mTodayDate = mTodayDate; 55 | } 56 | 57 | public int getIsSwipeViewPager() { 58 | return mIsSwipeViewPager; 59 | } 60 | 61 | public void setIsSwipeViewPager(int isSwipeViewPager) { 62 | this.mIsSwipeViewPager = isSwipeViewPager; 63 | } 64 | 65 | public String getStartMonth() { 66 | return startMonth; 67 | } 68 | 69 | public void setStartMonth(String startMonth) { 70 | this.startMonth = startMonth; 71 | } 72 | 73 | public String getEndMonth() { 74 | return endMonth; 75 | } 76 | 77 | public void setEndMonth(String endMonth) { 78 | this.endMonth = endMonth; 79 | } 80 | 81 | public ArrayList getEventManager() { 82 | return mEventManager; 83 | } 84 | 85 | public void setEventManager(ArrayList eventManagerList) { 86 | this.mEventManager = eventManagerList; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/adapter/CalendarDataAdapter.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.adapter; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.util.Log; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | import com.riontech.calendar.Singleton; 10 | import com.riontech.calendar.dao.SectionDataViewHolder; 11 | import com.riontech.calendar.dao.SectionTitleViewHolder; 12 | import com.riontech.calendar.utils.CalendarUtils; 13 | import com.riontech.calendar.R; 14 | 15 | import java.text.ParseException; 16 | import java.util.ArrayList; 17 | import java.util.Date; 18 | 19 | /** 20 | * Created by Dhaval Soneji on 4/4/16. 21 | */ 22 | public class CalendarDataAdapter extends RecyclerView 23 | .Adapter { 25 | private static final String TAG = CalendarDataAdapter.class.getSimpleName(); 26 | 27 | ArrayList mItems; 28 | private final int SECTION = 0, DATA = 1; 29 | 30 | public CalendarDataAdapter(ArrayList items) { 31 | this.mItems = items; 32 | } 33 | 34 | @Override 35 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { 36 | RecyclerView.ViewHolder viewHolder = null; 37 | LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext()); 38 | 39 | switch (viewType) { 40 | case SECTION: 41 | View viewSection = inflater.inflate(R.layout.row_event_header, viewGroup, false); 42 | viewHolder = new SectionTitleViewHolder(viewSection); 43 | break; 44 | 45 | case DATA: 46 | View viewData = inflater.inflate(R.layout.row_event_desc, viewGroup, false); 47 | viewHolder = new SectionDataViewHolder(viewData); 48 | break; 49 | } 50 | return viewHolder; 51 | } 52 | 53 | @Override 54 | public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { 55 | switch (viewHolder.getItemViewType()) { 56 | case SECTION: 57 | SectionTitleViewHolder vh1 = (SectionTitleViewHolder) viewHolder; 58 | configureViewHolderSectionTitle(vh1, position); 59 | break; 60 | 61 | case DATA: 62 | SectionDataViewHolder vh2 = (SectionDataViewHolder) viewHolder; 63 | configureViewHolderSectionData(vh2, position); 64 | break; 65 | } 66 | } 67 | 68 | private void configureViewHolderSectionData(SectionDataViewHolder vh2, int position) { 69 | ArrayList obj = (ArrayList) mItems.get(position); 70 | if (obj.get(0) != "") { 71 | vh2.getTxtRemark().setText(obj.get(0)); 72 | vh2.getTxtRemark().setVisibility(View.VISIBLE); 73 | } 74 | if (obj.get(1) != "") { 75 | vh2.getTxtSubject().setText(obj.get(1)); 76 | vh2.getTxtSubject().setVisibility(View.VISIBLE); 77 | } 78 | if (obj.get(2) != "") { 79 | 80 | try { 81 | Date dateTemp = CalendarUtils.getCalendarDBFormat().parse(obj.get(2).toString()); 82 | vh2.getTxtSubmissionDate().setText("Submission date: "+ CalendarUtils.getCalendarDateFormat().format(dateTemp)); 83 | 84 | } catch (ParseException e) { 85 | Log.e(TAG, e.getMessage(), e); 86 | } 87 | 88 | vh2.getTxtSubmissionDate().setVisibility(View.VISIBLE); 89 | } 90 | if (obj.get(3) != "") { 91 | vh2.getTxtTitle().setText(obj.get(3)); 92 | vh2.getTxtTitle().setVisibility(View.VISIBLE); 93 | } 94 | } 95 | 96 | private void configureViewHolderSectionTitle(SectionTitleViewHolder vh1, int position) { 97 | try { 98 | Date dateTemp = CalendarUtils.getCalendarDBFormat().parse(Singleton.getInstance().getCurrentDate()); 99 | if(position==0) { 100 | vh1.getTxtSection().setText(mItems.get(position).toString() + " (" + CalendarUtils.getCalendarDateFormat().format(dateTemp) + ")"); 101 | } 102 | else{ 103 | vh1.getTxtSection().setText(mItems.get(position).toString()); 104 | } 105 | 106 | } catch (ParseException e) { 107 | Log.e(TAG, e.getMessage(), e); 108 | } 109 | } 110 | 111 | @Override 112 | public int getItemCount() { 113 | return this.mItems.size(); 114 | } 115 | 116 | @Override 117 | public int getItemViewType(int position) { 118 | if (mItems.get(position) instanceof String) { 119 | return SECTION; 120 | } else if (mItems.get(position) instanceof ArrayList) { 121 | return DATA; 122 | } 123 | return -1; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/adapter/CalendarGridviewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.adapter; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.support.v4.content.ContextCompat; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.BaseAdapter; 10 | import android.widget.GridView; 11 | import android.widget.ImageView; 12 | import android.widget.TextView; 13 | 14 | import com.riontech.calendar.R; 15 | import com.riontech.calendar.Singleton; 16 | import com.riontech.calendar.dao.CalendarDecoratorDao; 17 | import com.riontech.calendar.fragment.CalendarFragment; 18 | 19 | import java.util.ArrayList; 20 | import java.util.GregorianCalendar; 21 | 22 | 23 | /** 24 | * Created By Dhaval Soneji 25 | */ 26 | public class CalendarGridviewAdapter extends BaseAdapter { 27 | private static final String TAG = CalendarGridviewAdapter.class.getSimpleName(); 28 | private Context mContext; 29 | public static int firstDay; 30 | 31 | private ArrayList mEventList; 32 | private View mPreviousView; 33 | 34 | public CalendarGridviewAdapter(Context c, ArrayList items, GregorianCalendar month) { 35 | this.mEventList = items; 36 | mContext = c; 37 | 38 | firstDay = month.get(GregorianCalendar.DAY_OF_WEEK); 39 | } 40 | 41 | public int getCount() { 42 | return mEventList.size(); 43 | } 44 | 45 | public CalendarDecoratorDao getItem(int position) { 46 | return mEventList.get(position); 47 | } 48 | 49 | public long getItemId(int position) { 50 | return position; 51 | } 52 | 53 | public View getView(int position, View convertView, ViewGroup parent) { 54 | 55 | CalendarGridViewHolder holder; 56 | 57 | if (convertView == null) { 58 | LayoutInflater vi = (LayoutInflater) mContext 59 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 60 | convertView = vi.inflate(R.layout.calendar_item, null); 61 | holder = new CalendarGridViewHolder(convertView); 62 | int dimen = mContext.getResources().getDimensionPixelSize(R.dimen.common_40_dp); 63 | GridView.LayoutParams pParams = new GridView.LayoutParams(dimen, dimen); 64 | convertView.setLayoutParams(pParams); 65 | convertView.setTag(holder); 66 | } else { 67 | holder = (CalendarGridViewHolder) convertView.getTag(); 68 | } 69 | 70 | // comment here 71 | CalendarDecoratorDao content = getItem(position); 72 | content.setPosition(position); 73 | holder.setDay(convertView, content); 74 | holder.setSelectedView(convertView, content); 75 | holder.bindDate(content); 76 | 77 | return convertView; 78 | } 79 | 80 | /** 81 | * @param view 82 | * @param selectedGridDate 83 | * @return 84 | */ 85 | public View setSelected(View view, String selectedGridDate) { 86 | if (mPreviousView != null) { 87 | mPreviousView.findViewById(R.id.llCalendarItem); 88 | mPreviousView.setBackgroundResource(R.drawable.list_item_background); 89 | 90 | TextView txt = (TextView) mPreviousView.findViewById(R.id.date); 91 | txt.setTextColor(Color.BLACK); 92 | 93 | ImageView img1 = (ImageView) mPreviousView.findViewById(R.id.date_icon); 94 | img1.setImageDrawable(ContextCompat.getDrawable(mPreviousView.getContext(), R.drawable.circle_decorator)); 95 | ImageView img2 = (ImageView) mPreviousView.findViewById(R.id.date_icon2); 96 | img2.setImageDrawable(ContextCompat.getDrawable(mPreviousView.getContext(), R.drawable.circle_decorator)); 97 | ImageView img3 = (ImageView) mPreviousView.findViewById(R.id.date_icon3); 98 | img3.setImageDrawable(ContextCompat.getDrawable(mPreviousView.getContext(), R.drawable.circle_decorator)); 99 | } 100 | 101 | mPreviousView = view; 102 | view.setBackgroundResource(R.drawable.circle_shape_selected); 103 | 104 | TextView txt = (TextView) view.findViewById(R.id.date); 105 | txt.setTextColor(Color.WHITE); 106 | 107 | ImageView img1 = (ImageView) view.findViewById(R.id.date_icon); 108 | img1.setImageDrawable(ContextCompat.getDrawable(view.getContext(), R.drawable.circle_decorator_white)); 109 | ImageView img2 = (ImageView) view.findViewById(R.id.date_icon2); 110 | img2.setImageDrawable(ContextCompat.getDrawable(view.getContext(), R.drawable.circle_decorator_white)); 111 | ImageView img3 = (ImageView) view.findViewById(R.id.date_icon3); 112 | img3.setImageDrawable(ContextCompat.getDrawable(view.getContext(), R.drawable.circle_decorator_white)); 113 | 114 | Singleton.getInstance().setCurrentDate(selectedGridDate); 115 | 116 | CalendarFragment.currentDateSelected = selectedGridDate; 117 | return view; 118 | } 119 | 120 | /** 121 | * 122 | */ 123 | 124 | class CalendarGridViewHolder { 125 | TextView dayView; 126 | ImageView imgDecorator1; 127 | ImageView imgDecorator2; 128 | ImageView imgDecorator3; 129 | 130 | /** 131 | * @param v 132 | */ 133 | public CalendarGridViewHolder(View v) { 134 | setLayoutParam(v); 135 | dayView = (TextView) v.findViewById(R.id.date); 136 | imgDecorator1 = (ImageView) v.findViewById(R.id.date_icon); 137 | imgDecorator2 = (ImageView) v.findViewById(R.id.date_icon2); 138 | imgDecorator3 = (ImageView) v.findViewById(R.id.date_icon3); 139 | } 140 | 141 | /** 142 | * @param view 143 | */ 144 | private void setLayoutParam(View view) { 145 | int dimen = mContext.getResources().getDimensionPixelSize(R.dimen.common_40_dp); 146 | GridView.LayoutParams pParams = new GridView.LayoutParams(dimen, dimen); 147 | view.setLayoutParams(pParams); 148 | } 149 | 150 | /** 151 | * @param view 152 | * @param content 153 | */ 154 | private void setDay(View view, CalendarDecoratorDao content) { 155 | String day = content.getDay(); 156 | view.setVisibility(View.VISIBLE); 157 | if ((Integer.parseInt(day) > 1) && (content.getPosition() < firstDay)) { 158 | view.setVisibility(View.INVISIBLE); 159 | } else if ((Integer.parseInt(day) < 7) && (content.getPosition() > 28)) { 160 | view.setVisibility(View.INVISIBLE); 161 | } else { 162 | dayView.setTextColor(Color.BLACK); 163 | } 164 | } 165 | 166 | /** 167 | * @param v 168 | * @param content 169 | */ 170 | public void setSelectedView(View v, CalendarDecoratorDao content) { 171 | String day = content.getDay(); 172 | 173 | if (content.getDate().equals(Singleton.getInstance().getCurrentDate())) { 174 | setSelected(v, Singleton.getInstance().getCurrentDate()); 175 | mPreviousView = v; 176 | } else { 177 | v.setBackgroundResource(R.drawable.list_item_background); 178 | if (content.getDate().equals(Singleton.getInstance().getTodayDate())) { 179 | TextView txtTodayDate = (TextView) v.findViewById(R.id.date); 180 | txtTodayDate.setTextColor(ContextCompat.getColor(v.getContext(), R.color.colorPrimary)); 181 | } 182 | } 183 | dayView.setText(day); 184 | } 185 | 186 | /** 187 | * @param content 188 | */ 189 | public void bindDate(CalendarDecoratorDao content) { 190 | String date = content.getDate(); 191 | if (date.length() == 1) { 192 | date = "0" + date; 193 | } 194 | 195 | setDecoratorVisibility(date, content); 196 | } 197 | 198 | /** 199 | * @param date 200 | * @param content 201 | */ 202 | private void setDecoratorVisibility(String date, CalendarDecoratorDao content) { 203 | if (date.length() > 0 && content.getCount() > 0) { 204 | switch (content.getCount()) { 205 | case 1: 206 | imgDecorator1.setVisibility(View.VISIBLE); 207 | imgDecorator2.setVisibility(View.GONE); 208 | imgDecorator3.setVisibility(View.GONE); 209 | break; 210 | case 2: 211 | imgDecorator1.setVisibility(View.VISIBLE); 212 | imgDecorator2.setVisibility(View.VISIBLE); 213 | imgDecorator3.setVisibility(View.GONE); 214 | break; 215 | case 3: 216 | imgDecorator1.setVisibility(View.VISIBLE); 217 | imgDecorator2.setVisibility(View.VISIBLE); 218 | imgDecorator3.setVisibility(View.VISIBLE); 219 | break; 220 | default: 221 | imgDecorator1.setVisibility(View.VISIBLE); 222 | imgDecorator2.setVisibility(View.VISIBLE); 223 | imgDecorator3.setVisibility(View.VISIBLE); 224 | break; 225 | } 226 | 227 | } else { 228 | imgDecorator1.setVisibility(View.INVISIBLE); 229 | imgDecorator2.setVisibility(View.INVISIBLE); 230 | imgDecorator3.setVisibility(View.INVISIBLE); 231 | } 232 | } 233 | } 234 | } -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/adapter/ViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import android.util.SparseArray; 7 | import android.view.ViewGroup; 8 | 9 | import com.riontech.calendar.CustomCalendar; 10 | import com.riontech.calendar.fragment.CalendarFragment; 11 | 12 | /** 13 | * Created by Dhaval Soneji on 31/3/16. 14 | */ 15 | public class ViewPagerAdapter extends FragmentPagerAdapter { 16 | private SparseArray registeredFragments = new SparseArray<>(); 17 | private int mCount; 18 | private static final String TAG = ViewPagerAdapter.class.getSimpleName(); 19 | private CustomCalendar mCalendar; 20 | 21 | 22 | public ViewPagerAdapter(FragmentManager fm, int count, CustomCalendar calendar) { 23 | super(fm); 24 | this.mCount = count; 25 | this.mCalendar = calendar; 26 | } 27 | 28 | @Override 29 | public Fragment getItem(int position) { 30 | return CalendarFragment.newInstance(mCalendar); 31 | } 32 | 33 | @Override 34 | public int getCount() { 35 | return this.mCount; 36 | } 37 | 38 | @Override 39 | public Object instantiateItem(ViewGroup container, int position) { 40 | Fragment fragment = (Fragment) super.instantiateItem(container, position); 41 | registeredFragments.put(position, fragment); 42 | return fragment; 43 | } 44 | 45 | @Override 46 | public void destroyItem(ViewGroup container, int position, Object object) { 47 | registeredFragments.remove(position); 48 | super.destroyItem(container, position, object); 49 | } 50 | 51 | public Fragment getRegisteredFragment(int position) { 52 | return registeredFragments.get(position); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/dao/CalendarDecoratorDao.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.dao; 2 | 3 | /** 4 | * Created by Dhaval Soneji on 28/3/16. 5 | */ 6 | public class CalendarDecoratorDao { 7 | private String date; 8 | private int count; 9 | private int position; 10 | 11 | public CalendarDecoratorDao(String date, int count) { 12 | this.date = date; 13 | this.count = count; 14 | } 15 | 16 | public String getDate() { 17 | return date; 18 | } 19 | 20 | public void setDate(String date) { 21 | this.date = date; 22 | } 23 | 24 | public int getCount() { 25 | return count; 26 | } 27 | 28 | public void setCount(int count) { 29 | this.count = count; 30 | } 31 | 32 | public void setPosition(int position) { 33 | this.position = position; 34 | } 35 | 36 | public int getPosition() { 37 | return position; 38 | } 39 | 40 | public String getDay() { 41 | String[] separatedTime = date.split("-"); 42 | return separatedTime[2].replaceFirst("^0*", ""); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/dao/CalendarResponse.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.dao; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Created by Dhaval Soneji on 13/5/16. 7 | */ 8 | public class CalendarResponse{ 9 | private String startmon; 10 | private String endmon; 11 | private ArrayList monthdata; 12 | private ArrayList currentDateData; 13 | 14 | public ArrayList getCurrentDateData() { 15 | return currentDateData; 16 | } 17 | 18 | public void setCurrentDateData(ArrayList currentDateData) { 19 | this.currentDateData = currentDateData; 20 | } 21 | 22 | public ArrayList getMonthdata() { 23 | return monthdata; 24 | } 25 | 26 | public void setMonthdata(ArrayList monthdata) { 27 | this.monthdata = monthdata; 28 | } 29 | 30 | public String getStartmonth() { 31 | return startmon; 32 | } 33 | 34 | public void setStartmonth(String startmonth) { 35 | this.startmon = startmonth; 36 | } 37 | 38 | public String getEndmonth() { 39 | return endmon; 40 | } 41 | 42 | public void setEndmonth(String endmonth) { 43 | this.endmon = endmonth; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/dao/Event.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.dao; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Created by Dhaval Soneji on 13/5/16. 7 | */ 8 | public class Event { 9 | private String date; 10 | private String count; 11 | private ArrayList eventData; 12 | 13 | public String getDate() { 14 | return date; 15 | } 16 | 17 | public void setDate(String date) { 18 | this.date = date; 19 | } 20 | 21 | public String getCount() { 22 | return count; 23 | } 24 | 25 | public void setCount(String count) { 26 | this.count = count; 27 | } 28 | 29 | public ArrayList getEventData() { 30 | return eventData; 31 | } 32 | 33 | public void setEventData(ArrayList eventData) { 34 | this.eventData = eventData; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/dao/EventData.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.dao; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Created by Dhaval Soneji on 13/5/16. 7 | */ 8 | public class EventData { 9 | private String section; 10 | private ArrayList data; 11 | 12 | public String getSection() { 13 | return section; 14 | } 15 | 16 | public void setSection(String section) { 17 | this.section = section; 18 | } 19 | 20 | public ArrayList getData() { 21 | return data; 22 | } 23 | 24 | public void setData(ArrayList data) { 25 | this.data = data; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/dao/SectionDataViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.dao; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.View; 5 | import android.widget.TextView; 6 | 7 | import com.riontech.calendar.R; 8 | 9 | /** 10 | * Created by Dhaval Soneji on 4/4/16. 11 | */ 12 | public class SectionDataViewHolder extends RecyclerView.ViewHolder { 13 | private TextView txtTitle; 14 | private TextView txtDate; 15 | private TextView txtRemark; 16 | private TextView txtSubject; 17 | private View bottomLine; 18 | 19 | public View getBottomLine() { 20 | return bottomLine; 21 | } 22 | 23 | public void setBottomLine(View bottomLine) { 24 | this.bottomLine = bottomLine; 25 | } 26 | 27 | public TextView getTxtTitle() { 28 | return txtTitle; 29 | } 30 | 31 | public void setTxtTitle(TextView txtTitle) { 32 | this.txtTitle = txtTitle; 33 | } 34 | 35 | public TextView getTxtSubmissionDate() { 36 | return txtDate; 37 | } 38 | 39 | public void setTxtDate(TextView txtDate) { 40 | this.txtDate = txtDate; 41 | } 42 | 43 | public TextView getTxtRemark() { 44 | return txtRemark; 45 | } 46 | 47 | public void setTxtRemark(TextView txtRemark) { 48 | this.txtRemark = txtRemark; 49 | } 50 | 51 | public TextView getTxtSubject() { 52 | return txtSubject; 53 | } 54 | 55 | public void setTxtSubject(TextView txtSubject) { 56 | this.txtSubject = txtSubject; 57 | } 58 | 59 | public SectionDataViewHolder(View v) { 60 | super(v); 61 | txtTitle = (TextView) v.findViewById(R.id.txtTitle); 62 | txtDate = (TextView) v.findViewById(R.id.txtDate); 63 | txtRemark = (TextView) v.findViewById(R.id.txtRemark); 64 | txtSubject = (TextView) v.findViewById(R.id.txtSubject); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/dao/SectionTitleViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.dao; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.View; 5 | import android.widget.TextView; 6 | 7 | import com.riontech.calendar.R; 8 | 9 | /** 10 | * Created by Dhaval Soneji on 4/4/16. 11 | */ 12 | public class SectionTitleViewHolder extends RecyclerView.ViewHolder { 13 | private TextView txtSection; 14 | 15 | public TextView getTxtSection() { 16 | return txtSection; 17 | } 18 | 19 | public void setTxtSection(TextView txtSection) { 20 | this.txtSection = txtSection; 21 | } 22 | 23 | public SectionTitleViewHolder(View v) { 24 | super(v); 25 | txtSection = (TextView) v.findViewById(R.id.txtSection); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/dao/dataAboutDate.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.dao; 2 | 3 | /** 4 | * Created by Dhaval Soneji on 13/5/16. 5 | */ 6 | public class dataAboutDate { 7 | private String submissionDate; 8 | private String subject; 9 | private String title; 10 | private String remarks; 11 | 12 | public String getSubmissionDate() { 13 | return submissionDate; 14 | } 15 | 16 | public void setSubmissionDate(String submissionDate) { 17 | this.submissionDate = submissionDate; 18 | } 19 | 20 | public String getSubject() { 21 | return subject; 22 | } 23 | 24 | public void setSubject(String subject) { 25 | this.subject = subject; 26 | } 27 | 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | public void setTitle(String title) { 33 | this.title = title; 34 | } 35 | 36 | public String getRemarks() { 37 | return remarks; 38 | } 39 | 40 | public void setRemarks(String remarks) { 41 | this.remarks = remarks; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/fragment/CalendarFragment.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.AdapterView; 10 | import android.widget.GridView; 11 | import android.widget.LinearLayout; 12 | import android.widget.RelativeLayout; 13 | import android.widget.TextView; 14 | 15 | import com.riontech.calendar.CustomCalendar; 16 | import com.riontech.calendar.Singleton; 17 | import com.riontech.calendar.adapter.CalendarGridviewAdapter; 18 | import com.riontech.calendar.dao.CalendarDecoratorDao; 19 | import com.riontech.calendar.dao.CalendarResponse; 20 | import com.riontech.calendar.dao.Event; 21 | import com.riontech.calendar.dao.EventData; 22 | import com.riontech.calendar.utils.CalendarUtils; 23 | import com.riontech.calendar.R; 24 | 25 | import java.text.DateFormat; 26 | import java.util.ArrayList; 27 | import java.util.Calendar; 28 | import java.util.GregorianCalendar; 29 | 30 | /** 31 | * Created by Dhaval Soneji on 31/3/16. 32 | */ 33 | public class CalendarFragment extends Fragment { 34 | private static final String TAG = CalendarFragment.class.getSimpleName(); 35 | 36 | private GridView mGridview; 37 | private LinearLayout mLlDayList; 38 | private RelativeLayout mRlHeader; 39 | private GregorianCalendar month; 40 | private CalendarGridviewAdapter mCalendarGridviewAdapter; 41 | private boolean flagMaxMin = false; 42 | public static String currentDateSelected; 43 | private Calendar mCalendar; 44 | private DateFormat mDateFormat; 45 | private GregorianCalendar mPMonth; 46 | private int mMonthLength; 47 | private GregorianCalendar mPMonthMaxSet; 48 | private ArrayList mEventList = new ArrayList<>(); 49 | private ViewGroup rootView; 50 | private static CustomCalendar mCustomCalendar; 51 | 52 | 53 | /** 54 | * create CalendarFragment object and call setCalendar(). 55 | * 56 | * @param calendar 57 | * @return 58 | */ 59 | public static CalendarFragment newInstance(CustomCalendar calendar) { 60 | CalendarFragment fragment = new CalendarFragment(); 61 | fragment.setCalendar(calendar); 62 | return fragment; 63 | } 64 | 65 | /** 66 | * initialize CustomCalendar to access method of it. 67 | * 68 | * @param calendar 69 | */ 70 | private void setCalendar(CustomCalendar calendar) { 71 | mCustomCalendar = calendar; 72 | } 73 | 74 | /** 75 | * initialize Calendar and for the first time load Current Month data. 76 | * 77 | * @param inflater 78 | * @param container 79 | * @param savedInstanceState 80 | * @return 81 | */ 82 | @Nullable 83 | @Override 84 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 85 | 86 | rootView = (ViewGroup) inflater.inflate( 87 | R.layout.fragement, container, false); 88 | 89 | initCurrentMonthInGridview(); 90 | 91 | if (Singleton.getInstance().getIsSwipeViewPager() == 2) 92 | refreshDays(); 93 | 94 | return rootView; 95 | } 96 | 97 | /** 98 | * initialize DaysName(Sun,Mon,...) Layout, 99 | * initialize Current MonthHeader(June 2016) Layout, 100 | * initialize Gridview(Current month) With click event 101 | */ 102 | private void initCurrentMonthInGridview() { 103 | 104 | mLlDayList = (LinearLayout) rootView.findViewById(R.id.llDayList); 105 | mRlHeader = (RelativeLayout) rootView.findViewById(R.id.rlMonthTitle); 106 | 107 | month = Singleton.getInstance().getMonth(); 108 | 109 | mCalendarGridviewAdapter = new CalendarGridviewAdapter(getActivity(), mEventList, month); 110 | 111 | mCalendar = month; 112 | mCalendar.set(Calendar.DAY_OF_MONTH, 1); 113 | mCalendar.setFirstDayOfWeek(Calendar.SUNDAY); 114 | mDateFormat = CalendarUtils.getCalendarDBFormat(); 115 | 116 | mGridview = (GridView) rootView.findViewById(R.id.gvCurrentMonthDayList); 117 | mGridview.setAdapter(mCalendarGridviewAdapter); 118 | 119 | TextView title = (TextView) rootView.findViewById(R.id.title); 120 | title.setText(android.text.format.DateFormat.format(CalendarUtils.getCalendarMonthTitleFormat(), month)); 121 | 122 | mGridview.setOnItemClickListener(new AdapterView.OnItemClickListener() { 123 | public void onItemClick(AdapterView parent, View v, 124 | int position, long id) { 125 | 126 | String selectedDate = mEventList.get(position).getDate(); 127 | ((CalendarGridviewAdapter) parent.getAdapter()).setSelected(v, selectedDate); 128 | fetchEvents(selectedDate); 129 | 130 | } 131 | }); 132 | } 133 | 134 | /** 135 | * check if date has event or not, 136 | * then 137 | * 138 | * @param date 139 | */ 140 | public void fetchEvents(String date) { 141 | boolean flag = false; 142 | int pos = 0; 143 | for (int i = 0; i < Singleton.getInstance().getEventManager().size(); i++) { 144 | if (Singleton.getInstance().getEventManager().get(i).getDate().equalsIgnoreCase(date)) { 145 | flag = true; 146 | pos = i; 147 | } 148 | } 149 | ArrayList eventDataArrayList = new ArrayList(); 150 | if (flag) { 151 | if (Singleton.getInstance().getEventManager().get(pos).getEventData() != null) { 152 | eventDataArrayList = Singleton.getInstance().getEventManager().get(pos).getEventData(); 153 | } 154 | } 155 | 156 | if (mCustomCalendar != null) 157 | mCustomCalendar.setDateSelectionData(eventDataArrayList); 158 | } 159 | 160 | /** 161 | * refresh current month 162 | */ 163 | public void refreshCalendar() { 164 | TextView title = (TextView) rootView.findViewById(R.id.title); 165 | refreshDays(); 166 | title.setText(android.text.format.DateFormat.format(CalendarUtils.getCalendarMonthTitleFormat(), month)); 167 | } 168 | 169 | /** 170 | * refresh current month days 171 | */ 172 | public void refreshDays() { 173 | 174 | //clear List 175 | mEventList.clear(); 176 | //create clone 177 | mPMonth = (GregorianCalendar) mCalendar.clone(); 178 | 179 | CalendarGridviewAdapter.firstDay = mCalendar.get(GregorianCalendar.DAY_OF_WEEK); 180 | 181 | int mMaxWeekNumber = mCalendar.getActualMaximum(Calendar.WEEK_OF_MONTH); 182 | 183 | mMonthLength = mMaxWeekNumber * 7; 184 | int mMaxP = getmMaxP(); 185 | int mCalMaxP = mMaxP - (CalendarGridviewAdapter.firstDay - 1); 186 | 187 | mPMonthMaxSet = (GregorianCalendar) mPMonth.clone(); 188 | 189 | mPMonthMaxSet.set(GregorianCalendar.DAY_OF_MONTH, mCalMaxP + 1); 190 | 191 | setData(getCalendarData()); 192 | 193 | } 194 | 195 | /** 196 | * @return 197 | */ 198 | private CalendarResponse getCalendarData() { 199 | CalendarResponse calendarResponse = new CalendarResponse(); 200 | calendarResponse.setStartmonth(Singleton.getInstance().getStartMonth()); 201 | calendarResponse.setEndmonth(Singleton.getInstance().getEndMonth()); 202 | calendarResponse.setMonthdata(Singleton.getInstance().getEventManager()); 203 | return calendarResponse; 204 | } 205 | 206 | /** 207 | * @param calendarResponse 208 | */ 209 | private void setData(CalendarResponse calendarResponse) { 210 | 211 | mLlDayList.setVisibility(View.VISIBLE); 212 | mRlHeader.setVisibility(View.VISIBLE); 213 | mGridview.setVisibility(View.VISIBLE); 214 | 215 | if (calendarResponse.getMonthdata() != null) { 216 | 217 | ArrayList monthDataList = calendarResponse.getMonthdata(); 218 | int m = 0; 219 | 220 | for (int n = 0; n < mMonthLength; n++) { 221 | String mItemValue = mDateFormat.format(mPMonthMaxSet.getTime()); 222 | mPMonthMaxSet.add(GregorianCalendar.DATE, 1); 223 | 224 | if (m < monthDataList.size()) { 225 | if (mItemValue.equalsIgnoreCase(monthDataList.get(m).getDate())) { 226 | CalendarDecoratorDao eventDao = new CalendarDecoratorDao( 227 | monthDataList.get(m).getDate(), 228 | Integer.parseInt(monthDataList.get(m).getCount())); 229 | mEventList.add(eventDao); 230 | m++; 231 | } else { 232 | CalendarDecoratorDao eventDao = new CalendarDecoratorDao(mItemValue, 0); 233 | mEventList.add(eventDao); 234 | } 235 | } else { 236 | CalendarDecoratorDao eventDao = new CalendarDecoratorDao(mItemValue, 0); 237 | mEventList.add(eventDao); 238 | } 239 | } 240 | 241 | mCalendarGridviewAdapter.notifyDataSetChanged(); 242 | 243 | if (!flagMaxMin) { 244 | flagMaxMin = true; 245 | } 246 | } 247 | } 248 | 249 | /** 250 | * setup next month and check for calendar range 251 | */ 252 | 253 | public void setNextMonth() { 254 | if (month.get(GregorianCalendar.MONTH) == month 255 | .getActualMaximum(GregorianCalendar.MONTH)) { 256 | month.set((month.get(GregorianCalendar.YEAR) + 1), 257 | month.getActualMinimum(GregorianCalendar.MONTH), 1); 258 | Singleton.getInstance().setMonth(month); 259 | } else { 260 | month.set(GregorianCalendar.MONTH, 261 | month.get(GregorianCalendar.MONTH) + 1); 262 | Singleton.getInstance().setMonth(month); 263 | } 264 | } 265 | 266 | /** 267 | * setup previous month and check for calendar range 268 | */ 269 | public void setPreviousMonth() { 270 | if (month.get(GregorianCalendar.MONTH) == month 271 | .getActualMinimum(GregorianCalendar.MONTH)) { 272 | month.set((month.get(GregorianCalendar.YEAR) - 1), 273 | month.getActualMaximum(GregorianCalendar.MONTH), 1); 274 | Singleton.getInstance().setMonth(month); 275 | } else { 276 | month.set(GregorianCalendar.MONTH, 277 | month.get(GregorianCalendar.MONTH) - 1); 278 | Singleton.getInstance().setMonth(month); 279 | } 280 | } 281 | 282 | /** 283 | * @return 284 | */ 285 | private int getmMaxP() { 286 | int maxP; 287 | if (mCalendar.get(GregorianCalendar.MONTH) == mCalendar 288 | .getActualMinimum(GregorianCalendar.MONTH)) { 289 | mPMonth.set((mCalendar.get(GregorianCalendar.YEAR) - 1), 290 | mCalendar.getActualMaximum(GregorianCalendar.MONTH), 1); 291 | } else { 292 | mPMonth.set(GregorianCalendar.MONTH, 293 | mCalendar.get(GregorianCalendar.MONTH) - 1); 294 | } 295 | maxP = mPMonth.getActualMaximum(GregorianCalendar.DAY_OF_MONTH); 296 | 297 | return maxP; 298 | } 299 | 300 | } 301 | -------------------------------------------------------------------------------- /calendar/src/main/java/com/riontech/calendar/utils/CalendarUtils.java: -------------------------------------------------------------------------------- 1 | package com.riontech.calendar.utils; 2 | 3 | import java.text.SimpleDateFormat; 4 | 5 | 6 | /** 7 | * Created by Dhaval Soneji on 26/1/16. 8 | */ 9 | public class CalendarUtils { 10 | private static final String TAG = CalendarUtils.class.getSimpleName(); 11 | private static final String CALENDAR_DB_FORMAT = "yyyy-MM-dd"; 12 | private static final String CALENDAR_DATE_FORMAT = "MMM dd yyyy"; 13 | private static final String CALENDAR_MONTH_TITLE_FORMAT = "MMMM yyyy"; 14 | private static final String[] NAMES = {"Alex", "John", "Dwayne"}; 15 | private static final String[] EVENTS = {"Task", "Birthday", "Events"}; 16 | private static final String[] EVENTS_DESCRIPTION = {"Prepare Presentation", "Wish Him on his Birthday" 17 | , "@ Some Place"}; 18 | 19 | public static SimpleDateFormat getCalendarDBFormat() { 20 | return new SimpleDateFormat(CALENDAR_DB_FORMAT); 21 | } 22 | 23 | public static SimpleDateFormat getCalendarDateFormat() { 24 | return new SimpleDateFormat(CALENDAR_DATE_FORMAT); 25 | } 26 | 27 | public static String getCalendarMonthTitleFormat(){ 28 | return CALENDAR_MONTH_TITLE_FORMAT; 29 | } 30 | 31 | public static String[] getNAMES() { 32 | return NAMES; 33 | } 34 | 35 | public static String[] getEVENTS() { 36 | return EVENTS; 37 | } 38 | 39 | public static String[] getEventsDescription() { 40 | return EVENTS_DESCRIPTION; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-hdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-hdpi/ic_add.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-hdpi/ic_arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-hdpi/ic_arrow_left.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-hdpi/ic_arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-hdpi/ic_arrow_right.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-land/circle_decorator.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-land/circle_decorator_white.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-land/circle_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-land/circle_shape_selected.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-land/ic_cont_failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-land/ic_cont_failed.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-land/list_item_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-mdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-mdpi/ic_add.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-mdpi/ic_arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-mdpi/ic_arrow_left.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-mdpi/ic_arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-mdpi/ic_arrow_right.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-xhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-xhdpi/ic_add.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-xhdpi/ic_arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-xhdpi/ic_arrow_left.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-xhdpi/ic_arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-xhdpi/ic_arrow_right.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-xxhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-xxhdpi/ic_add.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-xxhdpi/ic_arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-xxhdpi/ic_arrow_left.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-xxhdpi/ic_arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-xxhdpi/ic_arrow_right.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-xxxhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-xxxhdpi/ic_add.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-xxxhdpi/ic_arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-xxxhdpi/ic_arrow_left.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable-xxxhdpi/ic_arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable-xxxhdpi/ic_arrow_right.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable/circle_decorator.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /calendar/src/main/res/drawable/circle_decorator_white.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /calendar/src/main/res/drawable/circle_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /calendar/src/main/res/drawable/circle_shape_selected.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /calendar/src/main/res/drawable/ic_cont_failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Riontech/CustomCalendar/e259984eb9427d7a87f4f1cc1712d6613d72727b/calendar/src/main/res/drawable/ic_cont_failed.png -------------------------------------------------------------------------------- /calendar/src/main/res/drawable/list_item_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /calendar/src/main/res/layout-land/layout_viewpager_recyclerview.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 23 | 24 | 33 | 34 | 40 | 41 | 48 | 49 | 57 | 58 | -------------------------------------------------------------------------------- /calendar/src/main/res/layout/calendar_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 22 | 23 | 30 | 31 | 38 | 39 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /calendar/src/main/res/layout/fragement.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 20 | 21 | 28 | 29 | 30 | 41 | 42 | 47 | 48 | 55 | 56 | 57 | 58 | 66 | 67 | 75 | 76 | 84 | 85 | 93 | 94 | 102 | 103 | 111 | 112 | 120 | 121 | 129 | 130 | 131 | 132 | 133 | 142 | 143 | -------------------------------------------------------------------------------- /calendar/src/main/res/layout/layout_viewpager_recyclerview.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | 28 | 29 | 36 | 37 | 45 | -------------------------------------------------------------------------------- /calendar/src/main/res/layout/row_event_desc.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 16 | 17 | 27 | 28 | 38 | 39 | 49 | 50 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /calendar/src/main/res/layout/row_event_header.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /calendar/src/main/res/values/attr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /calendar/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #ffffff 7 | 8 | 9 | #757575 10 | @color/colorPrimaryDark 11 | #E3E3E3 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /calendar/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 7 | 24sp 8 | 20sp 9 | 18sp 10 | 16sp 11 | 14sp 12 | 12sp 13 | 10sp 14 | 8sp 15 | 16 | 17 | 0dp 18 | 1dp 19 | 2dp 20 | 3dp 21 | 4dp 22 | 5dp 23 | 10dp 24 | 15dp 25 | 20dp 26 | 25dp 27 | 30dp 28 | 40dp 29 | 50dp 30 | 60dp 31 | -------------------------------------------------------------------------------- /calendar/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Custom Calendar 3 | 4 | 5 | Sun 6 | Mon 7 | Tue 8 | Wed 9 | Thu 10 | Fri 11 | Sat 12 | No events 13 | 14 | Failed to create Calendar,\n\n invalid value of Attributes!,\n Please review & try again! 15 | Failed to create Calendar,\n\n invalid eventCount,\n Please enter between 1 to 3 16 | 17 | -------------------------------------------------------------------------------- /calendar/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /sample/src/test/java/com/riontech/sample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.riontech.sample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':calendar', ':sample' 2 | --------------------------------------------------------------------------------