├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── drawable-hdpi
│ │ │ │ ├── ic_arrow_back_ios.png
│ │ │ │ └── ic_arrow_forward_ios.png
│ │ │ ├── drawable-mdpi
│ │ │ │ ├── ic_arrow_back_ios.png
│ │ │ │ └── ic_arrow_forward_ios.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ ├── ic_arrow_back_ios.png
│ │ │ │ └── ic_arrow_forward_ios.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── ic_arrow_back_ios.png
│ │ │ │ └── ic_arrow_forward_ios.png
│ │ │ ├── drawable-xxxhdpi
│ │ │ │ ├── ic_arrow_back_ios.png
│ │ │ │ └── ic_arrow_forward_ios.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ └── activity_main.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── skyhope
│ │ │ └── evencalneder
│ │ │ └── MainActivity.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── skyhope
│ │ │ └── evencalneder
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── skyhope
│ │ └── evencalneder
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── eventcalenderlibrary
├── .gitignore
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── res
│ │ │ ├── drawable-hdpi
│ │ │ │ ├── ic_arrow_left.png
│ │ │ │ └── ic_arrow_right.png
│ │ │ ├── drawable-mdpi
│ │ │ │ ├── ic_arrow_left.png
│ │ │ │ └── ic_arrow_right.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ ├── ic_arrow_left.png
│ │ │ │ └── ic_arrow_right.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── ic_arrow_left.png
│ │ │ │ └── ic_arrow_right.png
│ │ │ ├── drawable-xxxhdpi
│ │ │ │ ├── ic_arrow_left.png
│ │ │ │ └── ic_arrow_right.png
│ │ │ ├── drawable
│ │ │ │ ├── drawable_event.xml
│ │ │ │ ├── drawable_rectangular.xml
│ │ │ │ └── drawable_circle.xml
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ └── attrs.xml
│ │ │ └── layout
│ │ │ │ ├── item_day.xml
│ │ │ │ └── main_calender.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── skyhope
│ │ │ └── eventcalenderlibrary
│ │ │ ├── listener
│ │ │ └── CalenderDayClickListener.java
│ │ │ ├── helper
│ │ │ ├── TimeUtil.java
│ │ │ └── PreferenceHelper.java
│ │ │ ├── model
│ │ │ ├── Event.java
│ │ │ └── DayContainerModel.java
│ │ │ └── CalenderEvent.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── skyhope
│ │ │ └── eventcalenderlibrary
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── skyhope
│ │ └── eventcalenderlibrary
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── screen.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── vcs.xml
├── runConfigurations.xml
├── gradle.xml
├── codeStyles
│ └── Project.xml
└── misc.xml
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── README.md
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':eventcalenderlibrary'
2 |
--------------------------------------------------------------------------------
/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/screen.png
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | EvenCalneder
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_arrow_back_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/drawable-hdpi/ic_arrow_back_ios.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_arrow_back_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/drawable-mdpi/ic_arrow_back_ios.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_arrow_back_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/drawable-xhdpi/ic_arrow_back_ios.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_arrow_back_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/drawable-xxhdpi/ic_arrow_back_ios.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_arrow_forward_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/drawable-hdpi/ic_arrow_forward_ios.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_arrow_forward_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/drawable-mdpi/ic_arrow_forward_ios.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_arrow_forward_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/drawable-xhdpi/ic_arrow_forward_ios.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_arrow_back_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/drawable-xxxhdpi/ic_arrow_back_ios.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_arrow_forward_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/drawable-xxhdpi/ic_arrow_forward_ios.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_arrow_forward_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/app/src/main/res/drawable-xxxhdpi/ic_arrow_forward_ios.png
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable-hdpi/ic_arrow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/eventcalenderlibrary/src/main/res/drawable-hdpi/ic_arrow_left.png
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable-hdpi/ic_arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/eventcalenderlibrary/src/main/res/drawable-hdpi/ic_arrow_right.png
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable-mdpi/ic_arrow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/eventcalenderlibrary/src/main/res/drawable-mdpi/ic_arrow_left.png
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable-mdpi/ic_arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/eventcalenderlibrary/src/main/res/drawable-mdpi/ic_arrow_right.png
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable-xhdpi/ic_arrow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/eventcalenderlibrary/src/main/res/drawable-xhdpi/ic_arrow_left.png
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable-xhdpi/ic_arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/eventcalenderlibrary/src/main/res/drawable-xhdpi/ic_arrow_right.png
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable-xxhdpi/ic_arrow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/eventcalenderlibrary/src/main/res/drawable-xxhdpi/ic_arrow_left.png
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable-xxhdpi/ic_arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/eventcalenderlibrary/src/main/res/drawable-xxhdpi/ic_arrow_right.png
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable-xxxhdpi/ic_arrow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/eventcalenderlibrary/src/main/res/drawable-xxxhdpi/ic_arrow_left.png
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable-xxxhdpi/ic_arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mahimrocky/EventCalender/HEAD/eventcalenderlibrary/src/main/res/drawable-xxxhdpi/ic_arrow_right.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable/drawable_event.xml:
--------------------------------------------------------------------------------
1 |
3 |
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches/build_file_checksums.ser
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | .DS_Store
9 | /build
10 | /captures
11 | .externalNativeBuild
12 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable/drawable_rectangular.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/drawable/drawable_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | EventCalenderLibrary
3 | Sun
4 | Mon
5 | Tue
6 | Wed
7 | Thu
8 | Fri
9 | Sat
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/skyhope/evencalneder/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.evencalneder;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/test/java/com/skyhope/eventcalenderlibrary/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.eventcalenderlibrary;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/layout/item_day.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
16 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/java/com/skyhope/eventcalenderlibrary/listener/CalenderDayClickListener.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.eventcalenderlibrary.listener;
2 |
3 | import com.skyhope.eventcalenderlibrary.model.DayContainerModel;
4 | /*
5 | * ****************************************************************************
6 | * * Created by : Md Tariqul Islam on 11/30/2018 at 12:36 PM.
7 | * * Email : tariqul@w3engineers.com
8 | * *
9 | * * Purpose:
10 | * *
11 | * * Last edited by : Md Tariqul Islam on 11/30/2018.
12 | * *
13 | * * Last Reviewed by : on
14 | * ****************************************************************************
15 | */
16 |
17 |
18 | public interface CalenderDayClickListener {
19 |
20 | void onGetDay(DayContainerModel dayContainerModel);
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/skyhope/evencalneder/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.evencalneder;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.skyhope.evencalneder", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/androidTest/java/com/skyhope/eventcalenderlibrary/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.eventcalenderlibrary;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.skyhope.eventcalenderlibrary.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 16
10 | targetSdkVersion 28
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: 'libs', include: ['*.jar'])
29 |
30 | implementation 'com.android.support:appcompat-v7:28.0.0'
31 | testImplementation 'junit:junit:4.12'
32 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
33 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
34 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.skyhope.evencalneder"
7 | minSdkVersion 16
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(include: ['*.jar'], dir: 'libs')
23 | implementation 'com.android.support:appcompat-v7:28.0.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28 | implementation project(':eventcalenderlibrary')
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/skyhope/evencalneder/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.evencalneder;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.util.Log;
6 |
7 | import com.skyhope.eventcalenderlibrary.CalenderEvent;
8 | import com.skyhope.eventcalenderlibrary.listener.CalenderDayClickListener;
9 | import com.skyhope.eventcalenderlibrary.model.DayContainerModel;
10 | import com.skyhope.eventcalenderlibrary.model.Event;
11 |
12 | import java.util.Calendar;
13 |
14 | public class MainActivity extends AppCompatActivity {
15 | private static final String TAG = "CalenderTest";
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_main);
21 |
22 | CalenderEvent calenderEvent = findViewById(R.id.calender_event);
23 |
24 | Calendar calendar = Calendar.getInstance();
25 | calendar.add(Calendar.DAY_OF_MONTH, 1);
26 | Event event = new Event(calendar.getTimeInMillis(), "Test");
27 | calenderEvent.addEvent(event);
28 |
29 | calenderEvent.initCalderItemClickCallback(new CalenderDayClickListener() {
30 | @Override
31 | public void onGetDay(DayContainerModel dayContainerModel) {
32 | Log.d(TAG, dayContainerModel.getDate());
33 | }
34 | });
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/java/com/skyhope/eventcalenderlibrary/helper/TimeUtil.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.eventcalenderlibrary.helper;
2 |
3 | import java.text.DateFormat;
4 | import java.text.ParseException;
5 | import java.text.SimpleDateFormat;
6 | import java.util.Date;
7 | import java.util.Locale;
8 | import java.util.TimeZone;
9 | /*
10 | * ****************************************************************************
11 | * * Created by : Md Tariqul Islam on 11/30/2018 at 12:04 PM.
12 | * * Email : tariqul@w3engineers.com
13 | * *
14 | * * Purpose:
15 | * *
16 | * * Last edited by : Md Tariqul Islam on 11/30/2018.
17 | * *
18 | * * Last Reviewed by : on
19 | * ****************************************************************************
20 | */
21 |
22 |
23 | public class TimeUtil {
24 | private static final String DATE_FORMAT_1 = "dd MMMM yyyy";
25 |
26 | public static long getTimestamp(String dateString) {
27 | try {
28 | Date date = new SimpleDateFormat(DATE_FORMAT_1, Locale.ENGLISH).parse(dateString);
29 | return date.getTime();
30 | } catch (ParseException e) {
31 | e.printStackTrace();
32 | }
33 | return 0;
34 | }
35 |
36 | public static String getDate(long time) {
37 | Date date = new Date(time);
38 | DateFormat format = new SimpleDateFormat(DATE_FORMAT_1, Locale.getDefault());
39 | format.setTimeZone(TimeZone.getDefault());
40 | return format.format(date);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/java/com/skyhope/eventcalenderlibrary/model/Event.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.eventcalenderlibrary.model;
2 |
3 | /*
4 | * ****************************************************************************
5 | * * Created by : Md Tariqul Islam on 11/30/2018 at 11:40 AM.
6 | * * Email : tariqul@w3engineers.com
7 | * *
8 | * * Purpose:
9 | * *
10 | * * Last edited by : Md Tariqul Islam on 11/30/2018.
11 | * *
12 | * * Last Reviewed by : on
13 | * ****************************************************************************
14 | */
15 |
16 | public class Event {
17 | private long time;
18 | private String eventText;
19 | private int eventColor;
20 |
21 | public Event(long time, String eventText) {
22 | this.time = time;
23 | this.eventText = eventText;
24 | }
25 |
26 | public Event(long time, String eventText, int eventColor) {
27 | this.time = time;
28 | this.eventText = eventText;
29 | this.eventColor = eventColor;
30 | }
31 |
32 | public long getTime() {
33 | return time;
34 | }
35 |
36 | public void setTime(long time) {
37 | this.time = time;
38 | }
39 |
40 | public String getEventText() {
41 | return eventText;
42 | }
43 |
44 | public void setEventText(String eventText) {
45 | this.eventText = eventText;
46 | }
47 |
48 | public int getEventColor() {
49 | return eventColor;
50 | }
51 |
52 | public void setEventColor(int eventColor) {
53 | this.eventColor = eventColor;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/java/com/skyhope/eventcalenderlibrary/helper/PreferenceHelper.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.eventcalenderlibrary.helper;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | /*
6 | * ****************************************************************************
7 | * * Created by : Md Tariqul Islam on 12/11/2018 at 12:57 PM.
8 | * * Email : tariqul@w3engineers.com
9 | * *
10 | * * Purpose:
11 | * *
12 | * * Last edited by : Md Tariqul Islam on 12/11/2018.
13 | * *
14 | * * Last Reviewed by : on
15 | * ****************************************************************************
16 | */
17 |
18 |
19 | public class PreferenceHelper {
20 | private static PreferenceHelper sInstance;
21 | private SharedPreferences mSharedPreferences;
22 |
23 | public static PreferenceHelper init(Context context) {
24 | if (sInstance == null) {
25 | sInstance = new PreferenceHelper(context);
26 | }
27 | return sInstance;
28 | }
29 |
30 | public PreferenceHelper(Context context) {
31 | mSharedPreferences = context.getSharedPreferences("EventCalender", Context.MODE_PRIVATE);
32 | }
33 |
34 | public void write(String key, String value) {
35 | SharedPreferences.Editor mEditor = mSharedPreferences.edit();
36 | mEditor.putString(key, value);
37 | mEditor.apply();
38 | }
39 |
40 | public void write(String key, int value) {
41 | SharedPreferences.Editor mEditor = mSharedPreferences.edit();
42 | mEditor.putInt(key, value);
43 | mEditor.apply();
44 | }
45 |
46 | public String readString(String key) {
47 | return mSharedPreferences.getString(key, null);
48 | }
49 |
50 | public int readInteger(String key) {
51 | return mSharedPreferences.getInt(key, 0);
52 | }
53 |
54 | public void remove(String key) {
55 | SharedPreferences.Editor mEditor = mSharedPreferences.edit();
56 | mEditor.remove(key);
57 | mEditor.apply();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/java/com/skyhope/eventcalenderlibrary/model/DayContainerModel.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.eventcalenderlibrary.model;
2 |
3 | /*
4 | * ****************************************************************************
5 | * * Created by : Md Tariqul Islam on 11/29/2018 at 6:49 PM.
6 | * * Email : tariqul@w3engineers.com
7 | * *
8 | * * Purpose:
9 | * *
10 | * * Last edited by : Md Tariqul Islam on 11/29/2018.
11 | * *
12 | * * Last Reviewed by : on
13 | * ****************************************************************************
14 | */
15 |
16 | public class DayContainerModel {
17 | private int year;
18 | private String month;
19 | private int monthNumber;
20 | private int day;
21 | private int index;
22 | private long timeInMillisecond;
23 | private String date;
24 | private boolean haveEvent;
25 | private Event event;
26 |
27 | public int getYear() {
28 | return year;
29 | }
30 |
31 | public void setYear(int year) {
32 | this.year = year;
33 | }
34 |
35 | public String getMonth() {
36 | return month;
37 | }
38 |
39 | public void setMonth(String month) {
40 | this.month = month;
41 | }
42 |
43 | public int getMonthNumber() {
44 | return monthNumber;
45 | }
46 |
47 | public void setMonthNumber(int monthNumber) {
48 | this.monthNumber = monthNumber;
49 | }
50 |
51 | public int getDay() {
52 | return day;
53 | }
54 |
55 | public void setDay(int day) {
56 | this.day = day;
57 | }
58 |
59 | public int getIndex() {
60 | return index;
61 | }
62 |
63 | public void setIndex(int index) {
64 | this.index = index;
65 | }
66 |
67 | public long getTimeInMillisecond() {
68 | return timeInMillisecond;
69 | }
70 |
71 | public void setTimeInMillisecond(long timeInMillisecond) {
72 | this.timeInMillisecond = timeInMillisecond;
73 | }
74 |
75 | public String getDate() {
76 | return date;
77 | }
78 |
79 | public void setDate(String date) {
80 | this.date = date;
81 | }
82 |
83 | public boolean isHaveEvent() {
84 | return haveEvent;
85 | }
86 |
87 | public void setHaveEvent(boolean haveEvent) {
88 | this.haveEvent = haveEvent;
89 | }
90 |
91 | public Event getEvent() {
92 | return event;
93 | }
94 |
95 | public void setEvent(Event event) {
96 | this.event = event;
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # CalenderEvent
3 |
4 | This is the simple library of calender, where you can set event on specific date. And this calender you can customize all section.
5 |
6 | For this version **we are not set any off or holiday** We will add in next version. So this library is simple to use.
7 |
8 | Sample
9 | 
10 |
11 | Following instructions you have to follow to use Expandable Card view
12 |
13 | # Root Gradle
14 | ```sh
15 | allprojects {
16 | repositories {
17 | ...
18 | maven { url 'https://jitpack.io' }
19 | }
20 | }
21 | ```
22 |
23 | # App Gradle:
24 |
25 | ```sh
26 | dependencies {
27 | implementation 'com.github.mahimrocky:EventCalender:v1.0.0'
28 | }
29 | ```
30 |
31 | # XML Section
32 |
33 | ```sh
34 |
38 |
39 | ```
40 |
41 | ### By below options you can change or customize the view
42 |
43 | | Attributes | Purpose |
44 | | ------ | ------ |
45 | | ```app:selector_color```| To change Selector color|
46 | | ```app:current_month_day_color```| To change current month days color|
47 | | ```app:off_month_day_colorr```| To change off month days color|
48 | | ```app:week_name_color```| To change week name color (sun,mon etc)|
49 | | ```app:month_colorn```| To change month title color|
50 | | ```app:next_icon```| To change next month icon|
51 | | ```app:previous_icon```| To change previous month icon|
52 | | ```app:app:calender_background```| To change total calender background color|
53 | | ```app:selected_day_text_color```| To selected day text color|
54 |
55 | ### How to set event?
56 | ```sh
57 | CalenderEvent calenderEvent = findViewById(R.id.calender_event);
58 | Event event = new Event(calendar.getTimeInMillis(), "Test");
59 | // to set desire day time milli second in first parameter
60 | //or you set color for each event
61 | Event event = new Event(calendar.getTimeInMillis(), "Test",Color.RED);
62 | calenderEvent.addEvent(event);
63 | ```
64 |
65 | for remove event you can call
66 | ```sh
67 | calenderEvent.removeEvent(event);
68 | ```
69 | for each item click get all date or event. Below section you will get event,time,date. ***Remember dayContainerModel.getEvent() give you null if you don`t set any event*** so check ***dayContainerModel.isHaveEvent()***
70 | ```sh
71 | calenderEvent.initCalderItemClickCallback(new CalenderDayClickListener() {
72 | @Override
73 | public void onGetDay(DayContainerModel dayContainerModel) {
74 | Log.d(TAG, dayContainerModel.getDate());
75 | }
76 | });
77 | ```
78 | # Happy Coding
79 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/res/layout/main_calender.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
20 |
21 |
33 |
34 |
42 |
43 |
44 |
45 |
51 |
52 |
59 |
60 |
67 |
68 |
75 |
76 |
83 |
84 |
91 |
92 |
99 |
100 |
107 |
108 |
109 |
110 |
116 |
117 |
123 |
124 |
130 |
131 |
137 |
138 |
144 |
145 |
151 |
152 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/eventcalenderlibrary/src/main/java/com/skyhope/eventcalenderlibrary/CalenderEvent.java:
--------------------------------------------------------------------------------
1 | package com.skyhope.eventcalenderlibrary;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Color;
6 | import android.graphics.drawable.Drawable;
7 | import android.support.annotation.Nullable;
8 | import android.support.v4.graphics.drawable.DrawableCompat;
9 | import android.text.InputFilter;
10 | import android.util.AttributeSet;
11 | import android.util.DisplayMetrics;
12 | import android.util.Log;
13 | import android.view.Gravity;
14 | import android.view.LayoutInflater;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 | import android.widget.Button;
18 | import android.widget.LinearLayout;
19 | import android.widget.TextView;
20 | import android.widget.Toast;
21 |
22 | import com.skyhope.eventcalenderlibrary.helper.PreferenceHelper;
23 | import com.skyhope.eventcalenderlibrary.helper.TimeUtil;
24 | import com.skyhope.eventcalenderlibrary.listener.CalenderDayClickListener;
25 | import com.skyhope.eventcalenderlibrary.model.DayContainerModel;
26 | import com.skyhope.eventcalenderlibrary.model.Event;
27 |
28 | import java.sql.Time;
29 | import java.util.ArrayList;
30 | import java.util.Calendar;
31 | import java.util.List;
32 | /*
33 | * ****************************************************************************
34 | * * Created by : Md Tariqul Islam on 11/29/2018 at 3:03 PM.
35 | * * Email : tariqul@w3engineers.com
36 | * *
37 | * * Purpose:
38 | * *
39 | * * Last edited by : Md Tariqul Islam on 11/29/2018.
40 | * *
41 | * * Last Reviewed by : on
42 | * ****************************************************************************
43 | */
44 |
45 |
46 | public class CalenderEvent extends LinearLayout implements View.OnClickListener {
47 |
48 | private static final String TAG = "CalenderEvent";
49 |
50 | private LinearLayout weekOneLayout;
51 | private LinearLayout weekTwoLayout;
52 | private LinearLayout weekThreeLayout;
53 | private LinearLayout weekFourLayout;
54 | private LinearLayout weekFiveLayout;
55 | private LinearLayout weekSixLayout;
56 |
57 | private static final String[] MONTH_NAMES = {"January", "February", "March", "April",
58 | "May", "June", "July", "August",
59 | "September", "October", "November", "December"};
60 |
61 | private LinearLayout[] weeks;
62 | private TextView[] days;
63 | private LinearLayout[] daysContainer;
64 | private TextView[] eventsTextViewList;
65 |
66 | private static final String TEXT_EVENT = " TEXT";
67 | private static final String COLOR_EVENT = " COLOR";
68 |
69 | private Button buttonPrevious, buttonNext;
70 |
71 | private TextView textViewMonthName;
72 |
73 | private Calendar mCalendar;
74 |
75 | private static final String CUSTOM_GREY = "#a0a0a0";
76 |
77 | private Context mContext;
78 |
79 | private List dayContainerList;
80 |
81 | private String mToday;
82 |
83 | //selected color element
84 | private TextView mSelectedTexView;
85 | private LinearLayout mSelectedLinearLayout;
86 | private int mPreviousColor;
87 |
88 |
89 | private PreferenceHelper preferenceHelper;
90 |
91 | private CalenderDayClickListener mCalenderDayClickListener;
92 |
93 | // View component
94 | private View mainView;
95 |
96 | // View setter component;
97 | private int mBackgroundColor;
98 | private int mSelectorColor;
99 | private int mSelectedDayTextColor;
100 | private int mCurrentMonthDayColor;
101 | private int mOffMonthDayColor;
102 | private int mMonthTextColor;
103 | private int mWeekNameColor;
104 |
105 | private Drawable nextButtonDrawable;
106 | private Drawable prevButtonDrawable;
107 |
108 | // Default component
109 | private static final int DEFAULT_BACKGROUND_COLOR = Color.WHITE;
110 | private static final int DEFAULT_SELECTED_DAY_COLOR = Color.WHITE;
111 | private static final int DEFAULT_CURRENT_MONTH_DAY_COLOR = Color.BLACK;
112 | private static final int DEFAULT_OFF_MONTH_DAY_COLOR = Color.parseColor(CUSTOM_GREY);
113 | private static final int DEFAULT_SELECTOR_COLOR = Color.parseColor("#C2CA83");
114 | private static final int DEFAULT_TEXT_COLOR = Color.parseColor("#808080");
115 |
116 |
117 | public CalenderEvent(Context context) {
118 | super(context);
119 | }
120 |
121 | public CalenderEvent(Context context, @Nullable AttributeSet attrs) {
122 | super(context, attrs);
123 |
124 |
125 | initAttrs(attrs);
126 |
127 | initView(context);
128 |
129 | preferenceHelper = PreferenceHelper.init(context);
130 | }
131 |
132 |
133 | @Override
134 | protected void onFinishInflate() {
135 | super.onFinishInflate();
136 |
137 | weekOneLayout = findViewById(R.id.calendar_week_1);
138 | weekTwoLayout = findViewById(R.id.calendar_week_2);
139 | weekThreeLayout = findViewById(R.id.calendar_week_3);
140 | weekFourLayout = findViewById(R.id.calendar_week_4);
141 | weekFiveLayout = findViewById(R.id.calendar_week_5);
142 | weekSixLayout = findViewById(R.id.calendar_week_6);
143 |
144 | buttonNext = findViewById(R.id.button_next);
145 | buttonPrevious = findViewById(R.id.button_previous);
146 |
147 | textViewMonthName = findViewById(R.id.text_view_month_name);
148 |
149 | // week container
150 | LinearLayout linearLayoutWeak = findViewById(R.id.linear_layout_week);
151 |
152 | weeks = new LinearLayout[6];
153 | days = new TextView[6 * 7];
154 | eventsTextViewList = new TextView[6 * 7];
155 | daysContainer = new LinearLayout[6 * 7];
156 |
157 | weeks[0] = weekOneLayout;
158 | weeks[1] = weekTwoLayout;
159 | weeks[2] = weekThreeLayout;
160 | weeks[3] = weekFourLayout;
161 | weeks[4] = weekFiveLayout;
162 | weeks[5] = weekSixLayout;
163 |
164 | DisplayMetrics metrics = getResources().getDisplayMetrics();
165 |
166 | mCalendar = Calendar.getInstance();
167 | mToday = mCalendar.get(Calendar.DATE) + " " + MONTH_NAMES[mCalendar.get(Calendar.MONTH)] + " " + mCalendar.get(Calendar.YEAR);
168 |
169 | Log.d(TAG, "Today, " + mToday);
170 |
171 | initDaysInCalender(getdaysLayoutParams(), mContext, metrics);
172 |
173 | initCalender(mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH));
174 |
175 | buttonPrevious.setOnClickListener(this);
176 | buttonNext.setOnClickListener(this);
177 |
178 | // set view element
179 | mainView.setBackgroundColor(mBackgroundColor);
180 |
181 | textViewMonthName.setTextColor(mMonthTextColor);
182 |
183 | for (int i = 0; i < linearLayoutWeak.getChildCount(); i++) {
184 | TextView textViewWeek = (TextView) linearLayoutWeak.getChildAt(i);
185 | textViewWeek.setTextColor(mWeekNameColor);
186 | }
187 |
188 | if (nextButtonDrawable != null) {
189 | buttonNext.setBackground(nextButtonDrawable);
190 | }
191 | if (prevButtonDrawable != null) {
192 | buttonPrevious.setBackground(prevButtonDrawable);
193 | }
194 |
195 | }
196 |
197 | @Override
198 | public void onClick(View view) {
199 | if (view.getId() == R.id.button_next) {
200 | gotoNextMonth();
201 | } else if (view.getId() == R.id.button_previous) {
202 | gotoPreviousMonth();
203 | }
204 | }
205 |
206 |
207 | private void initCalender(int selectedYear, int selectedMonth) {
208 |
209 | dayContainerList = new ArrayList<>();
210 |
211 | mCalendar.set(selectedYear, selectedMonth, 1);
212 |
213 | textViewMonthName.setText(MONTH_NAMES[selectedMonth] + ", " + selectedYear);
214 |
215 | int daysInCurrentMonth = mCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
216 |
217 |
218 | int index = 0;
219 |
220 | int firstDayOfCurrentMonth = mCalendar.get(Calendar.DAY_OF_WEEK);
221 |
222 | int previousLeftMonthDays = firstDayOfCurrentMonth - 1;
223 |
224 | int nextMonthDays = 42 - (daysInCurrentMonth + previousLeftMonthDays);
225 |
226 | // now set previous date
227 |
228 | if (previousLeftMonthDays != 0) {
229 | int prevMonth;
230 | int prevYear;
231 | if (selectedMonth > 0) {
232 | mCalendar.set(selectedYear, selectedMonth - 1, 1);
233 | prevMonth = selectedMonth - 1;
234 | prevYear = selectedYear;
235 | } else {
236 | mCalendar.set(selectedYear - 1, 11, 1);
237 | prevMonth = 11;
238 | prevYear = selectedYear - 1;
239 | }
240 |
241 | int previousMonthTotalDays = mCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
242 |
243 | mCalendar.set(prevYear, prevMonth, (previousMonthTotalDays - previousLeftMonthDays));
244 | int prevCurrentDay = mCalendar.get(Calendar.DATE);
245 | prevCurrentDay++;
246 | for (int i = 0; i < previousLeftMonthDays; i++) {
247 | days[index].setText(String.valueOf(prevCurrentDay));
248 | days[index].setTextColor(mOffMonthDayColor);
249 |
250 | final DayContainerModel model = new DayContainerModel();
251 | model.setIndex(index);
252 | model.setYear(prevYear);
253 | model.setMonthNumber(prevMonth);
254 | model.setMonth(MONTH_NAMES[prevMonth]);
255 | model.setDay(prevCurrentDay);
256 | String date = model.getDay() + " " + model.getMonth() + " " + model.getYear();
257 | model.setDate(date);
258 | model.setTimeInMillisecond(TimeUtil.getTimestamp(date));
259 |
260 | Event event = getEvent(model.getTimeInMillisecond());
261 | model.setEvent(event);
262 | model.setHaveEvent(event != null);
263 |
264 | if (model.isHaveEvent()) {
265 | eventsTextViewList[index].setText(event.getEventText());
266 | eventsTextViewList[index].setVisibility(VISIBLE);
267 | eventsTextViewList[index].setTextColor(event.getEventColor());
268 | } else {
269 | eventsTextViewList[index].setVisibility(INVISIBLE);
270 | }
271 |
272 | dayContainerList.add(model);
273 |
274 | final int finalIndex = index;
275 | days[index].setOnClickListener(new OnClickListener() {
276 | @Override
277 | public void onClick(View view) {
278 |
279 | if (mSelectedTexView != null) {
280 | mSelectedLinearLayout.setBackgroundResource(android.R.color.transparent);
281 | mSelectedTexView.setTextColor(mPreviousColor);
282 | }
283 | mPreviousColor = mOffMonthDayColor;
284 | mSelectedTexView = days[finalIndex];
285 | daysContainer[finalIndex].setBackgroundResource(R.drawable.drawable_rectangular);
286 |
287 | Drawable backgroundDrawable = DrawableCompat.wrap(daysContainer[finalIndex].getBackground()).mutate();
288 | DrawableCompat.setTint(backgroundDrawable, mSelectorColor);
289 |
290 | mSelectedLinearLayout = daysContainer[finalIndex];
291 | days[finalIndex].setTextColor(mSelectedDayTextColor);
292 |
293 |
294 | if (mCalenderDayClickListener != null) {
295 | mCalenderDayClickListener.onGetDay(model);
296 | }
297 | }
298 | });
299 |
300 | prevCurrentDay++;
301 | index++;
302 | }
303 | }
304 |
305 |
306 | // now set current month date
307 |
308 | mCalendar.set(selectedYear, selectedMonth, 1);
309 |
310 | for (int i = 1; i <= daysInCurrentMonth; i++) {
311 | days[index].setText(String.valueOf(i));
312 | days[index].setTextColor(mCurrentMonthDayColor);
313 |
314 | final DayContainerModel model = new DayContainerModel();
315 | model.setIndex(index);
316 | model.setYear(selectedYear);
317 | model.setMonthNumber(selectedMonth);
318 | model.setMonth(MONTH_NAMES[selectedMonth]);
319 | model.setDay(i);
320 | String date = model.getDay() + " " + model.getMonth() + " " + model.getYear();
321 | model.setDate(date);
322 | model.setTimeInMillisecond(TimeUtil.getTimestamp(date));
323 |
324 | Event event = getEvent(model.getTimeInMillisecond());
325 | model.setEvent(event);
326 | model.setHaveEvent(event != null);
327 |
328 | if (mToday.equals(model.getDate())) {
329 | if (mSelectedTexView != null) {
330 | mSelectedLinearLayout.setBackgroundResource(android.R.color.transparent);
331 | mSelectedTexView.setTextColor(mPreviousColor);
332 | }
333 | mPreviousColor = mCurrentMonthDayColor;
334 | mSelectedTexView = days[index];
335 | daysContainer[index].setBackgroundResource(R.drawable.drawable_rectangular);
336 |
337 | Drawable backgroundDrawable = DrawableCompat.wrap(daysContainer[index].getBackground()).mutate();
338 | DrawableCompat.setTint(backgroundDrawable, mSelectorColor);
339 |
340 | mSelectedLinearLayout = daysContainer[index];
341 | days[index].setTextColor(mSelectedDayTextColor);
342 | }
343 |
344 |
345 | if (model.isHaveEvent()) {
346 | eventsTextViewList[index].setText(event.getEventText());
347 | eventsTextViewList[index].setVisibility(VISIBLE);
348 | eventsTextViewList[index].setTextColor(event.getEventColor());
349 | } else {
350 | eventsTextViewList[index].setVisibility(INVISIBLE);
351 | }
352 |
353 | dayContainerList.add(model);
354 |
355 | final int finalIndex = index;
356 | days[index].setOnClickListener(new OnClickListener() {
357 | @Override
358 | public void onClick(View view) {
359 | Log.d(TAG, "Hello");
360 |
361 | if (mSelectedTexView != null) {
362 | mSelectedLinearLayout.setBackgroundResource(android.R.color.transparent);
363 | mSelectedTexView.setTextColor(mPreviousColor);
364 | }
365 | mPreviousColor = mCurrentMonthDayColor;
366 | mSelectedTexView = days[finalIndex];
367 | daysContainer[finalIndex].setBackgroundResource(R.drawable.drawable_rectangular);
368 |
369 | Drawable backgroundDrawable = DrawableCompat.wrap(daysContainer[finalIndex].getBackground()).mutate();
370 | DrawableCompat.setTint(backgroundDrawable, mSelectorColor);
371 |
372 | mSelectedLinearLayout = daysContainer[finalIndex];
373 | days[finalIndex].setTextColor(mSelectedDayTextColor);
374 |
375 | if (mCalenderDayClickListener != null) {
376 | mCalenderDayClickListener.onGetDay(model);
377 | }
378 | }
379 | });
380 |
381 | index++;
382 | }
383 |
384 | int nextYear;
385 | int nextMonth;
386 | if (selectedMonth < 11) {
387 | nextYear = selectedYear;
388 | nextMonth = selectedMonth + 1;
389 | } else {
390 | nextYear = selectedYear + 1;
391 | nextMonth = 0;
392 | }
393 |
394 | // now set rest of day
395 | for (int i = 1; i <= nextMonthDays; i++) {
396 | days[index].setText(String.valueOf(i));
397 | days[index].setTextColor(mOffMonthDayColor);
398 |
399 | final DayContainerModel model = new DayContainerModel();
400 | model.setIndex(index);
401 | model.setYear(nextYear);
402 | model.setMonthNumber(nextMonth);
403 | model.setMonth(MONTH_NAMES[nextMonth]);
404 | model.setDay(i);
405 | String date = model.getDay() + " " + model.getMonth() + " " + model.getYear();
406 | model.setDate(date);
407 | model.setTimeInMillisecond(TimeUtil.getTimestamp(date));
408 |
409 | Event event = getEvent(model.getTimeInMillisecond());
410 | model.setEvent(event);
411 | model.setHaveEvent(event != null);
412 |
413 | if (model.isHaveEvent()) {
414 | eventsTextViewList[index].setText(event.getEventText());
415 | eventsTextViewList[index].setVisibility(VISIBLE);
416 | eventsTextViewList[index].setTextColor(event.getEventColor());
417 | } else {
418 | eventsTextViewList[index].setVisibility(INVISIBLE);
419 | }
420 |
421 | dayContainerList.add(model);
422 |
423 | final int finalIndex = index;
424 | days[index].setOnClickListener(new OnClickListener() {
425 | @Override
426 | public void onClick(View view) {
427 | Log.d(TAG, "Hello");
428 | if (mSelectedTexView != null) {
429 | mSelectedTexView.setTextColor(mPreviousColor);
430 | mSelectedLinearLayout.setBackgroundResource(android.R.color.transparent);
431 | }
432 | mPreviousColor = mOffMonthDayColor;
433 | mSelectedTexView = days[finalIndex];
434 | mSelectedLinearLayout = daysContainer[finalIndex];
435 | daysContainer[finalIndex].setBackgroundResource(R.drawable.drawable_rectangular);
436 |
437 | Drawable backgroundDrawable = DrawableCompat.wrap(daysContainer[finalIndex].getBackground()).mutate();
438 | DrawableCompat.setTint(backgroundDrawable, mSelectorColor);
439 |
440 | days[finalIndex].setTextColor(mSelectedDayTextColor);
441 |
442 | if (mCalenderDayClickListener != null) {
443 | mCalenderDayClickListener.onGetDay(model);
444 | }
445 | }
446 | });
447 |
448 | index++;
449 | }
450 |
451 | }
452 |
453 | private void gotoNextMonth() {
454 | int year = mCalendar.get(Calendar.YEAR);
455 | int month = mCalendar.get(Calendar.MONTH);
456 |
457 | if (month < 11) {
458 | mCalendar.set(year, month + 1, 1);
459 | } else {
460 | mCalendar.set(year + 1, 0, 1);
461 | }
462 |
463 | initCalender(mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH));
464 | }
465 |
466 | private void gotoPreviousMonth() {
467 | int year = mCalendar.get(Calendar.YEAR);
468 | int month = mCalendar.get(Calendar.MONTH);
469 |
470 | if (month > 0) {
471 | mCalendar.set(year, month - 1, 1);
472 | } else {
473 | mCalendar.set(year - 1, 11, 1);
474 | }
475 |
476 | initCalender(mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH));
477 | }
478 |
479 |
480 | private void initDaysInCalender(LayoutParams buttonParams, Context context, DisplayMetrics metrics) {
481 | int engDaysArrayCounter = 0;
482 |
483 | for (int weekNumber = 0; weekNumber < 6; ++weekNumber) {
484 | for (int dayInWeek = 0; dayInWeek < 7; ++dayInWeek) {
485 |
486 | LinearLayout linearLayout = new LinearLayout(context);
487 | linearLayout.setLayoutParams(buttonParams);
488 | linearLayout.setOrientation(VERTICAL);
489 | linearLayout.setGravity(Gravity.CENTER);
490 |
491 | final TextView day = new TextView(context);
492 | day.setTextColor(Color.parseColor(CUSTOM_GREY));
493 | day.setBackgroundColor(Color.TRANSPARENT);
494 | day.setLayoutParams(new LinearLayout.LayoutParams(
495 | ViewGroup.LayoutParams.MATCH_PARENT,
496 | ViewGroup.LayoutParams.WRAP_CONTENT));
497 | day.setTextSize((int) metrics.density * 5);
498 | day.setSingleLine();
499 | day.setPadding(10, 10, 10, 10);
500 | day.setGravity(Gravity.CENTER);
501 |
502 |
503 | TextView textView = new TextView(context);
504 | textView.setLayoutParams(new LinearLayout.LayoutParams(
505 | ViewGroup.LayoutParams.MATCH_PARENT,
506 | ViewGroup.LayoutParams.WRAP_CONTENT));
507 | textView.setTextSize(8);
508 | textView.setMaxLines(1);
509 |
510 | int maxLength = 2;
511 | InputFilter[] fArray = new InputFilter[1];
512 | fArray[0] = new InputFilter.LengthFilter(maxLength);
513 | textView.setFilters(fArray);
514 | textView.setText("H");
515 | textView.setGravity(Gravity.CENTER);
516 | textView.setVisibility(INVISIBLE);
517 |
518 | linearLayout.addView(day);
519 | linearLayout.addView(textView);
520 |
521 | days[engDaysArrayCounter] = day;
522 | eventsTextViewList[engDaysArrayCounter] = textView;
523 |
524 | weeks[weekNumber].addView(linearLayout);
525 |
526 | daysContainer[engDaysArrayCounter] = linearLayout;
527 |
528 | engDaysArrayCounter++;
529 | }
530 | }
531 | }
532 |
533 | private void initAttrs(AttributeSet attrs) {
534 | TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.CalenderEvent);
535 |
536 | mBackgroundColor = typedArray.getColor(R.styleable.CalenderEvent_calender_background, DEFAULT_BACKGROUND_COLOR);
537 |
538 | mSelectorColor = typedArray.getColor(R.styleable.CalenderEvent_selector_color, DEFAULT_SELECTOR_COLOR);
539 |
540 | mSelectedDayTextColor = typedArray.getColor(R.styleable.CalenderEvent_selected_day_text_color, DEFAULT_SELECTED_DAY_COLOR);
541 |
542 | mCurrentMonthDayColor = typedArray.getColor(R.styleable.CalenderEvent_current_month_day_color, DEFAULT_CURRENT_MONTH_DAY_COLOR);
543 |
544 | mOffMonthDayColor = typedArray.getColor(R.styleable.CalenderEvent_off_month_day_color, DEFAULT_OFF_MONTH_DAY_COLOR);
545 |
546 | mMonthTextColor = typedArray.getColor(R.styleable.CalenderEvent_month_color, DEFAULT_TEXT_COLOR);
547 |
548 | mWeekNameColor = typedArray.getColor(R.styleable.CalenderEvent_week_name_color, DEFAULT_TEXT_COLOR);
549 |
550 | nextButtonDrawable = typedArray.getDrawable(R.styleable.CalenderEvent_next_icon);
551 |
552 | prevButtonDrawable = typedArray.getDrawable(R.styleable.CalenderEvent_previous_icon);
553 |
554 | typedArray.recycle();
555 | }
556 |
557 | private void initView(Context context) {
558 | this.mContext = context;
559 | LayoutInflater inflater = (LayoutInflater) context
560 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
561 | if (inflater != null) {
562 | mainView = inflater.inflate(R.layout.main_calender, this);
563 | }
564 | }
565 |
566 | private LayoutParams getdaysLayoutParams() {
567 | LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(
568 | ViewGroup.LayoutParams.MATCH_PARENT,
569 | ViewGroup.LayoutParams.MATCH_PARENT);
570 | buttonParams.weight = 1;
571 | return buttonParams;
572 | }
573 |
574 | private DayContainerModel getDaysContainerModel(String date) {
575 | for (DayContainerModel model : dayContainerList) {
576 | if (model.getDate().equals(date)) {
577 | return model;
578 | }
579 | }
580 | return null;
581 | }
582 |
583 | private Event getEvent(long time) {
584 | String date = TimeUtil.getDate(time);
585 |
586 | String textKey = date + TEXT_EVENT;
587 | String colorKey = date + COLOR_EVENT;
588 |
589 | String eventText = preferenceHelper.readString(textKey);
590 |
591 | if (eventText != null) {
592 | int color = preferenceHelper.readInteger(colorKey);
593 | if (color == 0) {
594 | color = DEFAULT_TEXT_COLOR;
595 | }
596 | return new Event(time, eventText, color);
597 | }
598 |
599 | return null;
600 | }
601 |
602 |
603 | /*
604 | * ******************* User method ***************
605 | * */
606 |
607 | public void addEvent(Event event) {
608 | if (event == null) return;
609 | String date = TimeUtil.getDate(event.getTime());
610 |
611 | String textKey = date + TEXT_EVENT;
612 | String colorKey = date + COLOR_EVENT;
613 |
614 | preferenceHelper.write(textKey, event.getEventText());
615 | preferenceHelper.write(colorKey, event.getEventColor());
616 |
617 | DayContainerModel model = getDaysContainerModel(date);
618 | if (model != null) {
619 | model.setHaveEvent(true);
620 | model.setEvent(event);
621 | }
622 | }
623 |
624 | public void removeEvent(Event event) {
625 | if (event == null) return;
626 | String date = TimeUtil.getDate(event.getTime());
627 | String textKey = date + TEXT_EVENT;
628 | String colorKey = date + COLOR_EVENT;
629 | preferenceHelper.remove(textKey);
630 | preferenceHelper.remove(colorKey);
631 |
632 | DayContainerModel model = getDaysContainerModel(date);
633 | if (model != null) {
634 | model.setHaveEvent(false);
635 | model.setEvent(null);
636 | }
637 | }
638 |
639 | public void initCalderItemClickCallback(CalenderDayClickListener listener) {
640 | this.mCalenderDayClickListener = listener;
641 | }
642 |
643 |
644 | }
645 |
--------------------------------------------------------------------------------