Skip to content

Commit

Permalink
Update & Refine Readme file.
Browse files Browse the repository at this point in the history
Refine Sample calls
  • Loading branch information
Ahmed Eltaher committed Apr 19, 2019
1 parent 82668ab commit 277f912
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 53 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
![Build](https://img.shields.io/badge/Azan-jitpack.io-blue.svg)


**what is azan ?**
**what is Azan ?**

```
The Muslim call to ritual prayer made by a muezzin from the minaret of a mosque
Expand Down Expand Up @@ -74,28 +74,28 @@ allprojects {

```
dependencies {
compile 'com.github.ahmedeltaher:Azan:2.1'
implementation 'com.github.ahmedeltaher:Azan:3.0'
}
```

**Example how to get prayer times**

```
GregorianCalendar date = new GregorianCalendar();
PrayerTimes prayerTimes = new TimeCalculator().date(date).location(-6.38043079,106.85337984, 0,7).timeCalculationMethod(EGYPT).calculateTimes();
prayerTimes.setUseSecond(true);
prayerTimes.getPrayTime(PrayersType.FAJR);
prayerTimes.getPrayTime(PrayersType.SUNRISE);
prayerTimes.getPrayTime(PrayersType.ZUHR);
prayerTimes.getPrayTime(PrayersType.MAGHRIB);
prayerTimes.getPrayTime(PrayersType.ISHA);
val today = SimpleDate(GregorianCalendar())
val location = Location(30.045411, 31.236735, 2.0, 0)
val azan = Azan(location, Method.EGYPT_SURVEY)
val prayerTimes = azan.getPrayerTimes(today)
val imsaak = azan.getImsaak(today)
println("----------------results------------------------")
println("date ---> " + today.day + " / " + today.month + " / " + today.year)
println("imsaak ---> $imsaak")
println("Fajr ---> " + prayerTimes.fajr())
println("sunrise --->" + prayerTimes.shuruq())
println("Zuhr --->" + prayerTimes.thuhr())
println("Asr --->" + prayerTimes.assr())
println("Maghrib --->" + prayerTimes.maghrib())
println("ISHA --->" + prayerTimes.ishaa())
println("----------------------------------------")
```

## LICENSE
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
implementation project(':azan')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// implementation 'com.github.ahmedeltaher:Azan:2.1'
// implementation 'com.github.ahmedeltaher:Azan:3.0'
}
repositories {
mavenCentral()
Expand Down
25 changes: 3 additions & 22 deletions app/src/main/java/com/eltaher/azan/sample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.azan.Azan
import com.azan.Method
import com.azan.astrologicalCalc.Location
import com.azan.astrologicalCalc.SimpleDate
import com.azan.astrologicalCalc.SimpleTime
import sample.azan.eltaher.com.azan.R
import java.util.*

Expand Down Expand Up @@ -52,39 +51,21 @@ class MainActivity : AppCompatActivity() {
}

fun azan() {
//Azan azan = new Azan(new Location(24.4833, 54.35, 4, 0 ), m);
//azan.setCalendar(Calendar.getInstance());
/* Call the main function to fill the Time times array of
* structures */

val qibla: SimpleTime
val today = SimpleDate(GregorianCalendar())
val location = Location(30.045411, 31.236735, 2.0, 0)
val azan = Azan(location, Method.EGYPT_SURVEY)
val prayerTimes = azan.getPrayerTimes(today)

/* Call functions for other prayer times and qibla */
val imsaak = azan.getImsaak(today)
val nextFajr = azan.getNextDayFajr(today)
val nextImsaak = azan.getNextDayImsaak(today)
qibla = azan.northQibla
print("\nQibla\t=$qibla\n")
print(prayerTimes)
println("Today's Imsaak: $imsaak")
println("Tomorrow's Fajr: $nextFajr")
println("Tomorrow's Imsaak: $nextImsaak")
//System.out.println(Utils.PI + "\n");
//System.out.println(Math.PI + "\n");

println("---> ----------------------------------------")
println("----------------results------------------------")
println("date ---> " + today.day + " / " + today.month + " / " + today.year)
println("imsaak ---> $imsaak")
println("Fajr ---> " + prayerTimes.fajr())
println("sunrise --->" + prayerTimes.shuruq())
println("Zuhr --->" + prayerTimes.thuhr())
println("Asr --->" + prayerTimes.assr())
println("Maghrib --->" + prayerTimes.maghrib())
println("ISHA --->" + prayerTimes.ishaa())
println("---> ----------------------------------------")
println("----------------------------------------")

}
}
26 changes: 13 additions & 13 deletions azan/src/main/java/com/azan/Azan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import java.util.*


/**
* This the main class of the JITL library. You can use static methods
* to do qibla calculation but you will need to create a Azan instance
* This the main class of the Azan library. You can use static methods
* to do qibla angle calculation but you will need to create a Azan instance
* to calculate prayer times for a specific location, using a specified method.
*
*/
class Azan
/**
* Creates the jitl main class
* Creates the Azan main class
* @param location the location
* @param method the method used in the calculation. You can use
* predefined methods for example `Method.MUSLIM_LEAGUE` or creates
Expand All @@ -26,11 +26,11 @@ class Azan
private val astroCache = Astro()

/**
* generate qibla direction
* @return a SimpleTime object containing qibla direction for the current location
* generate AdjustmentTimeToQiblaDirection direction
* @return a SimpleTime object containing AdjustmentTimeToQiblaDirection direction for the current location
*/
val northQibla: SimpleTime
get() = getNorthQibla(location!!)
val northAdjustmentTimeToQiblaDirection: SimpleTime
get() = getAdjustmentTimeToQiblaDirection(location!!)

/**
* changes the location
Expand Down Expand Up @@ -578,7 +578,7 @@ class Azan
companion object {

/**
* minor version of jitl
* minor version of Azan
*/
/**
* Minor version of Azan
Expand All @@ -587,7 +587,7 @@ class Azan
val minorVersion = 0

/**
* major version of jitl
* major version of Azan
*/
/**
* Major version of Azan
Expand Down Expand Up @@ -753,15 +753,15 @@ class Azan
return DayCouple(ld, jd)
}

/* Obtaining the direction of the shortest distance towards Qibla by uMath.sing the
/* Obtaining the direction of the shortest distance towards Qibla angle by uMath.sing the
* great circle formula */

/**
* generate qibla direction
* generate AdjustmentTimeToQiblaDirection direction
* @param loc location where to calculate
* @return a SimpleTime object containg qibla direction
* @return a SimpleTime object containg qibla angle direction
*/
fun getNorthQibla(loc: Location): SimpleTime {
fun getAdjustmentTimeToQiblaDirection(loc: Location): SimpleTime {
/* xxxthamer: reduce Utils.DEG_TO_RAD usage */
val num: Double
val denom: Double
Expand Down

0 comments on commit 277f912

Please sign in to comment.