Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.HedyHidouRy:HorizontalCalendar:1.00'
}
dependencies {
implementation("com.github.HedyHidouRy:HorizontalCalendar:1.00")
}
<dependency>
<groupId>com.github.HedyHidouRy</groupId>
<artifactId>HorizontalCalendar</artifactId>
<version>1.00</version>
</dependency>
libraryDependencies += "com.github.HedyHidouRy" % "HorizontalCalendar" % "1.00"
:dependencies [[com.github.HedyHidouRy/HorizontalCalendar "1.00"]]
Android Horizontal Calendar is an Android library to display of full calendar ( especially to take exact appointement ). It supports custom styling.
Import the library into your project.
Grab via gradle
compile 'com.github.HedyHidouRy:HorizontalCalendar:1.00'
repositories {
...
maven { url 'https://jitpack.io' }
}
Add WeekView in your xml layout.
<com.hedyhidoury.calendar.horizontallibrary.HorizontalCalendarView
android:id="@+id/horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:selectedBgColor="#89cacf"
app:todaysDateBgColor="#89cacf"
app:calendarBgColor="@android:color/white"
app:daysTextColor="@android:color/black"
app:weekTypeFace="museosans.otf"
app:headerPreviousIcon="@drawable/ic_backward"
app:headerForwardIcon="@drawable/ic_forward"
app:weekForwardIcon="@drawable/ic_forward"
app:weekPreviousIcon="@drawable/ic_backward"
app:hoursTypeFace="MuseoSans_500.otf"
app:headerTypeFace="MuseoSans_700.otf"
/>
Write the following code in your java file to make those options.
// Set hours range, hours format are with this format
horizontalCalendarView.setHoursRange("10h30","17h00");
// Set invalidate days of the week
horizontalCalendarView.setInvalidatedDays(HorizontalCalendarView.THURSDAY,HorizontalCalendarView.FRIDAY);
// Set DatePickedListener
horizontalCalendarView.setDatePickedListener(new OnDatePickedListener() {
@Override
public void OnDatePicked(Date datePicked) {
Toast.makeText(MainActivity.this,datePicked.toString(),Toast.LENGTH_SHORT).show();
}
});
OnDatePickedListener
according to your need.You can customize the look of the WeekView
in xml. Use the following attributes in xml. All these attributes also have getters and setters to enable you to change the style dynamically.
nbOfMonths
daysTextSize
daysTextColor
calendarBgColor
daysBackgroundColor
weekTextSize
weekTextColor
weekBackgroundColor
selectedBgColor
todaysDateBgColor
weekTypeFace
headerTypeFace
headerForwardIcon
weekForwardIcon
headerPreviousIcon
weekPreviousIcon
hoursTypeFace
There is also a sample app to get you started.