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.azavea:HijriDatePicker:-SNAPSHOT'
}
dependencies {
implementation("com.github.azavea:HijriDatePicker:-SNAPSHOT")
}
<dependency>
<groupId>com.github.azavea</groupId>
<artifactId>HijriDatePicker</artifactId>
<version>-SNAPSHOT</version>
</dependency>
libraryDependencies += "com.github.azavea" % "HijriDatePicker" % "-SNAPSHOT"
:dependencies [[com.github.azavea/HijriDatePicker "-SNAPSHOT"]]
This library offers a hijri (Islamic Calendar) Date Picker designed on Google's Material Design Principals For Pickers for Android 4.1 (API 16) +.
عربي | English
---- | ----
|
You can report any issue on issues page. Note: If you speak Arabic, you can submit issues with Arabic language and I will check them. :)
##Installation Maven
<dependency>
<groupId>net.alhazmy13.hijridatepicker</groupId>
<artifactId>libary</artifactId>
<version>1.3.6</version>
</dependency>
Gradle
dependencies {
compile 'net.alhazmy13.hijridatepicker:libary:1.3.6'
}
The library follows the same API as other pickers in the Android framework. After adding the library, you need to:
OnDateSetListener
HijriCalendarDialog
using the supplied factoryOnDateSetListener
In order to receive the date set in the picker, you will need to implement the OnDateSetListener
interfaces. Typically this will be the Dialog
that creates the Pickers. The callbacks use the same API as the standard Android pickers.
<u><b>Note:</b> Months start from 0.</u>
@Override
public void onDateSet(int year, int month, int day) {
Toast.makeText(getApplicationContext(),year+"/"+(month+1)+"/"+day+"/",Toast.LENGTH_SHORT).show();
}
HijriCalendarDialog
You will need to create a new instance of HijriCalendarDialog
. Once the dialogs are configured, you can call show()
.
new HijriCalendarDialog.Builder(this)
.setOnDateSetListener(this)
.show();
You can theme the pickers by overwriting the color resources hijri_date_picker_accent_color
in your project.
<color name="hijri_date_picker_accent_color">#009688</color>
SetUILanguage
You can change the display language to your preferred language ARABIC
or ENGLISH
.setUILanguage(HijriCalendarDialog.Language.Arabic);
setMode
to change the mode from Hijri
to Gregorian
.setMode(HijriCalendarDialog.Mode.Gregorian)
setMaxHijriYear
To set the maximum Hijri year for dialg.setMaxHijriYear(1440);
setMinHijriYear
To set the minimum hijri year for dialg.setMinYear(1437);
setMinMaxHijriYear
To set the minimum and maximum hijri year for dialog.setMinMaxHijriYear(1430,1440);
setMaxGregorianYear
To set the maximum Gregorian year for dialg.setMaxGregorianYear(1440);
setMinGregorianYear
To set the minimum Gregorian year for dialg.setMinGregorianYear(1437);
setMinMaxGregorianYear
To set the minimum and maximum Gregorian year for dialog.setMinMaxGregorianYear(1430,1440);
setDefaultHijriDate
.setDefaultHijriDate(8, 0, 1437) //months start from 0
Thanks to ummalqura-calendar Library and AndroidViewAnimations.
Copyright 2015 alhazmy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.