Skip to content
This repository was archived by the owner on Aug 4, 2024. It is now read-only.

Commit 69b10b1

Browse files
author
Nilanchala Panigrahy
committed
Initial commit
0 parents  commit 69b10b1

File tree

73 files changed

+2558
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2558
-0
lines changed

CustomCalendarSample.iml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.id="CustomCalendarSample" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="java-gradle" name="Java-Gradle">
5+
<configuration>
6+
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
7+
<option name="BUILDABLE" value="false" />
8+
</configuration>
9+
</facet>
10+
</component>
11+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
12+
<exclude-output />
13+
<content url="file://$MODULE_DIR$">
14+
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
15+
</content>
16+
<orderEntry type="inheritedJdk" />
17+
<orderEntry type="sourceFolder" forTests="false" />
18+
</component>
19+
</module>

CustomCalendarView.iml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.id="CustomCalendarView" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="java-gradle" name="Java-Gradle">
5+
<configuration>
6+
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
7+
<option name="BUILDABLE" value="false" />
8+
</configuration>
9+
</facet>
10+
</component>
11+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
12+
<exclude-output />
13+
<content url="file://$MODULE_DIR$">
14+
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
15+
</content>
16+
<orderEntry type="inheritedJdk" />
17+
<orderEntry type="sourceFolder" forTests="false" />
18+
</component>
19+
</module>

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/app.iml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="CustomCalendarView" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="android-gradle" name="Android-Gradle">
5+
<configuration>
6+
<option name="GRADLE_PROJECT_PATH" value=":app" />
7+
</configuration>
8+
</facet>
9+
<facet type="android" name="Android">
10+
<configuration>
11+
<option name="SELECTED_BUILD_VARIANT" value="debug" />
12+
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
13+
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
14+
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
15+
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
16+
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
17+
<afterSyncTasks>
18+
<task>generateDebugAndroidTestSources</task>
19+
<task>generateDebugSources</task>
20+
</afterSyncTasks>
21+
<option name="ALLOW_USER_CONFIGURATION" value="false" />
22+
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
23+
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
24+
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
25+
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
26+
</configuration>
27+
</facet>
28+
</component>
29+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
30+
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
31+
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
32+
<exclude-output />
33+
<content url="file://$MODULE_DIR$">
34+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
35+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
36+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
37+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
38+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
39+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
40+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
41+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
42+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
43+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
44+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
45+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
46+
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
47+
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
48+
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
49+
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
50+
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
51+
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
52+
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
53+
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
54+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
55+
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
56+
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
57+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
58+
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
59+
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
60+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
61+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
62+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
63+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
64+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
65+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
66+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
67+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
68+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
69+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
70+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
71+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
72+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
73+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
74+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.0.1/jars" />
76+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
77+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
78+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
79+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
80+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
81+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
82+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
83+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
84+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
85+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
86+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
87+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
88+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
89+
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
90+
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
91+
</content>
92+
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
93+
<orderEntry type="sourceFolder" forTests="false" />
94+
<orderEntry type="library" exported="" name="design-23.0.1" level="project" />
95+
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
96+
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
97+
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
98+
<orderEntry type="module" module-name="library" exported="" />
99+
</component>
100+
</module>

app/build.gradle

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion "22.0.1"
6+
7+
defaultConfig {
8+
applicationId "com.imanoweb.customcalendarsample"
9+
minSdkVersion 14
10+
targetSdkVersion 23
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
testCompile 'junit:junit:4.12'
25+
compile 'com.android.support:appcompat-v7:23.0.1'
26+
compile 'com.android.support:design:23.0.1'
27+
compile project(':library')
28+
}

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/nilanchalpanigrahy/Library/Android/sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}

app/src/main/AndroidManifest.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.imanoweb.customcalendarsample" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:theme="@style/AppTheme" >
10+
<activity
11+
android:name=".MainActivity"
12+
android:label="@string/app_name"
13+
android:theme="@style/AppTheme.NoActionBar" >
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN" />
16+
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
22+
</manifest>
51.9 KB
Binary file not shown.

app/src/main/ic_launcher-web.png

