package io.github.droidkaigi.confsched2017;

import android.app.Application;
import android.support.annotation.NonNull;

import io.github.droidkaigi.confsched2017.di.AppComponent;
import io.github.droidkaigi.confsched2017.di.AppModule;
import io.github.droidkaigi.confsched2017.di.DaggerAppComponent;
import io.github.droidkaigi.confsched2017.log.CrashLogTree;
import timber.log.Timber;
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;

public class MainApplication extends Application {

    AppComponent appComponent;

    @NonNull
    public AppComponent getComponent() {
        return appComponent;
    }

    @Override
    public void onCreate() {
        super.onCreate();

        appComponent = DaggerAppComponent.builder()
                .appModule(new AppModule(this))
                .build();

        initCalligraphy();

        Timber.plant(new CrashLogTree()); // TODO initialize Firebase before this line
    }

    private void initCalligraphy() {
        CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                .setDefaultFontPath(getString(R.string.font_noto_cjk_medium))
                .setFontAttrId(R.attr.fontPath)
                .build()
        );
    }
}

@@ -38,16 +38,60 @@
 d2017;%0A%0A
+import com.squareup.leakcanary.LeakCanary;%0A%0A
 import a
@@ -876,16 +876,42 @@
 raphy();
+%0A        initLeakCanary();
 %0A%0A      
@@ -1272,11 +1272,170 @@
 );%0A    %7D
+%0A%0A    private void initLeakCanary() %7B%0A        if (LeakCanary.isInAnalyzerProcess(this)) %7B%0A            return;%0A        %7D%0A        LeakCanary.install(this);%0A    %7D
 %0A%7D%0A

Initialize LeakCanary