Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alhazmy13/HijriDatePicker
Material (Gregorian - Hijri) Date & Time Picker
https://github.com/alhazmy13/HijriDatePicker
android dialog dialogs gregorian hijri material picker time
Last synced: 3 months ago
JSON representation
Material (Gregorian - Hijri) Date & Time Picker
- Host: GitHub
- URL: https://github.com/alhazmy13/HijriDatePicker
- Owner: alhazmy13
- License: apache-2.0
- Created: 2015-10-17T11:25:38.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-11-27T07:38:03.000Z (almost 2 years ago)
- Last Synced: 2024-05-01T15:29:20.584Z (6 months ago)
- Topics: android, dialog, dialogs, gregorian, hijri, material, picker, time
- Language: Java
- Homepage: alhazmy13.net
- Size: 605 KB
- Stars: 137
- Watchers: 9
- Forks: 61
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
- awesome-android - HijriDatePicker - offers a hijri (Islamic Calendar) Date Picker designed on Google's Material Design Principals For Pickers. (Libraries / Chat & Messaging)
- awesome-Islam - HijriDatePicker - Hijri) Date & Time Picker (Open Source Projects / APIs & Libraries)
- awesome-android - HijriDatePicker - offers a hijri (Islamic Calendar) Date Picker designed on Google's Material Design Principals For Pickers. (Libraries / Chat & Messaging)
- Awesome-Muslims - Hijri Date Picker
README
# 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-3.0.0-blue.svg)This library offers a hijri (Islamic Calendar) Date Picker designed on [Google's Material Design Principals For Pickers](http://www.google.com/design/spec/components/pickers.html) for Android 5.0 (API 21) +.
Demo | Hijri
---- | ----
|
Time | Gregorian
|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**```xml
net.alhazmy13.hijridatepicker
library
3.0.0```
**Gradle**```gradle
dependencies {
compile 'net.alhazmy13.hijridatepicker:library:3.0.0'
}
```# Usage
The library follows the same API as other pickers in the Android framework.
After adding the library, you need to:1. Implement an `onDateSet`
2. Create a `HijriCalendarDialog` using the supplied factory
3. Theme the pickers### Implement an `OnTimeSetListener/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.
```java
// TimePickerDialog
@Override
public void onTimeSet(TimePickerDialog view, int hourOfDay, int minute, int second) {
// YOUR CODE
}
// GregorianDatePickerDialog
@Override
public void onDateSet(GregorianDatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
//YOUR CODE
}
// HijriDatePickerDialog
@Override
public void onDateSet(HijriDatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
//YOUR CODE
}
```### Create a `GregorianDatePickerDialog`
You will need to create a new instance of `GregorianDatePickerDialog `. Once the dialogs are configured, you can call `show()`.```java
Calendar now = Calendar.getInstance();
GregorianDatePickerDialog dpd = GregorianDatePickerDialog.newInstance(
this,
now.get(Calendar.YEAR),
now.get(Calendar.MONTH),
now.get(Calendar.DAY_OF_MONTH));
dpd.show(getFragmentManager(), "GregorianDatePickerDialog");
```### Create a `HijriDatePickerDialog`
Same as `GregorianDatePickerDialog` but you need to use `UmmalquraCalendar` insted of `Calendar` class.```java
UmmalquraCalendar now = new UmmalquraCalendar();
HijriDatePickerDialog dpd = HijriDatePickerDialog.newInstance(
this,
now.get(UmmalquraCalendar.YEAR),
now.get(UmmalquraCalendar.MONTH),
now.get(UmmalquraCalendar.DAY_OF_MONTH));
dpd.show(getFragmentManager(), "HijriDatePickerDialog");
```### `TimePickerDialog`
```java
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = TimePickerDialog.newInstance(
this,
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
mode24Hours.isChecked()
);
```## Credits
* [ummalqura-calendar Library](https://github.com/msarhan/ummalqura-calendar)
* [MaterialDateTimePicker](https://github.com/wdullaer/MaterialDateTimePicker).## 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 athttp://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.