Created
November 4, 2019 18:52
-
-
Save MahmoudMabrok/d1c836c7e25d45371c5f428ab8e62b39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implementation 'com.google.code.gson:gson:2.8.5' | |
implementation 'com.jakewharton:butterknife:10.1.0' | |
annotationProcessor "com.jakewharton:butterknife-compiler:10.1.0" | |
implementation "com.balsikandar.android:crashreporter:1.0.9" | |
implementation 'com.squareup.retrofit2:retrofit:2.3.0' | |
implementation 'com.squareup.retrofit2:converter-gson:2.3.0' | |
implementation 'com.intuit.sdp:sdp-android:1.0.6' | |
implementation 'com.intuit.ssp:ssp-android:1.0.6' | |
def lifecycle_version = '2.0.0-beta01' | |
implementation "androidx.room:room-runtime:$lifecycle_version" | |
annotationProcessor "androidx.room:room-compiler:$lifecycle_version" | |
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" | |
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version" |
public class ApiClient {
private static final String prayerUrl = "http://api.aladhan.com/v1/";
static Gson gson = new GsonBuilder()
.setLenient()
.create();
private static Retrofit retrofitPrayer = null;
public static synchronized Retrofit getRetrofitPrayer() {
if (retrofitPrayer == null) {
retrofitPrayer = new Retrofit.Builder()
.baseUrl(prayerUrl)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
return retrofitPrayer;
}
}
package utitity.mahmoud.prayertimes.datalayer.local.room;
import android.app.Application;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import androidx.room.TypeConverters;
@database(entities = {DayPrayerItem.class}, version = 2, exportSchema = false)
@TypeConverters({TimingConverter.class})
public abstract class PrayerDB extends RoomDatabase {
static PrayerDB instance;
public static synchronized PrayerDB getInstance(Application application) {
if (instance == null) {
instance = Room.databaseBuilder(application, PrayerDB.class, "prayer")
.allowMainThreadQueries()
.fallbackToDestructiveMigration()
.build();
}
return instance;
}
public abstract DayPrayerDao getDayPrayerDao();
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}