9.13 KB
Loading
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
package com.imanoweb.customcalendarsample;
2+
3+
/*
4+
* Copyright (C) 2015 ImanoWeb {link: http://imanoweb.com}.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import android.graphics.Color;
20+
import android.graphics.Typeface;
21+
import android.os.Bundle;
22+
import android.support.v7.app.AppCompatActivity;
23+
import android.support.v7.widget.Toolbar;
24+
import android.view.Menu;
25+
import android.view.MenuItem;
26+
import android.widget.Toast;
27+
import com.imanoweb.calendarview.CalendarListener;
28+
import com.imanoweb.calendarview.CustomCalendarView;
29+
import com.imanoweb.calendarview.DayDecorator;
30+
import com.imanoweb.calendarview.DayView;
31+
import java.text.SimpleDateFormat;
32+
import java.util.ArrayList;
33+
import java.util.Calendar;
34+
import java.util.Date;
35+
import java.util.List;
36+
import java.util.Locale;
37+
import java.util.Random;
38+
39+
public class MainActivity extends AppCompatActivity {
40+
CustomCalendarView calendarView;
41+
42+
@Override
43+
protected void onCreate(Bundle savedInstanceState) {
44+
super.onCreate(savedInstanceState);
45+
setContentView(R.layout.activity_main);
46+
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
47+
setSupportActionBar(toolbar);
48+
49+
//Initialize CustomCalendarView from layout
50+
calendarView = (CustomCalendarView) findViewById(R.id.calendar_view);
51+
52+
//Initialize calendar with date
53+
Calendar currentCalendar = Calendar.getInstance(Locale.getDefault());
54+
55+
//Show monday as first date of week
56+
calendarView.setFirstDayOfWeek(Calendar.MONDAY);
57+
58+
//Show/hide overflow days of a month
59+
calendarView.setShowOverflowDate(false);
60+
61+
//call refreshCalendar to update calendar the view
62+
calendarView.refreshCalendar(currentCalendar);
63+
64+
//Handling custom calendar events
65+
calendarView.setCalendarListener(new CalendarListener() {
66+
@Override
67+
public void onDateSelected(Date date) {
68+
SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
69+
Toast.makeText(MainActivity.this, df.format(date), Toast.LENGTH_SHORT).show();
70+
}
71+
72+
@Override
73+
public void onMonthChanged(Date date) {
74+
SimpleDateFormat df = new SimpleDateFormat("MM-yyyy");
75+
Toast.makeText(MainActivity.this, df.format(date), Toast.LENGTH_SHORT).show();
76+
}
77+
});
78+
79+
//Setting custom font
80+
/*final Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Arch_Rival_Bold.ttf");
81+
if (null != typeface) {
82+
calendarView.setCustomTypeface(typeface);
83+
calendarView.refreshCalendar(currentCalendar);
84+
}*/
85+
86+
87+
//adding calendar day decorators
88+
/*List<DayDecorator> decorators = new ArrayList<>();
89+
decorators.add(new ColorDecorator());
90+
calendarView.setDecorators(decorators);
91+
calendarView.refreshCalendar(currentCalendar);*/
92+
}
93+
94+
private class ColorDecorator implements DayDecorator {
95+
96+
@Override
97+
public void decorate(DayView cell) {
98+
Random rnd = new Random();
99+
int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
100+
cell.setBackgroundColor(color);
101+
}
102+
}
103+
104+
@Override
105+
public boolean onCreateOptionsMenu(Menu menu) {
106+
// Inflate the menu; this adds items to the action bar if it is present.
107+
getMenuInflater().inflate(R.menu.menu_main, menu);
108+
return true;
109+
}
110+
111+
@Override
112+
public boolean onOptionsItemSelected(MenuItem item) {
113+
// Handle action bar item clicks here. The action bar will
114+
// automatically handle clicks on the Home/Up button, so long
115+
// as you specify a parent activity in AndroidManifest.xml.
116+
int id = item.getItemId();
117+
118+
//noinspection SimplifiableIfStatement
119+
if (id == R.id.action_settings) {
120+
return true;
121+
}
122+
123+
return super.onOptionsItemSelected(item);
124+
}
125+
}

0 commit comments

Comments
 (0)