Skip to content

radi-ratlh/HijriDatePicker

 
 

Repository files navigation

# Hijri Date Picker (UmAlQuraCalendar) ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.svg) ![](https://img.shields.io/crates/l/rustc-serialize.svg) ![](https://img.shields.io/badge/version-1.3.6-blue.svg)

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
Arabic 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'
}

Usage

The library follows the same API as other pickers in the Android framework. After adding the library, you need to:

  1. Implement an OnDateSetListener
  2. Create a HijriCalendarDialog using the supplied factory
  3. Theme the pickers

Implement an OnDateSetListener

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();

    }

Create a 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();

Theme the pickers

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>

Additional Options

  • 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

Credits

License

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.

About

UmAlQura Date Picker

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%