-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathApp.java
More file actions
53 lines (43 loc) · 1.81 KB
/
Copy pathApp.java
File metadata and controls
53 lines (43 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package ru.yandex.yamblz;
import android.app.Application;
import android.content.Context;
import android.support.annotation.NonNull;
import ru.yandex.yamblz.artists.utils.DataSingleton;
import ru.yandex.yamblz.developer_settings.DevMetricsProxy;
import ru.yandex.yamblz.developer_settings.DeveloperSettingsModel;
import ru.yandex.yamblz.handler.CriticalSectionsManager;
import ru.yandex.yamblz.handler.StubCriticalSectionsHandler;
import ru.yandex.yamblz.loader.CollageLoaderManager;
import timber.log.Timber;
public class App extends Application {
private ApplicationComponent applicationComponent;
// Prevent need in a singleton (global) reference to the application object.
@NonNull
public static App get(@NonNull Context context) {
return (App) context.getApplicationContext();
}
@Override
public void onCreate() {
super.onCreate();
applicationComponent = prepareApplicationComponent().build();
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
DeveloperSettingsModel developerSettingModel = applicationComponent.developerSettingModel();
developerSettingModel.apply();
DevMetricsProxy devMetricsProxy = applicationComponent.devMetricsProxy();
devMetricsProxy.apply();
}
CollageLoaderManager.init(null); // add implementation
CriticalSectionsManager.init(new StubCriticalSectionsHandler()); // add implementation
DataSingleton.init(this);
}
@NonNull
protected DaggerApplicationComponent.Builder prepareApplicationComponent() {
return DaggerApplicationComponent.builder()
.applicationModule(new ApplicationModule(this));
}
@NonNull
public ApplicationComponent applicationComponent() {
return applicationComponent;
}
}