1 package com.moiseum.wolnelektury.base;
3 import android.support.multidex.MultiDexApplication;
5 import com.crashlytics.android.Crashlytics;
6 import com.crashlytics.android.core.CrashlyticsCore;
7 import com.moiseum.wolnelektury.BuildConfig;
8 import com.moiseum.wolnelektury.connection.RestClient;
9 import com.moiseum.wolnelektury.storage.BookStorage;
10 import com.moiseum.wolnelektury.utils.SharedPreferencesUtils;
11 import com.moiseum.wolnelektury.utils.TrackerUtils;
13 import org.piwik.sdk.Tracker;
15 import io.fabric.sdk.android.Fabric;
17 public class WLApplication extends MultiDexApplication {
19 private static WLApplication instance;
20 private RestClient restClient;
21 private BookStorage bookStorage;
22 private Tracker tracker;
23 private SharedPreferencesUtils preferences;
26 public void onCreate() {
29 bookStorage = new BookStorage(this);
31 Crashlytics crashlytics = new Crashlytics.Builder()
32 .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
34 Fabric.with(this, new Crashlytics());
37 public static WLApplication getInstance() {
41 public RestClient getRestClient() {
42 if (restClient == null) {
43 restClient = new RestClient(getApplicationContext());
48 public BookStorage getBookStorage() {
52 public synchronized Tracker getTracker() {
53 if (tracker == null) {
54 tracker = TrackerUtils.create(this);
59 public SharedPreferencesUtils getPreferences() {
60 if (preferences == null) {
61 preferences = new SharedPreferencesUtils(this);