Git Product home page Git Product logo

muslim-data-android's Introduction

muslim-data-android

MuslimData is an Islamic Database that provides Prayer Times (fixed and calculated), Offline Geocoding, Location Search, Azkars (Hisnul Muslim) and 99 Names of Allah.

Fixed and Calculated Prayer Times: Most cities around the world find their prayer times by using some calculations which is based on location (longitude and latitude) but some other cities have fixed time table for their prayer times. This library contains most fixed and calculated prayer times. Now you can contribute it to improve it and also you can use it in Muslim communities or Muslim apps.

Installation

implementation 'dev.kosrat:muslimdata:2.1.1'

Migration Guide

If you're upgrading from version 1.x to version 2.x of muslim-data-ios, please refer to the Migration Guide for detailed instructions on updating your code to accommodate the changes in the latest release.

Usage

Location

There are some location helper methods in the MuslimRepository that provides offline Location Search, Geocoding, and Reverse Geocoding and also each of one will return Location object or list that contains (countryCode, countryName, cityName, latitude, longitude, and hasFixedPrayerTime).

Search for a location

You can search for any cities or places around the world and this is useful when a user doesn't have internet connection or user's location is turned off so that you can search here:

lifecycleScope.launch {
    val repository = MuslimRepository(this@MainActivity)
    val locationList = repository.searchLocation("erb")
    Log.i("searchLocation", "$locationList")
}

Geocoder

Use geocoder to find a location by city name.

lifecycleScope.launch {
    val repository = MuslimRepository(this@MainActivity)
    val location = repository.geocoder("iq", "erbil")
    Log.i("geocoder", "$location")
}

Reverse Geocoder

Use reverseGeocoder to find a location by latitude and longitude.

lifecycleScope.launch {
    val repository = MuslimRepository(this@MainActivity)
    val location = repository.reverseGeocoder(36.0901, 43.0930)
    Log.i("reverseGeocoder", "$location")
}

Prayer Times

You can easily get prayer times for a location just by passing (Location, PrayerAttribute, and Date) object to getPrayerTimes method.

lifecycleScope.launch {
    val repository = MuslimRepository(this@MainActivity)
    
    val attribute = PrayerAttribute(
        CalculationMethod.MAKKAH,
        AsrMethod.SHAFII,
        HigherLatitudeMethod.ANGLE_BASED,
        intArrayOf(0, 0, 0, 0, 0, 0)
    )
    val prayerTime = repository.getPrayerTimes(
        location,
        Date(),
        attribute
    )
    Log.i("Prayer times ", "$prayerTime")
    Log.i(
        "formatPrayerTime ",
        prayerTime.formatPrayerTime(TimeFormat.TIME_12).contentToString()
    )
    Log.i("nextPrayerTimeIndex", "${prayerTime.nextPrayerTimeIndex()}")
    Log.i("nextPrayerTimeInterval", "${prayerTime.nextPrayerTimeInterval()}")
    Log.i("nextPrayerTimeRemaining", prayerTime.nextPrayerTimeRemaining())
}

Azkars (Hisnul Muslim)

Get all azkars from (Hisnul Muslim book) that is categorized by (Category, Chapter, and Item) and also the azkars are available for these languages (en, ar, ckb, fa, and ru)

Azkar Category

Get all azkar categories and it is localized for the given language.

lifecycleScope.launch {
    val repository = MuslimRepository(this@MainActivity)
    val azkarCategories = repository.getAzkarCategories(Language.EN)
    Log.i("azkarCategories", "$azkarCategories")
}

Azkar Chapters

Get azkar chapters and it is localized for the given language.

lifecycleScope.launch {
    val repository = MuslimRepository(this@MainActivity)
    val azkarChapters = repository.getAzkarChapters(Language.EN)
    Log.i("azkarChapters", "$azkarChapters")
}

Get azkar chapters for a specific category and it is localized for the given language.

lifecycleScope.launch {
    val repository = MuslimRepository(this@MainActivity)
    val azkarChapters = repository.getAzkarChapters(Language.EN, 1)
    Log.i("azkarChapters", "$azkarChapters")
}

Azkar Items

Get azkar items for a specific chapter and it is localized for the given language.

