diff --git a/README.md b/README.md
index 7e59606..3c9bb24 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,222 @@
-# VRCalendarView
\ No newline at end of file
+# VRCalendarView
+
+# Usage
+
+*For a working implementation, Have a look at the Sample Project - app*
+
+1. Include the library as local library project.
+```gradle
+allprojects {
+ repositories {
+ maven { url 'https://jitpack.io' }
+ }
+}
+
+dependencies {
+
+ compile 'com.github.VRGsoftUA:not ready yet'
+
+}
+```
+2. Include the VRCalendarView widget in your layout.
+
+ ```xml
+
+ ```
+3. You can do same with java
+ ```java
+ vrCalendarView.getSettings().setOtherMonthTextStyle(VRCalendarView.BOLD)
+ .setCurrentMonthBackgroundColor(Color.CYAN)
+ .updateCalendar();
+ ```
+or
+ ```java
+ vrCalendarView.getSettings()
+ .setOnCalendarClickListener(this)
+ .setOnCalendarLongClickListener(this)
+ .setVRCalendarMonthCallback(this);
+ ```
+
+4. You can update all days by calling VRCalendarView.getSettings().updateCalendar();
+
+ ```java
+ vrCalendarView.getSettings().setOtherMonthTextStyle(VRCalendarView.BOLD)
+ .setCurrentMonthBackgroundColor(Color.CYAN)
+ .updateCalendar();
+ ```
+ if VRCalendarView.getSettings().updateCalendar(); is called and you want to save some custom day
+ List getCustomizeDayView(Calendar calendar) method should be overridden
+ getCustomizeDayView(Calendar calendar) is return all days you need to make custom.
+ With parameter calendar you can get the year and the month to return customised days from specific month
+ ```java
+ @Override
+ public List getCustomizeDayView(Calendar calendar) {
+ List vrCalendarDays = new ArrayList<>();
+ VrCalendarDay today = new VrCalendarDay();
+ today.setDate(new Date());
+
+ VrCalendarDaySettings todaySettings = new VrCalendarDaySettings();
+ todaySettings.setDayTextColor(Color.CYAN);
+ today.setVrCalendarDaySettings(todaySettings);
+ today.setVRCalendarCustomViewCallback(new VRCalendarCustomViewCallback() {
+ @Override
+ public View getNewCustomiseView() {
+ ImageView imageView = new ImageView(MainActivity.this);
+ imageView.setImageResource(R.drawable.ic_stat_name);
+ return imageView;
+ }
+ });
+
+ vrCalendarDays.add(today);
+
+ VrCalendarDay tomorrow = new VrCalendarDay();
+ Date d = new Date(1513435110633L);// December 16, 2017
+ tomorrow.setDate(d);
+ VrCalendarDaySettings vrtomorCalendarDaySettings = new VrCalendarDaySettings();
+ vrtomorCalendarDaySettings.setDayTextStyle(VRCalendarView.BOLD);
+ vrtomorCalendarDaySettings.setDayBackgroundColor(ContextCompat.getColor(this, R.color.colorAccent));
+ vrtomorCalendarDaySettings.setDayTextColor(ContextCompat.getColor(this, R.color.colorYellow));
+ tomorrow.setVrCalendarDaySettings(vrtomorCalendarDaySettings);
+
+ vrCalendarDays.add(tomorrow);
+
+ return vrCalendarDays;
+ }
+ ```
+ You can set set whatever view you want and customise it like you want if standard customisation does not fit
+ Attention!!!
+ View getNewCustomiseView() should always return new View. other wise it doesn't work properly
+ ```java
+ today.setVRCalendarCustomViewCallback(new VRCalendarCustomViewCallback() {
+ @Override
+ public View getNewCustomiseView() {
+ ImageView imageView = new ImageView(MainActivity.this);
+ imageView.setImageResource(R.drawable.ic_stat_name);
+ return imageView;
+ }
+ });
+ ```
+
+ but if you need to update specific day it is better to call
+
+ ```java
+ vrCalendarView.getSettings().updateCalendarDay(VrCalendarDay today, boolean hasToSelect);
+ ```
+ where VrCalendarDay has settings to customise specific day - hasToSelect should be false than
+ and hasToSelect is boolean that sets specific customisation
+ not from VrCalendarDay settings but from default settings that has attribute "chosen". Like below
+ ```xml
+ app:vr_chosen_day_background_color="@color/colorGreen"
+ app:vr_chosen_day_background_drawable="@drawable/background"
+ ```
+ to update specific day you have to set VRCalendarDay.setDate(Date date); - it is required
+ ```java
+ VrCalendarDay today = new VrCalendarDay();
+ today.setVRCalendarCustomViewCallback(new VRCalendarCustomViewCallback() {
+ @Override
+ public View getNewCustomiseView() {
+ ImageView imageView = new ImageView(MainActivity.this);
+ imageView.setImageResource(R.drawable.ic_stat_name);
+ return imageView;
+ }
+ });
+ today.setDate(day.getDate());
+ ```
+
+
+
+5. There is onClick listener and onLongClick
+ ```java
+
+ public interface OnCalendarLongClickListener {
+ void onCalendarDayLongClick(VrCalendarDay day);
+ }
+ ```
+
+ and
+
+ ```java
+ public interface OnCalendarClickListener {
+ void onCalendarDayClick(VrCalendarDay day);
+ }
+
+ ```
+that returns VrCalendarDay you click on
+
+ #### Customisation
+ You can add fields via xml or VrCalendarView or VrCalendarView.getSettings().
+Supported fields:
+ ```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ```
+ #### Contributing
+* Contributions are always welcome
+* If you want a feature and can code, feel free to fork and add the change yourself and make a pull request
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/app.iml b/app/app.iml
new file mode 100644
index 0000000..51856ea
--- /dev/null
+++ b/app/app.iml
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..0370acb
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,31 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 27
+ buildToolsVersion "27.0.2"
+ defaultConfig {
+ applicationId "com.vrgsoft.calendarview"
+ minSdkVersion 16
+ targetSdkVersion 27
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ compile 'com.android.support:appcompat-v7:27.0.2'
+ compile 'com.android.support.constraint:constraint-layout:1.0.2'
+ testCompile 'junit:junit:4.12'
+ compile project(path: ':calendar')
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..ce3149c
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..e3b2c75
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/vrgsoft/calendarview/MainActivity.java b/app/src/main/java/com/vrgsoft/calendarview/MainActivity.java
new file mode 100644
index 0000000..1409f96
--- /dev/null
+++ b/app/src/main/java/com/vrgsoft/calendarview/MainActivity.java
@@ -0,0 +1,143 @@
+package com.vrgsoft.calendarview;
+
+import android.graphics.Color;
+import android.support.v4.content.ContextCompat;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.Toast;
+
+import com.vrgsoft.calendar.VRCalendarCustomViewCallback;
+import com.vrgsoft.calendar.calendar_listeners.OnCalendarClickListener;
+import com.vrgsoft.calendar.calendar_listeners.OnCalendarLongClickListener;
+import com.vrgsoft.calendar.VRCalendarView;
+import com.vrgsoft.calendar.calendar_listeners.VRCalendarMonthCallback;
+import com.vrgsoft.calendar.VrCalendarDay;
+import com.vrgsoft.calendar.VrCalendarDaySettings;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+public class MainActivity extends AppCompatActivity implements OnCalendarClickListener, OnCalendarLongClickListener, VRCalendarMonthCallback {
+
+ private VRCalendarView vrCalendarView;
+ private DateFormat df = new SimpleDateFormat("yyyy-MMMM-dd", Locale.getDefault());
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ vrCalendarView = findViewById(R.id.calendar);
+ vrCalendarView.getSettings()
+ .setOnCalendarClickListener(this)
+ .setOnCalendarLongClickListener(this)
+ .setVRCalendarMonthCallback(this);
+
+ findViewById(R.id.prev).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.YEAR, 2019);
+ calendar.set(Calendar.MONTH, 6);
+ calendar.set(Calendar.DAY_OF_MONTH, 27);
+ vrCalendarView.moveToDate(new Date(calendar.getTimeInMillis()));
+ }
+ });
+ findViewById(R.id.next).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.YEAR, 2015);
+ calendar.set(Calendar.MONTH, 6);
+ calendar.set(Calendar.DAY_OF_MONTH, 27);
+ vrCalendarView.moveToDate(new Date(calendar.getTimeInMillis()));
+ }
+ });
+
+ findViewById(R.id.update).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ vrCalendarView.getSettings()
+ .setOtherMonthTextStyle(VRCalendarView.BOLD)
+ .setCurrentMonthBackgroundColor(Color.CYAN)
+ .updateCalendar();
+ }
+ });
+ }
+
+ @Override
+ public void onCalendarDayClick(VrCalendarDay day) {
+ Toast.makeText(MainActivity.this, " " + df.format(day.getDate()), Toast.LENGTH_SHORT).show();
+
+ VrCalendarDay today = new VrCalendarDay();
+ today.setVRCalendarCustomViewCallback(new VRCalendarCustomViewCallback() {
+ @Override
+ public View getNewCustomiseView() {
+ ImageView imageView = new ImageView(MainActivity.this);
+ imageView.setImageResource(R.drawable.ic_stat_name);
+ return imageView;
+ }
+ });
+ today.setDate(day.getDate());
+
+ vrCalendarView.getSettings().updateCalendarDay(today, true);
+
+ }
+
+ @Override
+ public void onCalendarDayLongClick(VrCalendarDay day) {
+ Toast.makeText(MainActivity.this, "Long " + df.format(day.getDate()), Toast.LENGTH_SHORT).show();
+
+ VrCalendarDay today = new VrCalendarDay();
+ today.setDate(day.getDate());
+ VrCalendarDaySettings vrCalendarDaySettings = new VrCalendarDaySettings();
+ vrCalendarDaySettings.setDayTextStyle(VRCalendarView.BOLD);
+ vrCalendarDaySettings.setDayTextSize(13);
+ vrCalendarDaySettings.setDayBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimary));
+ vrCalendarDaySettings.setDayTextColor(ContextCompat.getColor(this, R.color.colorToday));
+ today.setVrCalendarDaySettings(vrCalendarDaySettings);
+
+ vrCalendarView.getSettings().updateCalendarDay(today, false);
+ }
+
+ @Override
+ public List getCustomizeDayView(Calendar calendar) {
+ List vrCalendarDays = new ArrayList<>();
+ VrCalendarDay today = new VrCalendarDay();
+ today.setDate(new Date());
+
+ VrCalendarDaySettings todaySettings = new VrCalendarDaySettings();
+ todaySettings.setDayTextColor(Color.CYAN);
+ today.setVrCalendarDaySettings(todaySettings);
+ today.setVRCalendarCustomViewCallback(new VRCalendarCustomViewCallback() {
+ @Override
+ public View getNewCustomiseView() {
+ ImageView imageView = new ImageView(MainActivity.this);
+ imageView.setImageResource(R.drawable.ic_stat_name);
+ return imageView;
+ }
+ });
+
+ vrCalendarDays.add(today);
+
+ VrCalendarDay tomorrow = new VrCalendarDay();
+ Date d = new Date(1513435110633L);
+ tomorrow.setDate(d);
+ VrCalendarDaySettings vrtomorCalendarDaySettings = new VrCalendarDaySettings();
+ vrtomorCalendarDaySettings.setDayTextStyle(VRCalendarView.BOLD);
+ vrtomorCalendarDaySettings.setDayBackgroundColor(ContextCompat.getColor(this, R.color.colorAccent));
+ vrtomorCalendarDaySettings.setDayTextColor(ContextCompat.getColor(this, R.color.colorYellow));
+ tomorrow.setVrCalendarDaySettings(vrtomorCalendarDaySettings);
+
+ vrCalendarDays.add(tomorrow);
+
+ return vrCalendarDays;
+ }
+}
diff --git a/app/src/main/res/drawable-hdpi/ic_next.png b/app/src/main/res/drawable-hdpi/ic_next.png
new file mode 100644
index 0000000..a2e65ab
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_next.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_previous.png b/app/src/main/res/drawable-hdpi/ic_previous.png
new file mode 100644
index 0000000..d8e3c16
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_previous.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_stat_name.png b/app/src/main/res/drawable-hdpi/ic_stat_name.png
new file mode 100644
index 0000000..718075b
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_stat_name.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_next.png b/app/src/main/res/drawable-mdpi/ic_next.png
new file mode 100644
index 0000000..f940c5d
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_next.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_previous.png b/app/src/main/res/drawable-mdpi/ic_previous.png
new file mode 100644
index 0000000..5b76f5f
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_previous.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_stat_name.png b/app/src/main/res/drawable-mdpi/ic_stat_name.png
new file mode 100644
index 0000000..c156b9b
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_stat_name.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_next.png b/app/src/main/res/drawable-xhdpi/ic_next.png
new file mode 100644
index 0000000..7b2caeb
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_next.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_previous.png b/app/src/main/res/drawable-xhdpi/ic_previous.png
new file mode 100644
index 0000000..763b889
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_previous.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_stat_name.png b/app/src/main/res/drawable-xhdpi/ic_stat_name.png
new file mode 100644
index 0000000..3bef406
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_stat_name.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_next.png b/app/src/main/res/drawable-xxhdpi/ic_next.png
new file mode 100644
index 0000000..32c55d9
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_next.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_previous.png b/app/src/main/res/drawable-xxhdpi/ic_previous.png
new file mode 100644
index 0000000..248ef5f
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_previous.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_stat_name.png b/app/src/main/res/drawable-xxhdpi/ic_stat_name.png
new file mode 100644
index 0000000..ee55f08
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_stat_name.png differ
diff --git a/app/src/main/res/drawable/background.xml b/app/src/main/res/drawable/background.xml
new file mode 100644
index 0000000..9128c3a
--- /dev/null
+++ b/app/src/main/res/drawable/background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..8ac66c3
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9a078e3
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..efc028a
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..3af2608
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9bec2e6
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..34947cd
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..ffe6858
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,10 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+ #00f234
+ #0ea8ae
+ #ffff00
+ #000000
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..76b9498
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ CalendarView
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..0eb88fe
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..4fc4083
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,31 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com/'
+ name 'Google'
+ }
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.3.3'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com/'
+ name 'Google'
+ }
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/calendar/.gitignore b/calendar/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/calendar/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/calendar/build.gradle b/calendar/build.gradle
new file mode 100644
index 0000000..47a90ae
--- /dev/null
+++ b/calendar/build.gradle
@@ -0,0 +1,29 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 27
+ buildToolsVersion "27.0.2"
+
+ defaultConfig {
+ minSdkVersion 16
+ targetSdkVersion 27
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:recyclerview-v7:27.0.2'
+ compile 'com.android.support:support-v4:27.0.2'
+ compile 'com.android.support:appcompat-v7:27.0.2'
+}
diff --git a/calendar/calendar.iml b/calendar/calendar.iml
new file mode 100644
index 0000000..11d2af2
--- /dev/null
+++ b/calendar/calendar.iml
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calendar/proguard-rules.pro b/calendar/proguard-rules.pro
new file mode 100644
index 0000000..ce3149c
--- /dev/null
+++ b/calendar/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/calendar/src/main/AndroidManifest.xml b/calendar/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..6002fb9
--- /dev/null
+++ b/calendar/src/main/AndroidManifest.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/CalendarAdapter.java b/calendar/src/main/java/com/vrgsoft/calendar/CalendarAdapter.java
new file mode 100644
index 0000000..a98a3da
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/CalendarAdapter.java
@@ -0,0 +1,102 @@
+package com.vrgsoft.calendar;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import java.util.List;
+
+class CalendarAdapter extends RecyclerView.Adapter {
+
+ private List mCells;
+ private CalendarSettingWrapper mCalendarSettingWrapper;
+ private VrCalendarDay chosen;
+
+ CalendarAdapter(List mCells, CalendarSettingWrapper calendarSettingWrapper) {
+ this.mCells = mCells;
+ mCalendarSettingWrapper = calendarSettingWrapper;
+ }
+
+ @Override
+ public VRCalendarHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ return new VRCalendarHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_calendar_day, parent, false));
+ }
+
+ @Override
+ public void onBindViewHolder(final VRCalendarHolder holder, int position) {
+ final VrCalendarDay vrCalendarDay = mCells.get(position);
+
+ // TODO: 03.01.18 need to set drawable to custom any user want to
+ if (vrCalendarDay.getVRCalendarCustomViewCallback() != null) {
+ VRCalendarCustomViewCallback vrCalendarCustomViewCallback = vrCalendarDay.getVRCalendarCustomViewCallback();
+ holder.addCustomView(vrCalendarCustomViewCallback.getNewCustomiseView());
+ } else {
+ holder.addCustomView(null);
+ }
+ vrCalendarDay.setVRCalendarCustomViewCallback(null);
+ if (vrCalendarDay.isChoosen()) {
+ holder.setBackgroundToView(mCalendarSettingWrapper.getChosenBackgroundColor(), mCalendarSettingWrapper.getChosenBackgroundDrawable());
+ holder.setTextToTextView(mCalendarSettingWrapper.getChosenTextStyle(), mCalendarSettingWrapper.getChosenTextColor(), mCalendarSettingWrapper.getDayTextSize());
+ } else {
+ holder.setBackgroundToView(vrCalendarDay.getVrCalendarDaySettings().getDayBackgroundColor(), vrCalendarDay.getVrCalendarDaySettings().getDayBackgroundDrawable());
+ holder.setTextToTextView(vrCalendarDay.getVrCalendarDaySettings().getDayTextStyle(), vrCalendarDay.getVrCalendarDaySettings().getDayTextColor(), vrCalendarDay.getVrCalendarDaySettings().getDayTextSize());
+ }
+ holder.tvDay.setText(String.valueOf(vrCalendarDay.getVrCalendarDaySettings().getDay()));
+
+
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mCalendarSettingWrapper.getOnCalendarClickListener() != null) {
+ mCalendarSettingWrapper.getOnCalendarClickListener().onCalendarDayClick(vrCalendarDay);
+ }
+ }
+ });
+
+ holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ if (mCalendarSettingWrapper.getOnCalendarLongClickListener() != null) {
+ mCalendarSettingWrapper.getOnCalendarLongClickListener().onCalendarDayLongClick(vrCalendarDay);
+ }
+ return true;
+ }
+ });
+ }
+
+ @Override
+ public int getItemCount() {
+ return mCells == null ? 0 : mCells.size();
+ }
+
+ void updateAll(List cells) {
+ mCells = cells;
+ notifyDataSetChanged();
+ }
+
+ void updateDay(VrCalendarDay day, boolean hasToSelect) {
+ for (int i = 0; i < mCells.size(); i++) {
+
+ if (chosen != null && VrCalendarUtils.isSameDay(mCells.get(i).getDate(), chosen.getDate())) {
+ if (hasToSelect) {
+ mCells.get(i).setChoosen(false);
+ notifyItemChanged(i);
+ }
+ break;
+ }
+ }
+ for (int i = 0; i < mCells.size(); i++) {
+ if (VrCalendarUtils.isSameDay(mCells.get(i).getDate(), day.getDate())) {
+ mCells.set(i, day);
+ if (hasToSelect) {
+ mCells.get(i).setChoosen(true);
+ chosen = mCells.get(i);
+ }
+ notifyItemChanged(i);
+ break;
+ }
+ }
+ }
+
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/CalendarPagerAdapter.java b/calendar/src/main/java/com/vrgsoft/calendar/CalendarPagerAdapter.java
new file mode 100644
index 0000000..f9662fe
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/CalendarPagerAdapter.java
@@ -0,0 +1,49 @@
+package com.vrgsoft.calendar;
+
+import android.content.Context;
+import android.support.v4.view.PagerAdapter;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+
+import com.vrgsoft.calendar.calendar_listeners.VRCalendarUpdateListener;
+
+class CalendarPagerAdapter extends PagerAdapter {
+
+ static int MONTH_QUANTITY = 2400;
+ private Context context;
+ private int pos = MONTH_QUANTITY / 2;
+ private CalendarRecyclerView calendarRecyclerView;
+ private CalendarSettingWrapper mCalendarSettingWrapper;
+
+ CalendarPagerAdapter(Context context, CalendarSettingWrapper calendarSettingWrapper) {
+ this.context = context;
+ mCalendarSettingWrapper = calendarSettingWrapper;
+ }
+
+ @Override
+ public Object instantiateItem(ViewGroup collection, int position) {
+ calendarRecyclerView = new CalendarRecyclerView(context, -(pos - position), mCalendarSettingWrapper);
+ LinearLayout view = calendarRecyclerView;
+ mCalendarSettingWrapper.addVrCalendarUpdateListener(calendarRecyclerView);
+ collection.addView(view);
+ return view;
+ }
+
+ @Override
+ public void destroyItem(ViewGroup collection, int position, Object view) {
+ mCalendarSettingWrapper.removeVrCalendarUpdateListener((VRCalendarUpdateListener) view);
+ collection.removeView((LinearLayout) view);
+ }
+
+ @Override
+ public int getCount() {
+ return MONTH_QUANTITY;
+ }
+
+ @Override
+ public boolean isViewFromObject(View view, Object object) {
+ return view == object;
+ }
+
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/CalendarRecyclerView.java b/calendar/src/main/java/com/vrgsoft/calendar/CalendarRecyclerView.java
new file mode 100644
index 0000000..347062c
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/CalendarRecyclerView.java
@@ -0,0 +1,105 @@
+package com.vrgsoft.calendar;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.LinearLayout;
+
+import com.vrgsoft.calendar.calendar_listeners.VRCalendarUpdateListener;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+@SuppressLint("ViewConstructor")
+public class CalendarRecyclerView extends LinearLayout implements VRCalendarUpdateListener {
+
+ private static final int DAYS_COUNT = 42;
+ private CalendarSettingWrapper mCalendarSettingWrapper;
+ private CalendarAdapter mAdapter;
+ private VrCalendarUtils vrCalendarUtils;
+ private int mPosition;
+
+ public CalendarRecyclerView(Context context, int position, CalendarSettingWrapper calendarSettingWrapper) {
+ super(context);
+ mCalendarSettingWrapper = calendarSettingWrapper;
+ setupViews(position);
+ }
+
+ private void setupViews(int position) {
+ vrCalendarUtils = new VrCalendarUtils();
+ mPosition = position;
+
+ View view = LayoutInflater.from(getContext()).inflate(R.layout.recycler_calendar, this);
+ RecyclerView calendarRv = view.findViewById(R.id.calendar_recycler);
+
+ mAdapter = new CalendarAdapter(getDays(), mCalendarSettingWrapper);
+
+ calendarRv.setLayoutManager(new GridLayoutManager(getContext(), 7));
+ calendarRv.setItemAnimator(null);
+ calendarRv.setAdapter(mAdapter);
+
+ }
+
+ @Override
+ public void updateItem(VrCalendarDay day, boolean hasToSelect) {
+ if (mAdapter != null) {
+ mAdapter.updateDay(vrCalendarUtils.transfer(day, mCalendarSettingWrapper, mPosition), hasToSelect);
+ }
+ }
+
+ @Override
+ public void updateAll() {
+ if (mAdapter != null) {
+ mAdapter.updateAll(getDays());
+ }
+ }
+
+ private List getDays() {
+ List cells = new ArrayList<>();
+ Calendar currentDate = Calendar.getInstance();
+ currentDate.add(Calendar.MONTH, mPosition);
+ Calendar calendar = (Calendar) currentDate.clone();
+
+ List customDays = null;
+ if (mCalendarSettingWrapper.getVRCalendarMonthCallback() != null) {
+ customDays = mCalendarSettingWrapper.getVRCalendarMonthCallback().getCustomizeDayView(calendar);
+ }
+
+ // determine the cell for current month's beginning
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
+ int monthBeginningCell = calendar.get(Calendar.DAY_OF_WEEK) - 2;
+ if (monthBeginningCell < 0) {
+ monthBeginningCell = 6;
+ }
+ // move calendar backwards to the beginning of the week
+ calendar.add(Calendar.DAY_OF_MONTH, -monthBeginningCell);
+
+ // fill cells
+ while (cells.size() < DAYS_COUNT) {
+ VrCalendarDay vrCalendarDay = new VrCalendarDay();
+ vrCalendarDay.setDate(calendar.getTime());
+ if (customDays != null) {
+ for (int i = 0; i < customDays.size(); i++) {
+ if (VrCalendarUtils.isSameDay(customDays.get(i).getDate(), vrCalendarDay.getDate())) {
+ vrCalendarDay.setVRCalendarCustomViewCallback(customDays.get(i).getVRCalendarCustomViewCallback());
+ vrCalendarDay.setVrCalendarDaySettings(vrCalendarUtils.getDaySettings(currentDate
+ , vrCalendarDay.getDate(), mCalendarSettingWrapper, customDays.get(i).getVrCalendarDaySettings()));
+ break;
+ }
+ }
+ }
+ if (vrCalendarDay.getVrCalendarDaySettings() == null) {
+ vrCalendarDay.setVrCalendarDaySettings(vrCalendarUtils.getDaySettings(currentDate
+ , vrCalendarDay.getDate(), mCalendarSettingWrapper, null));
+ }
+
+ cells.add(vrCalendarDay);
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
+ }
+ return cells;
+ }
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/CalendarSettingWrapper.java b/calendar/src/main/java/com/vrgsoft/calendar/CalendarSettingWrapper.java
new file mode 100644
index 0000000..4158755
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/CalendarSettingWrapper.java
@@ -0,0 +1,370 @@
+package com.vrgsoft.calendar;
+
+import android.graphics.drawable.Drawable;
+
+import com.vrgsoft.calendar.calendar_listeners.OnCalendarClickListener;
+import com.vrgsoft.calendar.calendar_listeners.OnCalendarLongClickListener;
+import com.vrgsoft.calendar.calendar_listeners.VRCalendarCustomViewCallback;
+import com.vrgsoft.calendar.calendar_listeners.VRCalendarMonthCallback;
+import com.vrgsoft.calendar.calendar_listeners.VRCalendarUpdateListener;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CalendarSettingWrapper {
+
+ private OnCalendarClickListener mOnCalendarClickListener;
+ private OnCalendarLongClickListener mOnCalendarLongClickListener;
+ private VRCalendarMonthCallback mVRCalendarMonthCallback;
+ private VRCalendarCustomViewCallback mVRCalendarCustomViewCallback;
+ private List mVrCalendarUpdateListeners;
+
+ private int mCurrentDayTextColor;
+ private int mCurrentMonthTextColor;
+ private int mOtherMonthTextColor;
+ private int mCurrentMonthOtherDayTextColor;
+ private int mCurrentDayBackgroundColor;
+ private int mCurrentMonthBackgroundColor;
+ private int mOtherMonthBackgroundColor;
+ private int mCurrentMonthOtherDayBackgroundColor;
+ private int mCurrentDayTextStyle;
+ private int mCurrentMonthTextStyle;
+ private int mOtherMonthTextStyle;
+ private int mCurrentMonthOtherDayTextStyle;
+ private int mChosenTextStyle;
+ private int mChosenBackgroundColor;
+ private int mChosenTextColor;
+ private int mDayTextSize;
+
+ private Drawable mCurrentDayBackgroundDrawable;
+ private Drawable mCurrentMonthBackgroundDrawable;
+ private Drawable mOtherMonthBackgroundDrawable;
+ private Drawable mCurrentMonthOtherDayBackgroundDrawable;
+ private Drawable mChosenBackgroundDrawable;
+
+ CalendarSettingWrapper(Settings builder) {
+ mOnCalendarClickListener = builder.getOnCalendarClickListener();
+ mOnCalendarLongClickListener = builder.getOnCalendarLongClickListener();
+ mCurrentDayTextColor = builder.getCurrentDayTextColor();
+ mCurrentMonthTextColor = builder.getCurrentMonthTextColor();
+ mOtherMonthTextColor = builder.getOtherMonthTextColor();
+ mCurrentMonthOtherDayTextColor = builder.getCurrentMonthOtherDayTextColor();
+ mCurrentDayBackgroundColor = builder.getCurrentDayBackgroundColor();
+ mCurrentMonthBackgroundColor = builder.getCurrentMonthBackgroundColor();
+ mOtherMonthBackgroundColor = builder.getOtherMonthBackgroundColor();
+ mCurrentMonthOtherDayBackgroundColor = builder.getCurrentMonthOtherDayBackgroundColor();
+ mCurrentDayTextStyle = builder.getmCurrentDayTextStyle();
+ mCurrentMonthTextStyle = builder.getmCurrentMonthTextStyle();
+ mOtherMonthTextStyle = builder.getmOtherMonthTextStyle();
+ mCurrentMonthOtherDayTextStyle = builder.getmCurrentMonthOtherDayTextStyle();
+ mVRCalendarMonthCallback = builder.getmVRCalendarMonthCallback();
+ mChosenBackgroundColor = builder.getChosenBackgroundColor();
+ mChosenTextStyle = builder.getChosenTextStyle();
+ mChosenTextColor = builder.getChosenTextColor();
+ mCurrentDayBackgroundDrawable = builder.getCurrentDayBackgroundDrawable();
+ mCurrentMonthBackgroundDrawable = builder.getCurrentMonthBackgroundDrawable();
+ mOtherMonthBackgroundDrawable = builder.getOtherMonthBackgroundDrawable();
+ mCurrentMonthOtherDayBackgroundDrawable = builder.getCurrentMonthOtherDayBackgroundDrawable();
+ mChosenBackgroundDrawable = builder.getChosenBackgroundDrawable();
+ mDayTextSize = builder.getDayTextSize();
+ }
+
+ public CalendarSettingWrapper setDayTextSize(int dayTextSize) {
+ this.mDayTextSize = dayTextSize;
+ return this;
+ }
+
+ public VRCalendarCustomViewCallback getVRCalendarCustomViewCallback() {
+ return mVRCalendarCustomViewCallback;
+ }
+
+ public CalendarSettingWrapper setVRCalendarCustomViewCallback(VRCalendarCustomViewCallback vrCalendarCustomViewCallback) {
+ this.mVRCalendarCustomViewCallback = vrCalendarCustomViewCallback;
+ return this;
+ }
+
+ public CalendarSettingWrapper setOnCalendarClickListener(OnCalendarClickListener mOnCalendarClickListener) {
+ this.mOnCalendarClickListener = mOnCalendarClickListener;
+ return this;
+ }
+
+ public CalendarSettingWrapper setOnCalendarLongClickListener(OnCalendarLongClickListener mOnCalendarLongClickListener) {
+ this.mOnCalendarLongClickListener = mOnCalendarLongClickListener;
+ return this;
+ }
+
+ void setVrCalendarUpdateListeners(List mVrCalendarUpdateListeners) {
+ this.mVrCalendarUpdateListeners = mVrCalendarUpdateListeners;
+ }
+
+ public CalendarSettingWrapper setCurrentDayTextColor(int mCurrentDayTextColor) {
+ this.mCurrentDayTextColor = mCurrentDayTextColor;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentMonthTextColor(int mCurrentMonthTextColor) {
+ this.mCurrentMonthTextColor = mCurrentMonthTextColor;
+ return this;
+ }
+
+ public CalendarSettingWrapper setOtherMonthTextColor(int mOtherMonthTextColor) {
+ this.mOtherMonthTextColor = mOtherMonthTextColor;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentMonthOtherDayTextColor(int mCurrentMonthOtherDayTextColor) {
+ this.mCurrentMonthOtherDayTextColor = mCurrentMonthOtherDayTextColor;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentDayBackgroundColor(int mCurrentDayBackgroundColor) {
+ this.mCurrentDayBackgroundColor = mCurrentDayBackgroundColor;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentMonthBackgroundColor(int mCurrentMonthBackgroundColor) {
+ this.mCurrentMonthBackgroundColor = mCurrentMonthBackgroundColor;
+ return this;
+ }
+
+ public CalendarSettingWrapper setOtherMonthBackgroundColor(int mOtherMonthBackgroundColor) {
+ this.mOtherMonthBackgroundColor = mOtherMonthBackgroundColor;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentMonthOtherDayBackgroundColor(int mCurrentMonthOtherDayBackgroundColor) {
+ this.mCurrentMonthOtherDayBackgroundColor = mCurrentMonthOtherDayBackgroundColor;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentDayTextStyle(int mCurrentDayTextStyle) {
+
+ if (mCurrentDayTextStyle > 2 || mCurrentDayTextStyle < 0)
+ throw new IllegalArgumentException("CurrentDayTextStyle can be >= 0 or <=2");
+
+ this.mCurrentDayTextStyle = mCurrentDayTextStyle;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentMonthTextStyle(int mCurrentMonthTextStyle) {
+
+ if (mCurrentMonthTextStyle > 2 || mCurrentMonthTextStyle < 0)
+ throw new IllegalArgumentException("CurrentMonthTextStyle can be >= 0 or <=2");
+
+ this.mCurrentMonthTextStyle = mCurrentMonthTextStyle;
+ return this;
+ }
+
+ public CalendarSettingWrapper setOtherMonthTextStyle(int mOtherMonthTextStyle) {
+
+ if (mOtherMonthTextStyle > 2 || mOtherMonthTextStyle < 0)
+ throw new IllegalArgumentException("OtherMonthTextStyle can be >= 0 or <=2");
+
+ this.mOtherMonthTextStyle = mOtherMonthTextStyle;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentMonthOtherDayTextStyle(int mCurrentMonthOtherDayTextStyle) {
+
+ if (mCurrentMonthOtherDayTextStyle > 2 || mCurrentMonthOtherDayTextStyle < 0)
+ throw new IllegalArgumentException("CurrentMonthOtherDayTextStyle can be >= 0 or <=2");
+
+ this.mCurrentMonthOtherDayTextStyle = mCurrentMonthOtherDayTextStyle;
+ return this;
+ }
+
+ public CalendarSettingWrapper setChosenBackgroundColor(int mChosenBackgroundColor) {
+
+ this.mChosenBackgroundColor = mChosenBackgroundColor;
+ return this;
+ }
+
+ public CalendarSettingWrapper setChosenTextStyle(int mChosenTextStyle) {
+
+ if (mChosenTextStyle > 2 || mChosenTextStyle < 0)
+ throw new IllegalArgumentException("ChosenTextStyle can be >= 0 or <=2");
+
+ this.mChosenTextStyle = mChosenTextStyle;
+ return this;
+ }
+
+ public CalendarSettingWrapper setChosenTextColor(int mChosenTextColor) {
+ this.mChosenTextColor = mChosenTextColor;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentDayBackgroundDrawable(Drawable mCurrentDayBackgroundDrawable) {
+ this.mCurrentDayBackgroundDrawable = mCurrentDayBackgroundDrawable;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentMonthBackgroundDrawable(Drawable mCurrentMonthBackgroundDrawable) {
+ this.mCurrentMonthBackgroundDrawable = mCurrentMonthBackgroundDrawable;
+ return this;
+ }
+
+ public CalendarSettingWrapper setOtherMonthBackgroundDrawable(Drawable mOtherMonthBackgroundDrawable) {
+ this.mOtherMonthBackgroundDrawable = mOtherMonthBackgroundDrawable;
+ return this;
+ }
+
+ public CalendarSettingWrapper setCurrentMonthOtherDayBackgroundDrawable(Drawable mCurrentMonthOtherDayBackgroundDrawable) {
+ this.mCurrentMonthOtherDayBackgroundDrawable = mCurrentMonthOtherDayBackgroundDrawable;
+ return this;
+ }
+
+ public CalendarSettingWrapper setChosenBackgroundDrawable(Drawable mChosenBackgroundDrawable) {
+ this.mChosenBackgroundDrawable = mChosenBackgroundDrawable;
+ return this;
+ }
+ public int getDayTextSize() {
+ return mDayTextSize;
+ }
+ public Drawable getCurrentDayBackgroundDrawable() {
+ return mCurrentDayBackgroundDrawable;
+ }
+
+ public Drawable getCurrentMonthBackgroundDrawable() {
+ return mCurrentMonthBackgroundDrawable;
+ }
+
+ public Drawable getOtherMonthBackgroundDrawable() {
+ return mOtherMonthBackgroundDrawable;
+ }
+
+ public Drawable getCurrentMonthOtherDayBackgroundDrawable() {
+ return mCurrentMonthOtherDayBackgroundDrawable;
+ }
+
+ public Drawable getChosenBackgroundDrawable() {
+ return mChosenBackgroundDrawable;
+ }
+
+ public int getChosenBackgroundColor() {
+ return mChosenBackgroundColor;
+ }
+
+ public int getChosenTextStyle() {
+ return mChosenTextStyle;
+ }
+
+ public int getChosenTextColor() {
+ return mChosenTextColor;
+ }
+
+ List getVrCalendarUpdateListener() {
+ return mVrCalendarUpdateListeners;
+ }
+
+ void addVrCalendarUpdateListener(VRCalendarUpdateListener mVrCalendarUpdateListener) {
+ if (mVrCalendarUpdateListeners == null) {
+ mVrCalendarUpdateListeners = new ArrayList<>();
+ }
+ mVrCalendarUpdateListeners.add(mVrCalendarUpdateListener);
+ }
+
+ void removeVrCalendarUpdateListener(VRCalendarUpdateListener mVrCalendarUpdateListener) {
+ if (mVrCalendarUpdateListeners != null) {
+ mVrCalendarUpdateListeners.remove(mVrCalendarUpdateListener);
+ }
+ }
+
+ public VRCalendarMonthCallback getVRCalendarMonthCallback() {
+ return mVRCalendarMonthCallback;
+ }
+
+ public CalendarSettingWrapper setVRCalendarMonthCallback(VRCalendarMonthCallback callback) {
+ this.mVRCalendarMonthCallback = callback;
+ return this;
+ }
+
+ public void updateCalendarDay(VrCalendarDay day, boolean hasToSelect) {
+ List listeners = getVrCalendarUpdateListener();
+ if (listeners != null) {
+ for (VRCalendarUpdateListener listener : listeners) {
+ listener.updateItem(day, hasToSelect);
+ }
+ }
+ }
+
+ public void updateCalendar() {
+ List listeners = getVrCalendarUpdateListener();
+ if (listeners != null) {
+ for (VRCalendarUpdateListener listener : listeners) {
+ listener.updateAll();
+ }
+ }
+ }
+
+
+ public int getCurrentDayTextStyle() {
+ return mCurrentDayTextStyle;
+ }
+
+
+ public int getCurrentMonthTextStyle() {
+ return mCurrentMonthTextStyle;
+ }
+
+
+ public int getOtherMonthTextStyle() {
+ return mOtherMonthTextStyle;
+ }
+
+
+ public int getCurrentMonthOtherDayTextStyle() {
+ return mCurrentMonthOtherDayTextStyle;
+ }
+
+
+ public int getCurrentDayBackgroundColor() {
+ return mCurrentDayBackgroundColor;
+ }
+
+
+ public int getCurrentMonthBackgroundColor() {
+ return mCurrentMonthBackgroundColor;
+ }
+
+
+ public int getOtherMonthBackgroundColor() {
+ return mOtherMonthBackgroundColor;
+ }
+
+
+ public int getCurrentMonthOtherDayBackgroundColor() {
+ return mCurrentMonthOtherDayBackgroundColor;
+ }
+
+
+ public OnCalendarClickListener getOnCalendarClickListener() {
+ return mOnCalendarClickListener;
+ }
+
+
+ public OnCalendarLongClickListener getOnCalendarLongClickListener() {
+ return mOnCalendarLongClickListener;
+ }
+
+
+ public int getCurrentDayTextColor() {
+ return mCurrentDayTextColor;
+ }
+
+
+ public int getCurrentMonthTextColor() {
+ return mCurrentMonthTextColor;
+ }
+
+
+ public int getOtherMonthTextColor() {
+ return mOtherMonthTextColor;
+ }
+
+
+ public int getCurrentMonthOtherDayTextColor() {
+ return mCurrentMonthOtherDayTextColor;
+ }
+
+
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/DensityUtils.java b/calendar/src/main/java/com/vrgsoft/calendar/DensityUtils.java
new file mode 100644
index 0000000..ac4e989
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/DensityUtils.java
@@ -0,0 +1,22 @@
+package com.vrgsoft.calendar;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.util.DisplayMetrics;
+
+public class DensityUtils {
+
+
+ public static float convertDpToPixel(float dp, Context context) {
+ Resources resources = context.getResources();
+ DisplayMetrics metrics = resources.getDisplayMetrics();
+ return dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
+ }
+
+ public static float convertPixelsToDp(float px, Context context) {
+ Resources resources = context.getResources();
+ DisplayMetrics metrics = resources.getDisplayMetrics();
+ return px / ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
+ }
+
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/Settings.java b/calendar/src/main/java/com/vrgsoft/calendar/Settings.java
new file mode 100644
index 0000000..f7ffde4
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/Settings.java
@@ -0,0 +1,301 @@
+package com.vrgsoft.calendar;
+
+import android.graphics.drawable.Drawable;
+
+import com.vrgsoft.calendar.calendar_listeners.OnCalendarClickListener;
+import com.vrgsoft.calendar.calendar_listeners.OnCalendarLongClickListener;
+import com.vrgsoft.calendar.calendar_listeners.VRCalendarMonthCallback;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+
+public class Settings {
+ private OnCalendarClickListener mOnCalendarClickListener;
+ private OnCalendarLongClickListener mOnCalendarLongClickListener;
+ private VRCalendarMonthCallback mVRCalendarMonthCallback;
+ private DateFormat mDateFormat = new SimpleDateFormat("yyyy-MMMM", Locale.getDefault());
+
+ private int mCurrentDayTextColor;
+ private int mCurrentMonthTextColor;
+ private int mOtherMonthTextColor;
+ private int mCurrentMonthOtherDayTextColor;
+ private int mChosenTextColor;
+
+ private int mCurrentDayBackgroundColor;
+ private int mCurrentMonthBackgroundColor;
+ private int mOtherMonthBackgroundColor;
+ private int mCurrentMonthOtherDayBackgroundColor;
+ private int mChosenBackgroundColor;
+
+ private int mCurrentDayTextStyle;
+ private int mCurrentMonthTextStyle;
+ private int mOtherMonthTextStyle;
+ private int mCurrentMonthOtherDayTextStyle;
+ private int mChosenTextStyle;
+
+ private Drawable mCurrentDayBackgroundDrawable;
+ private Drawable mCurrentMonthBackgroundDrawable;
+ private Drawable mOtherMonthBackgroundDrawable;
+ private Drawable mCurrentMonthOtherDayBackgroundDrawable;
+ private Drawable mChosenBackgroundDrawable;
+
+ private int mNextMonthButton;
+ private int mPreviousMonthButton;
+
+ private int mDayTextSize;
+ private int mTitleTextSize;
+
+ private int mBackgroundColor;
+ private int mTitleTextColor;
+
+ private int mDayOfWeeksColor;
+
+ public int getDayOfWeeksColor() {
+ return mDayOfWeeksColor;
+ }
+
+ public void setDayOfWeeksColor(int dayOfWeeksColor) {
+ this.mDayOfWeeksColor = dayOfWeeksColor;
+ }
+
+ public void setNextMonthButton(int nextMonthButton) {
+ mNextMonthButton = nextMonthButton;
+ }
+
+ public void setPreviousMonthButton(int previousMonthButton) {
+ mPreviousMonthButton = previousMonthButton;
+ }
+
+ public void setDayTextSize(int dayTextSize) {
+ mDayTextSize = dayTextSize;
+ }
+
+ public void setTitleTextSize(int titleTextSize) {
+ mTitleTextSize = titleTextSize;
+ }
+
+ public void setBackgroundColor(int backgroundColor) {
+ mBackgroundColor = backgroundColor;
+ }
+
+ public void setTitleTextColor(int titleTextColor) {
+ mTitleTextColor = titleTextColor;
+ }
+
+ public void setCurrentDayBackgroundDrawable(Drawable currentDayBackgroundDrawable) {
+ mCurrentDayBackgroundDrawable = currentDayBackgroundDrawable;
+ }
+
+ public void setCurrentMonthBackgroundDrawable(Drawable currentMonthBackgroundDrawable) {
+ mCurrentMonthBackgroundDrawable = currentMonthBackgroundDrawable;
+ }
+
+ public void setOtherMonthBackgroundDrawable(Drawable otherMonthBackgroundDrawable) {
+ mOtherMonthBackgroundDrawable = otherMonthBackgroundDrawable;
+ }
+
+ public void setCurrentMonthOtherDayBackgroundDrawable(Drawable currentMonthOtherDayBackgroundDrawable) {
+ mCurrentMonthOtherDayBackgroundDrawable = currentMonthOtherDayBackgroundDrawable;
+ }
+
+ public void setChosenBackgroundDrawable(Drawable chosenBackgroundDrawable) {
+ mChosenBackgroundDrawable = chosenBackgroundDrawable;
+ }
+
+ public void setChosenBackgroundColor(int chosenBackgroundColor) {
+ mChosenBackgroundColor = chosenBackgroundColor;
+ }
+
+ public void setChosenTextStyle(int chosenTextStyle) {
+ mChosenTextStyle = chosenTextStyle;
+ }
+
+ public void setChosenTextColor(int chosenTextColor) {
+ mChosenTextColor = chosenTextColor;
+ }
+
+ public void setVRCalendarMonthCallback(VRCalendarMonthCallback vrCalendarMonthCallback) {
+ mVRCalendarMonthCallback = vrCalendarMonthCallback;
+ }
+
+ public void setCurrentDayTextStyle(int currentDayTextStyle) {
+ mCurrentDayTextStyle = currentDayTextStyle;
+ }
+
+ public void setCurrentMonthTextStyle(int currentMonthTextStyle) {
+ mCurrentMonthTextStyle = currentMonthTextStyle;
+ }
+
+ public void setOtherMonthTextStyle(int otherMonthTextStyle) {
+ mOtherMonthTextStyle = otherMonthTextStyle;
+ }
+
+ public void setCurrentMonthOtherDayTextStyle(int currentMonthOtherDayTextStyle) {
+ mCurrentMonthOtherDayTextStyle = currentMonthOtherDayTextStyle;
+ }
+
+ public void setCurrentDayBackgroundColor(int currentDayBackgroundColor) {
+ mCurrentDayBackgroundColor = currentDayBackgroundColor;
+ }
+
+ public void setCurrentMonthBackgroundColor(int currentMonthBackgroundColor) {
+ mCurrentMonthBackgroundColor = currentMonthBackgroundColor;
+ }
+
+ public void setOtherMonthBackgroundColor(int otherMonthBackgroundColor) {
+ mOtherMonthBackgroundColor = otherMonthBackgroundColor;
+ }
+
+ public void setCurrentMonthOtherDayBackgroundColor(int currentMonthOtherDayBackgroundColor) {
+ mCurrentMonthOtherDayBackgroundColor = currentMonthOtherDayBackgroundColor;
+ }
+
+ public void setOnCalendarClickListener(OnCalendarClickListener onCalendarClickListener) {
+ this.mOnCalendarClickListener = onCalendarClickListener;
+ }
+
+ public void setOnCalendarLongClickListener(OnCalendarLongClickListener onCalendarLongClickListener) {
+ this.mOnCalendarLongClickListener = onCalendarLongClickListener;
+ }
+
+ public void setDateFormat(DateFormat dateFormat) {
+ this.mDateFormat = dateFormat;
+ }
+
+ public void setCurrentDayTextColor(int currentDayTextColor) {
+ mCurrentDayTextColor = currentDayTextColor;
+ }
+
+ public void setCurrentMonthTextColor(int currentMonthTextColor) {
+ mCurrentMonthTextColor = currentMonthTextColor;
+ }
+
+ public void setOtherMonthTextColor(int otherMonthTextColor) {
+ mOtherMonthTextColor = otherMonthTextColor;
+ }
+
+ public void setCurrentMonthOtherDayTextColor(int currentMonthOtherDayTextColor) {
+ mCurrentMonthOtherDayTextColor = currentMonthOtherDayTextColor;
+ }
+
+ int getNextMonthButton() {
+ return mNextMonthButton;
+ }
+
+ int getPreviousMonthButton() {
+ return mPreviousMonthButton;
+ }
+
+ int getDayTextSize() {
+ return mDayTextSize;
+ }
+
+ int getTitleTextSize() {
+ return mTitleTextSize;
+ }
+
+ int getBackgroundColor() {
+ return mBackgroundColor;
+ }
+
+ int getTitleTextColor() {
+ return mTitleTextColor;
+ }
+
+ Drawable getCurrentDayBackgroundDrawable() {
+ return mCurrentDayBackgroundDrawable;
+ }
+
+ Drawable getCurrentMonthBackgroundDrawable() {
+ return mCurrentMonthBackgroundDrawable;
+ }
+
+ Drawable getOtherMonthBackgroundDrawable() {
+ return mOtherMonthBackgroundDrawable;
+ }
+
+ Drawable getCurrentMonthOtherDayBackgroundDrawable() {
+ return mCurrentMonthOtherDayBackgroundDrawable;
+ }
+
+ Drawable getChosenBackgroundDrawable() {
+ return mChosenBackgroundDrawable;
+ }
+
+ int getChosenBackgroundColor() {
+ return mChosenBackgroundColor;
+ }
+
+ int getChosenTextStyle() {
+ return mChosenTextStyle;
+ }
+
+ int getChosenTextColor() {
+ return mChosenTextColor;
+ }
+
+ VRCalendarMonthCallback getmVRCalendarMonthCallback() {
+ return mVRCalendarMonthCallback;
+ }
+
+ int getmCurrentDayTextStyle() {
+ return mCurrentDayTextStyle;
+ }
+
+ int getmCurrentMonthTextStyle() {
+ return mCurrentMonthTextStyle;
+ }
+
+ int getmOtherMonthTextStyle() {
+ return mOtherMonthTextStyle;
+ }
+
+ int getmCurrentMonthOtherDayTextStyle() {
+ return mCurrentMonthOtherDayTextStyle;
+ }
+
+ int getCurrentDayBackgroundColor() {
+ return mCurrentDayBackgroundColor;
+ }
+
+ int getCurrentMonthBackgroundColor() {
+ return mCurrentMonthBackgroundColor;
+ }
+
+ int getOtherMonthBackgroundColor() {
+ return mOtherMonthBackgroundColor;
+ }
+
+ int getCurrentMonthOtherDayBackgroundColor() {
+ return mCurrentMonthOtherDayBackgroundColor;
+ }
+
+ OnCalendarClickListener getOnCalendarClickListener() {
+ return mOnCalendarClickListener;
+ }
+
+ OnCalendarLongClickListener getOnCalendarLongClickListener() {
+ return mOnCalendarLongClickListener;
+ }
+
+ DateFormat getDateFormat() {
+ return mDateFormat;
+ }
+
+ int getCurrentDayTextColor() {
+ return mCurrentDayTextColor;
+ }
+
+ int getCurrentMonthTextColor() {
+ return mCurrentMonthTextColor;
+ }
+
+ int getOtherMonthTextColor() {
+ return mOtherMonthTextColor;
+ }
+
+ int getCurrentMonthOtherDayTextColor() {
+ return mCurrentMonthOtherDayTextColor;
+ }
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/VRCalendarCustomViewCallback.java b/calendar/src/main/java/com/vrgsoft/calendar/VRCalendarCustomViewCallback.java
new file mode 100644
index 0000000..aa92d49
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/VRCalendarCustomViewCallback.java
@@ -0,0 +1,9 @@
+package com.vrgsoft.calendar;
+
+import android.view.View;
+
+public interface VRCalendarCustomViewCallback {
+
+ View getNewCustomiseView();
+
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/VRCalendarHolder.java b/calendar/src/main/java/com/vrgsoft/calendar/VRCalendarHolder.java
new file mode 100644
index 0000000..1d15276
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/VRCalendarHolder.java
@@ -0,0 +1,47 @@
+package com.vrgsoft.calendar;
+
+import android.graphics.drawable.Drawable;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import android.widget.TextView;
+
+class VRCalendarHolder extends RecyclerView.ViewHolder {
+
+ TextView tvDay;
+ View vBackground;
+ FrameLayout vCustomBack;
+
+ VRCalendarHolder(View itemView) {
+ super(itemView);
+ tvDay = itemView.findViewById(R.id.tv_day);
+ vBackground = itemView.findViewById(R.id.vBackground);
+ vCustomBack = itemView.findViewById(R.id.vCustomBack);
+
+ }
+
+ void setTextToTextView(int style, int color, int textSize) {
+ tvDay.setTypeface(null, style);
+ tvDay.setTextColor(color);
+ tvDay.setTextSize(textSize);
+ }
+
+ void setBackgroundToView(int color, Drawable drawable) {
+ itemView.setBackgroundColor(color);
+ vBackground.setBackground(drawable);
+ }
+
+
+ void addCustomView(View newCustomiseView) {
+ if (newCustomiseView != null) {
+ ViewGroup viewGroup = (ViewGroup) newCustomiseView.getParent();
+ if (viewGroup != null) {
+ viewGroup.removeView(newCustomiseView);
+ }
+ vCustomBack.addView(newCustomiseView);
+ } else {
+ vCustomBack.removeAllViews();
+ }
+ }
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/VRCalendarView.java b/calendar/src/main/java/com/vrgsoft/calendar/VRCalendarView.java
new file mode 100644
index 0000000..514ff68
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/VRCalendarView.java
@@ -0,0 +1,247 @@
+package com.vrgsoft.calendar;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Color;
+import android.support.annotation.Nullable;
+import android.support.v4.content.ContextCompat;
+import android.support.v4.view.ViewPager;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+public class VRCalendarView extends LinearLayout {
+
+ public static final int NORMAL = 0;
+ public static final int BOLD = 1;
+ public static final int ITALIC = 2;
+
+ private CalendarPagerAdapter mCalendarPagerAdapter;
+ private ViewPager viewPager;
+ private DateFormat df = new SimpleDateFormat("yyyy-MMMM", Locale.getDefault());
+ private TextView tvCalendarDate;
+ private Context mContext;
+ private ImageButton mPrevious;
+ private ImageButton mNext;
+ private CalendarSettingWrapper mCalendarSettingWrapper;
+ private TextView[] mTvWeekDays;
+
+ public VRCalendarView(Context context) {
+ super(context);
+ mContext = context;
+ }
+
+ public VRCalendarView(Context context, @Nullable AttributeSet attrs) {
+ super(context, attrs);
+ mContext = context;
+ initAttributes(attrs);
+ }
+
+ public VRCalendarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ mContext = context;
+ initAttributes(attrs);
+ }
+
+ private void initAttributes(AttributeSet attributeSet) {
+ TypedArray typedArray = mContext.getTheme().obtainStyledAttributes(attributeSet
+ , R.styleable.VRCalendarView, 0, 0);
+ Settings settings;
+ try {
+ int color = ContextCompat.getColor(mContext, R.color.colorText);
+ settings = new com.vrgsoft.calendar.Settings();
+ settings.setCurrentDayTextColor(typedArray.getColor(R.styleable.VRCalendarView_vr_current_day_text_color, color));
+ settings.setCurrentMonthOtherDayTextColor(typedArray.getColor(R.styleable.VRCalendarView_vr_current_month_other_days_text_color, color));
+ settings.setCurrentMonthTextColor(typedArray.getColor(R.styleable.VRCalendarView_vr_current_month_text_color, color));
+ settings.setOtherMonthTextColor(typedArray.getColor(R.styleable.VRCalendarView_vr_other_month_text_color, color));
+ settings.setChosenTextColor(typedArray.getColor(R.styleable.VRCalendarView_vr_chosen_day_text_color, Color.WHITE));
+
+ color = ContextCompat.getColor(mContext, R.color.colorBackGround);
+ settings.setCurrentDayBackgroundColor(typedArray.getColor(R.styleable.VRCalendarView_vr_current_day_background_color, color));
+ settings.setCurrentMonthOtherDayBackgroundColor(typedArray.getColor(R.styleable.VRCalendarView_vr_current_month_other_days_background_color, color));
+ settings.setCurrentMonthBackgroundColor(typedArray.getColor(R.styleable.VRCalendarView_vr_current_month_background_color, color));
+ settings.setOtherMonthBackgroundColor(typedArray.getColor(R.styleable.VRCalendarView_vr_other_month_background_color, color));
+ settings.setChosenBackgroundColor(typedArray.getColor(R.styleable.VRCalendarView_vr_chosen_day_background_color, ContextCompat.getColor(mContext, R.color.colorText)));
+
+ settings.setCurrentDayTextStyle(typedArray.getInt(R.styleable.VRCalendarView_vr_current_day_text_style, BOLD));
+ settings.setCurrentMonthOtherDayTextStyle(typedArray.getInt(R.styleable.VRCalendarView_vr_current_month_other_days_text_style, NORMAL));
+ settings.setCurrentMonthTextStyle(typedArray.getInt(R.styleable.VRCalendarView_vr_current_month_text_style, NORMAL));
+ settings.setOtherMonthTextStyle(typedArray.getInt(R.styleable.VRCalendarView_vr_other_month_text_style, NORMAL));
+ settings.setChosenTextStyle(typedArray.getInt(R.styleable.VRCalendarView_vr_chosen_day_text_style, NORMAL));
+
+ int currentDayBackgroundDrawable = typedArray.getResourceId(R.styleable.VRCalendarView_vr_current_day_background_drawable, -1);
+ if (currentDayBackgroundDrawable > 0) {
+ settings.setCurrentDayBackgroundDrawable(ContextCompat.getDrawable(getContext(), currentDayBackgroundDrawable));
+ }
+ int currentMonthBackgroundDrawable = typedArray.getResourceId(R.styleable.VRCalendarView_vr_current_month_background_drawable, -1);
+ if (currentMonthBackgroundDrawable > 0) {
+ settings.setCurrentMonthBackgroundDrawable(ContextCompat.getDrawable(getContext(), currentMonthBackgroundDrawable));
+ }
+ int otherMonthBackgroundDrawable = typedArray.getResourceId(R.styleable.VRCalendarView_vr_other_month_background_drawable, -1);
+ if (otherMonthBackgroundDrawable > 0) {
+ settings.setOtherMonthBackgroundDrawable(ContextCompat.getDrawable(getContext(), otherMonthBackgroundDrawable));
+ }
+ int currentMonthOtherDayBackgroundDrawable = typedArray.getResourceId(R.styleable.VRCalendarView_vr_current_month_other_days_background_drawable, -1);
+ if (currentMonthOtherDayBackgroundDrawable > 0) {
+ settings.setCurrentMonthOtherDayBackgroundDrawable(ContextCompat.getDrawable(getContext(), currentMonthOtherDayBackgroundDrawable));
+ }
+ int chosenBackgroundDrawable = typedArray.getResourceId(R.styleable.VRCalendarView_vr_chosen_day_background_drawable, -1);
+ if (chosenBackgroundDrawable > 0) {
+ settings.setChosenBackgroundDrawable(ContextCompat.getDrawable(getContext(), chosenBackgroundDrawable));
+ }
+ settings.setNextMonthButton(typedArray.getResourceId(R.styleable.VRCalendarView_vr_next_button, -1));
+ settings.setPreviousMonthButton(typedArray.getResourceId(R.styleable.VRCalendarView_vr_previous_button, -1));
+
+ int dayTextSize = typedArray.getDimensionPixelSize(R.styleable.VRCalendarView_vr_calendar_day_text_size, -1);
+ settings.setDayTextSize(dayTextSize != -1 ? (int) DensityUtils.convertPixelsToDp(dayTextSize, getContext()) : 14);
+ settings.setTitleTextSize(typedArray.getDimensionPixelSize(R.styleable.VRCalendarView_vr_calendar_title_text_size, 14));
+
+ settings.setBackgroundColor(typedArray.getColor(R.styleable.VRCalendarView_vr_background_color, Color.BLACK));
+ settings.setTitleTextColor(typedArray.getColor(R.styleable.VRCalendarView_vr_title_text_color, Color.BLACK));
+ settings.setDayOfWeeksColor(typedArray.getColor(R.styleable.VRCalendarView_vr_week_days_color, Color.BLACK));
+
+ } finally {
+ typedArray.recycle();
+ }
+ setupViews(settings);
+ }
+
+ public void moveToDate(Date date) {
+ Calendar currentDate = Calendar.getInstance();
+ Calendar moveTo = Calendar.getInstance();
+ moveTo.setTimeInMillis(date.getTime());
+ int scrollTo = 0;
+ if (currentDate.getTimeInMillis() > moveTo.getTimeInMillis()) {
+ while (true) {
+ scrollTo--;
+ currentDate.add(Calendar.MONTH, -1);
+ if (currentDate.get(Calendar.YEAR) == moveTo.get(Calendar.YEAR) && currentDate.get(Calendar.MONTH) == moveTo.get(Calendar.MONTH)) {
+ break;
+ }
+ }
+ } else if (currentDate.getTimeInMillis() < moveTo.getTimeInMillis()) {
+ while (true) {
+ scrollTo++;
+ currentDate.add(Calendar.MONTH, 1);
+ if (currentDate.get(Calendar.YEAR) == moveTo.get(Calendar.YEAR) && currentDate.get(Calendar.MONTH) == moveTo.get(Calendar.MONTH)) {
+ break;
+ }
+ }
+ }
+ int pos = (CalendarPagerAdapter.MONTH_QUANTITY / 2 + scrollTo);
+ viewPager.setCurrentItem(pos);
+ }
+
+ public void setDateFormat(DateFormat dateFormat) {
+ df = dateFormat;
+ handleDateFormate();
+ }
+
+ public CalendarSettingWrapper getSettings() {
+ return mCalendarSettingWrapper;
+ }
+
+ public ImageButton getNextMonthImageButton() {
+ return mNext;
+ }
+
+ public ImageButton getPreviousMonthImageButton() {
+ return mPrevious;
+ }
+
+ public TextView getTitleCalendarDate() {
+ return tvCalendarDate;
+ }
+
+ public View weekContainer() {
+ return findViewById(R.id.rBarTitle);
+ }
+
+ public TextView getDayOfWeekTextView(int dayOfWeek) {
+ return mTvWeekDays[dayOfWeek];
+ }
+
+ public View getCalendarContainerView() {
+ return findViewById(R.id.container);
+ }
+
+ private void setupViews(Settings settings) {
+ setClickable(true);
+ inflate(mContext, R.layout.calendar_view, this);
+ tvCalendarDate = findViewById(R.id.tv_calendar_date);
+ viewPager = findViewById(R.id.view_pager);
+ mPrevious = findViewById(R.id.calendar_prev_month);
+ mTvWeekDays = new TextView[]{findViewById(R.id.tvMonday)
+ , findViewById(R.id.tvTuesday)
+ , findViewById(R.id.tvWednesday)
+ , findViewById(R.id.tvThursday)
+ , findViewById(R.id.tvFriday)
+ , findViewById(R.id.tvSaturday)
+ , findViewById(R.id.tvSunday)};
+ for (TextView textView : mTvWeekDays) {
+ textView.setTextColor(settings.getDayOfWeeksColor());
+ }
+ findViewById(R.id.container).setBackgroundColor(settings.getBackgroundColor());
+ mPrevious.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ viewPager.setCurrentItem(viewPager.getCurrentItem() - 1);
+ }
+ });
+ mNext = findViewById(R.id.calendar_next_month);
+ mNext.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
+ }
+ });
+ if (settings.getNextMonthButton() != -1) {
+ mNext.setImageResource(settings.getNextMonthButton());
+ }
+ if (settings.getPreviousMonthButton() != -1) {
+ mPrevious.setImageResource(settings.getPreviousMonthButton());
+ }
+
+ tvCalendarDate.setTextColor(settings.getTitleTextColor());
+ tvCalendarDate.setTextSize(settings.getTitleTextSize());
+ Date date = new Date();
+
+ tvCalendarDate.setText(df.format(date.getTime()));
+
+ mCalendarSettingWrapper = new CalendarSettingWrapper(settings);
+
+ mCalendarPagerAdapter = new CalendarPagerAdapter(mContext, mCalendarSettingWrapper);
+ viewPager.setAdapter(mCalendarPagerAdapter);
+ viewPager.setCurrentItem(CalendarPagerAdapter.MONTH_QUANTITY / 2);
+ viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
+ @Override
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+ }
+
+ @Override
+ public void onPageSelected(int position) {
+ handleDateFormate();
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int state) {
+ }
+ });
+ df = settings.getDateFormat();
+ }
+
+ private void handleDateFormate() {
+ Calendar currentDate = Calendar.getInstance();
+ currentDate.add(Calendar.MONTH, -(CalendarPagerAdapter.MONTH_QUANTITY / 2 - viewPager.getCurrentItem()));
+ tvCalendarDate.setText(df.format(currentDate.getTimeInMillis()));
+ }
+
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/VrCalendarDay.java b/calendar/src/main/java/com/vrgsoft/calendar/VrCalendarDay.java
new file mode 100644
index 0000000..5671da1
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/VrCalendarDay.java
@@ -0,0 +1,43 @@
+package com.vrgsoft.calendar;
+
+import java.util.Date;
+
+public class VrCalendarDay {
+
+ private VRCalendarCustomViewCallback customViewCallback;
+ private Date date;
+ private VrCalendarDaySettings vrCalendarDaySettings;
+ private boolean isChoosen;
+
+ boolean isChoosen() {
+ return isChoosen;
+ }
+
+ void setChoosen(boolean choosen) {
+ isChoosen = choosen;
+ }
+
+ public VrCalendarDaySettings getVrCalendarDaySettings() {
+ return vrCalendarDaySettings;
+ }
+
+ public void setVrCalendarDaySettings(VrCalendarDaySettings vrCalendarDaySettings) {
+ this.vrCalendarDaySettings = vrCalendarDaySettings;
+ }
+
+ public VRCalendarCustomViewCallback getVRCalendarCustomViewCallback() {
+ return customViewCallback;
+ }
+
+ public void setVRCalendarCustomViewCallback(VRCalendarCustomViewCallback callback) {
+ this.customViewCallback = callback;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/VrCalendarDaySettings.java b/calendar/src/main/java/com/vrgsoft/calendar/VrCalendarDaySettings.java
new file mode 100644
index 0000000..c4a3d62
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/VrCalendarDaySettings.java
@@ -0,0 +1,64 @@
+package com.vrgsoft.calendar;
+
+import android.graphics.drawable.Drawable;
+
+public class VrCalendarDaySettings {
+
+ private int mDayTextColor;
+ private int mDayBackgroundColor;
+ private Drawable mDayBackgroundDrawable;
+ private int mDayTextStyle;
+ private int mDayTextSize;
+ private int day;
+
+ public VrCalendarDaySettings() {
+ }
+
+ public int getDayTextSize() {
+ return mDayTextSize;
+ }
+
+ public void setDayTextSize(int mDayTextSize) {
+ this.mDayTextSize = mDayTextSize;
+ }
+
+ public Drawable getDayBackgroundDrawable() {
+ return mDayBackgroundDrawable;
+ }
+
+ public void setDayBackgroundDrawable(Drawable mDayBackgroundDrawable) {
+ this.mDayBackgroundDrawable = mDayBackgroundDrawable;
+ }
+
+ public int getDay() {
+ return day;
+ }
+
+ public void setDay(int day) {
+ this.day = day;
+ }
+
+ public int getDayTextColor() {
+ return mDayTextColor;
+ }
+
+ public void setDayTextColor(int mDayTextColor) {
+ this.mDayTextColor = mDayTextColor;
+ }
+
+ public int getDayBackgroundColor() {
+ return mDayBackgroundColor;
+ }
+
+ public void setDayBackgroundColor(int mDayBackgroundColor) {
+ this.mDayBackgroundColor = mDayBackgroundColor;
+ }
+
+ public int getDayTextStyle() {
+ return mDayTextStyle;
+ }
+
+ public void setDayTextStyle(int mDayTextStyle) {
+ this.mDayTextStyle = mDayTextStyle;
+ }
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/VrCalendarUtils.java b/calendar/src/main/java/com/vrgsoft/calendar/VrCalendarUtils.java
new file mode 100644
index 0000000..f325de5
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/VrCalendarUtils.java
@@ -0,0 +1,98 @@
+package com.vrgsoft.calendar;
+
+import android.graphics.drawable.Drawable;
+
+import java.util.Calendar;
+import java.util.Date;
+
+class VrCalendarUtils {
+
+ private Calendar calendar = Calendar.getInstance();
+ private Calendar calendarToday = Calendar.getInstance();
+
+ VrCalendarDaySettings getDaySettings(Calendar calendarMonth, Date date, CalendarSettingWrapper mCalendarSettingWrapper, VrCalendarDaySettings customSettings) {
+ VrCalendarDaySettings vrCalendarDaySettings = new VrCalendarDaySettings();
+ Date today = new Date();
+
+ calendar.setTimeInMillis(date.getTime());
+ calendarToday.setTimeInMillis(today.getTime());
+
+ if (customSettings == null) {
+ customSettings = new VrCalendarDaySettings();
+ }
+
+ if (calendar.get(Calendar.MONTH) == calendarToday.get(Calendar.MONTH) &&
+ calendar.get(Calendar.YEAR) == calendarToday.get(Calendar.YEAR) &&
+ calendar.get(Calendar.DAY_OF_MONTH) != calendarToday.get(Calendar.DAY_OF_MONTH)) {
+ setSettings(vrCalendarDaySettings, customSettings
+ , mCalendarSettingWrapper.getCurrentMonthTextStyle()
+ , mCalendarSettingWrapper.getCurrentMonthBackgroundColor()
+ , mCalendarSettingWrapper.getCurrentMonthTextColor()
+ , mCalendarSettingWrapper.getCurrentMonthBackgroundDrawable());
+ } else if (calendar.get(Calendar.MONTH) == calendarToday.get(Calendar.MONTH) &&
+ calendar.get(Calendar.YEAR) == calendarToday.get(Calendar.YEAR) &&
+ calendar.get(Calendar.DAY_OF_MONTH) == calendarToday.get(Calendar.DAY_OF_MONTH)) {
+ setSettings(vrCalendarDaySettings, customSettings
+ , mCalendarSettingWrapper.getCurrentDayTextStyle()
+ , mCalendarSettingWrapper.getCurrentDayBackgroundColor()
+ , mCalendarSettingWrapper.getCurrentDayTextColor()
+ , mCalendarSettingWrapper.getCurrentDayBackgroundDrawable());
+ } else if (calendar.get(Calendar.MONTH) != calendarToday.get(Calendar.MONTH) ||
+ calendar.get(Calendar.YEAR) != calendarToday.get(Calendar.YEAR)) {
+
+ if (calendarMonth != null && calendarMonth.get(Calendar.MONTH) == calendar.get(Calendar.MONTH)) {
+ setSettings(vrCalendarDaySettings, customSettings
+ , mCalendarSettingWrapper.getOtherMonthTextStyle()
+ , mCalendarSettingWrapper.getOtherMonthBackgroundColor()
+ , mCalendarSettingWrapper.getOtherMonthTextColor()
+ , mCalendarSettingWrapper.getOtherMonthBackgroundDrawable());
+ } else {
+ setSettings(vrCalendarDaySettings, customSettings
+ , mCalendarSettingWrapper.getCurrentMonthOtherDayTextStyle()
+ , mCalendarSettingWrapper.getCurrentMonthOtherDayBackgroundColor()
+ , mCalendarSettingWrapper.getCurrentMonthOtherDayTextColor()
+ , mCalendarSettingWrapper.getCurrentMonthOtherDayBackgroundDrawable());
+ }
+ }
+
+ vrCalendarDaySettings.setDay(calendar.get(Calendar.DAY_OF_MONTH));
+ vrCalendarDaySettings.setDayTextSize(customSettings.getDayTextSize() == 0 ? mCalendarSettingWrapper.getDayTextSize() : customSettings.getDayTextSize());
+
+ return vrCalendarDaySettings;
+ }
+
+ VrCalendarDay transfer(VrCalendarDay day, CalendarSettingWrapper calendarSettingWrapper, int position) {
+ Calendar currentDate = Calendar.getInstance();
+ currentDate.add(Calendar.MONTH, position);
+ VrCalendarDay vrCalendarDay = new VrCalendarDay();
+ vrCalendarDay.setChoosen(day.isChoosen());
+ vrCalendarDay.setDate(day.getDate());
+ vrCalendarDay.setVRCalendarCustomViewCallback(day.getVRCalendarCustomViewCallback());
+ vrCalendarDay.setVrCalendarDaySettings(getDaySettings(currentDate
+ , vrCalendarDay.getDate(), calendarSettingWrapper, day.getVrCalendarDaySettings()));
+ return vrCalendarDay;
+ }
+
+ private void setSettings(VrCalendarDaySettings settings, VrCalendarDaySettings customSettings, int style, int background, int text, Drawable backgroundDrawable) {
+ settings.setDayBackgroundColor(customSettings.getDayBackgroundColor() == 0
+ ? background : customSettings.getDayBackgroundColor());
+ settings.setDayTextColor(customSettings.getDayTextColor() == 0
+ ? text : customSettings.getDayTextColor());
+ settings.setDayTextStyle(customSettings.getDayTextStyle() == 0
+ ? style : customSettings.getDayTextStyle());
+ settings.setDayBackgroundDrawable(customSettings.getDayBackgroundDrawable() == null
+ ? backgroundDrawable : customSettings.getDayBackgroundDrawable());
+ }
+
+ static boolean isSameDay(Date myDate1, Date myDate2) {
+ Calendar calendar1 = Calendar.getInstance();
+ Calendar calendar2 = Calendar.getInstance();
+ calendar1.setTime(myDate1);
+ calendar2.setTime(myDate2);
+
+ return (calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH) &&
+ calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) &&
+ calendar1.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH));
+ }
+
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/WrapContentHeightViewPager.java b/calendar/src/main/java/com/vrgsoft/calendar/WrapContentHeightViewPager.java
new file mode 100644
index 0000000..09f37db
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/WrapContentHeightViewPager.java
@@ -0,0 +1,51 @@
+package com.vrgsoft.calendar;
+
+import android.content.Context;
+import android.support.v4.view.ViewPager;
+import android.util.AttributeSet;
+import android.view.View;
+
+public class WrapContentHeightViewPager extends ViewPager {
+
+ public WrapContentHeightViewPager(Context context) {
+ super(context);
+ }
+
+ public WrapContentHeightViewPager(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ // find the first child view
+ View view = getChildAt(0);
+ if (view != null) {
+ // measure the first child view with the specified measure spec
+ view.measure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ setMeasuredDimension(getMeasuredWidth(), measureHeight(heightMeasureSpec, view));
+ }
+
+ private int measureHeight(int measureSpec, View view) {
+ int result = 0;
+ int specMode = MeasureSpec.getMode(measureSpec);
+ int specSize = MeasureSpec.getSize(measureSpec);
+
+ if (specMode == MeasureSpec.EXACTLY) {
+ result = specSize;
+ } else {
+ // set the height from the base view if available
+ if (view != null) {
+ result = view.getMeasuredHeight();
+ }
+ if (specMode == MeasureSpec.AT_MOST) {
+ result = Math.min(result, specSize);
+ }
+ }
+ return result;
+ }
+
+}
\ No newline at end of file
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/OnCalendarClickListener.java b/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/OnCalendarClickListener.java
new file mode 100644
index 0000000..247ab25
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/OnCalendarClickListener.java
@@ -0,0 +1,7 @@
+package com.vrgsoft.calendar.calendar_listeners;
+
+import com.vrgsoft.calendar.VrCalendarDay;
+
+public interface OnCalendarClickListener {
+ void onCalendarDayClick(VrCalendarDay day);
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/OnCalendarLongClickListener.java b/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/OnCalendarLongClickListener.java
new file mode 100644
index 0000000..f9ce1e6
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/OnCalendarLongClickListener.java
@@ -0,0 +1,7 @@
+package com.vrgsoft.calendar.calendar_listeners;
+
+import com.vrgsoft.calendar.VrCalendarDay;
+
+public interface OnCalendarLongClickListener {
+ void onCalendarDayLongClick(VrCalendarDay day);
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/VRCalendarCustomViewCallback.java b/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/VRCalendarCustomViewCallback.java
new file mode 100644
index 0000000..0265b8f
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/VRCalendarCustomViewCallback.java
@@ -0,0 +1,11 @@
+package com.vrgsoft.calendar.calendar_listeners;
+
+import android.view.View;
+
+import com.vrgsoft.calendar.VrCalendarDay;
+
+public interface VRCalendarCustomViewCallback {
+
+ View getCustomView(VrCalendarDay day);
+
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/VRCalendarMonthCallback.java b/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/VRCalendarMonthCallback.java
new file mode 100644
index 0000000..e975125
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/VRCalendarMonthCallback.java
@@ -0,0 +1,12 @@
+package com.vrgsoft.calendar.calendar_listeners;
+
+import com.vrgsoft.calendar.VrCalendarDay;
+
+import java.util.Calendar;
+import java.util.List;
+
+public interface VRCalendarMonthCallback {
+
+ List getCustomizeDayView(Calendar calendar);
+
+}
diff --git a/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/VRCalendarUpdateListener.java b/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/VRCalendarUpdateListener.java
new file mode 100644
index 0000000..f2cc90b
--- /dev/null
+++ b/calendar/src/main/java/com/vrgsoft/calendar/calendar_listeners/VRCalendarUpdateListener.java
@@ -0,0 +1,10 @@
+package com.vrgsoft.calendar.calendar_listeners;
+
+import com.vrgsoft.calendar.VrCalendarDay;
+
+public interface VRCalendarUpdateListener {
+
+ void updateItem(VrCalendarDay day, boolean hasToSelect);
+ void updateAll();
+
+}
diff --git a/calendar/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_24dp.png b/calendar/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_24dp.png
new file mode 100644
index 0000000..05b3579
Binary files /dev/null and b/calendar/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_24dp.png differ
diff --git a/calendar/src/main/res/drawable-hdpi/ic_keyboard_arrow_right_black_24dp.png b/calendar/src/main/res/drawable-hdpi/ic_keyboard_arrow_right_black_24dp.png
new file mode 100644
index 0000000..67f890c
Binary files /dev/null and b/calendar/src/main/res/drawable-hdpi/ic_keyboard_arrow_right_black_24dp.png differ
diff --git a/calendar/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_black_24dp.png b/calendar/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_black_24dp.png
new file mode 100644
index 0000000..22b624b
Binary files /dev/null and b/calendar/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_black_24dp.png differ
diff --git a/calendar/src/main/res/drawable-mdpi/ic_keyboard_arrow_right_black_24dp.png b/calendar/src/main/res/drawable-mdpi/ic_keyboard_arrow_right_black_24dp.png
new file mode 100644
index 0000000..9a048f1
Binary files /dev/null and b/calendar/src/main/res/drawable-mdpi/ic_keyboard_arrow_right_black_24dp.png differ
diff --git a/calendar/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_black_24dp.png b/calendar/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_black_24dp.png
new file mode 100644
index 0000000..49ef87d
Binary files /dev/null and b/calendar/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_black_24dp.png differ
diff --git a/calendar/src/main/res/drawable-xhdpi/ic_keyboard_arrow_right_black_24dp.png b/calendar/src/main/res/drawable-xhdpi/ic_keyboard_arrow_right_black_24dp.png
new file mode 100644
index 0000000..073583e
Binary files /dev/null and b/calendar/src/main/res/drawable-xhdpi/ic_keyboard_arrow_right_black_24dp.png differ
diff --git a/calendar/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_black_24dp.png b/calendar/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_black_24dp.png
new file mode 100644
index 0000000..da52e03
Binary files /dev/null and b/calendar/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_black_24dp.png differ
diff --git a/calendar/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_right_black_24dp.png b/calendar/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_right_black_24dp.png
new file mode 100644
index 0000000..b96cfd1
Binary files /dev/null and b/calendar/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_right_black_24dp.png differ
diff --git a/calendar/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_black_24dp.png b/calendar/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_black_24dp.png
new file mode 100644
index 0000000..55f211b
Binary files /dev/null and b/calendar/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_black_24dp.png differ
diff --git a/calendar/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_right_black_24dp.png b/calendar/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_right_black_24dp.png
new file mode 100644
index 0000000..6f2dc5b
Binary files /dev/null and b/calendar/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_right_black_24dp.png differ
diff --git a/calendar/src/main/res/layout/calendar_view.xml b/calendar/src/main/res/layout/calendar_view.xml
new file mode 100644
index 0000000..10bedcb
--- /dev/null
+++ b/calendar/src/main/res/layout/calendar_view.xml
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calendar/src/main/res/layout/item_calendar_day.xml b/calendar/src/main/res/layout/item_calendar_day.xml
new file mode 100644
index 0000000..64bd6b1
--- /dev/null
+++ b/calendar/src/main/res/layout/item_calendar_day.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/calendar/src/main/res/layout/recycler_calendar.xml b/calendar/src/main/res/layout/recycler_calendar.xml
new file mode 100644
index 0000000..6d8653f
--- /dev/null
+++ b/calendar/src/main/res/layout/recycler_calendar.xml
@@ -0,0 +1,6 @@
+
+
\ No newline at end of file
diff --git a/calendar/src/main/res/values/attrs.xml b/calendar/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..fa9f55e
--- /dev/null
+++ b/calendar/src/main/res/values/attrs.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calendar/src/main/res/values/colors.xml b/calendar/src/main/res/values/colors.xml
new file mode 100644
index 0000000..ee342ec
--- /dev/null
+++ b/calendar/src/main/res/values/colors.xml
@@ -0,0 +1,5 @@
+
+
+ #000000
+ #00000000
+
diff --git a/calendar/src/main/res/values/strings.xml b/calendar/src/main/res/values/strings.xml
new file mode 100644
index 0000000..3ed3f1b
--- /dev/null
+++ b/calendar/src/main/res/values/strings.xml
@@ -0,0 +1,10 @@
+
+ library
+ Mon
+ Tue
+ Wed
+ Thu
+ Fri
+ Sat
+ Sun
+
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..aac7c9b
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,17 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..7a3a041
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Jun 08 14:43:09 EEST 2017
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/local.properties b/local.properties
new file mode 100644
index 0000000..16ea709
--- /dev/null
+++ b/local.properties
@@ -0,0 +1,12 @@
+## This file is automatically generated by Android Studio.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+#Wed Dec 27 15:46:24 EET 2017
+ndk.dir=/Users/MacMini/Library/Android/sdk/ndk-bundle
+sdk.dir=/Users/MacMini/Library/Android/sdk
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..70e7fe5
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app', ':calendar'