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:
- Implement an
OnDateSetListener
- Create a
HijriCalendarDialog
using the supplied factory - Theme the pickers
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.
Note: Months start from 0.
@Override
public void onDateSet(int year, int month, int day) {
Toast.makeText(getApplicationContext(),year+"/"+(month+1)+"/"+day+"/",Toast.LENGTH_SHORT).show();
}
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 languageARABIC
orENGLISH
.setUILanguage(HijriCalendarDialog.Language.Arabic);
setMode
to change the mode fromHijri
toGregorian
.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
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.