lifecycleScope.launch {
    val repository = MuslimRepository(this@MainActivity)
    val azkarItems = repository.getAzkarItems(1, Language.EN)
    Log.i("azkarItems", "$azkarItems")
}

Names of Allah

Get 99 Names of Allah with it's translation and now it is available for these languages (en, ar, ckb, fa, and ru)

lifecycleScope.launch {
    val repository = MuslimRepository(this@MainActivity)
    val names = repository.getNamesOfAllah(Language.EN)
    Log.i("Names", "$names")
} 

Author

Kosrat D. Ahmed, [email protected]

License

muslim-data-android is available under the MIT license. See the LICENSE file for more info.

muslim-data-android's People

Contributors

abdullqadir avatar kosratdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

evolve99 salarpro

muslim-data-android's Issues

Sanandaj Asr prayer time issue

کاتی نوێژی عەسر دەشێوێت، کاتی درووست 4:52 دن
چەندجار وای لێهاتووه
12/9/2019
Screenshot_20190912-170424_My Prayers.jpg

City mapper issue on some city names

The following cities have been added to the city mapper class but not found in the city database, so it produces an error while using fetching it.

  • Add KW cities to the DB
  • Add Takiya, IQ to the DB

Reference: Firebase Crashlytics

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String dev.kosrat.muslimdata.database.tables.prayertimes.FixedPrayerTime.getFajr()' on a null object reference
       at dev.kosrat.muslimdata.repository.MuslimRepository$getPrayerTimes$2.invokeSuspend(MuslimRepository.kt:62)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

How can I use in JAVA

I am using the java project. you developed your repository in Kotlin but I want to use it in Java. When I try to use I get an error which is

error: method getAzkarCategories in class MuslimRepository cannot be applied to given types; List<String> azkarList = muslimRepository.getAzkarCategories(Language.EN); ^ required: Language,Continuation<? super List<AzkarCategory>> found: Language reason: actual and formal argument lists differ in length
this method wants two arguments but you use there is 1.

Database error

I get this error on many devices
dev.kosrat.muslimdata.database.MuslimDataDao_Impl.reverseGeocoder
android.database.sqlite.SQLiteException
android.database.sqlite.SQLiteException: no such table: city (code 1 SQLITE_ERROR[1])

Add Tahajjud prayer time

It is requested by email with the following content.

السلام علیک ورحمة الله وبركاته برا
خوا‌ پاداشتت باتەوە بۆ ئەو ئەپڵیکەیشنە My Prayers
وەک پێشنیارێک ئەگەر بکرێت لەبەشێکی ئەپەکە دەربکەوێت نیوەی شەو کاتژمێر چەندە وە سێ یەکی کۆتایی چەند دەستپێئەکات بۆ ئەوکەسانەی ناتوانن ئاسان کاتەکە هەژمار بکەن

هەژمارەکە بەم شێوەیەیە

بۆ نموونە بانگی مەغریب بۆ بانگی بەیانی چەند دابەشی دووی بکە بۆ نموونە 10سەعات و 20 دەقە ئەکات

ئەوە دابەش دوو ئەکاتە 5 سەعات و 10 دەقە

ئەوە بخەیتە سەر مەغریب ئەکاتە نیوەی شەو
واتا مەغریب سەعات 6 بێت ئەوکاتە 11:10 نیوە شەوە

سێ یەکی کۆتاییش بەم شێوەیە بەینی مەغریب و بەیانی دابەش 3 چەندی کرد ئەوەنە پێش نوێژی بەیانی سێ یەکی کۆتایی شەو دەستپێئەکات

سوپاس.

issue with prayer times

Fatal Exception: java.lang.NumberFormatException: For input string: "-----"
at java.lang.Integer.parseInt(Integer.java:521)
at java.lang.Integer.parseInt(Integer.java:556)
at dev.kosrat.muslimdata.extensions.DateUtilKt.toDate(DateUtil.kt:38)
at dev.kosrat.muslimdata.database.tables.prayertimes.CalculatedPrayerTime.getPrayerTimes(CalculatedPrayerTime.kt:160)
at dev.kosrat.muslimdata.repository.MuslimRepository$getPrayerTimes$2.invokeSuspend(MuslimRepository.kt:70)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.