/* * Copyright (C) 2015 Naman Dwivedi * * Licensed under the GNU General Public License v3 * * This is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. */ package com.naman14.timber; import android.app.Application; import com.afollestad.appthemeengine.ATE; import com.crashlytics.android.Crashlytics; import com.crashlytics.android.core.CrashlyticsCore; import com.naman14.timber.permissions.Nammu; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import com.nostra13.universalimageloader.utils.L; import io.fabric.sdk.android.Fabric; public class TimberApp extends Application { private static TimberApp mInstance; public static synchronized TimberApp getInstance() { return mInstance; } @Override public void onCreate() { super.onCreate(); mInstance = this; //disable crashlytics for debug builds Crashlytics crashlyticsKit = new Crashlytics.Builder() .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) .build(); Fabric.with(this, crashlyticsKit); ImageLoaderConfiguration localImageLoaderConfiguration = new ImageLoaderConfiguration.Builder(this).build(); ImageLoader.getInstance().init(localImageLoaderConfiguration); L.writeLogs(false); L.disableLogging(); L.writeDebugLogs(false); Nammu.init(this); if (!ATE.config(this, "light_theme").isConfigured()) { ATE.config(this, "light_theme") .activityTheme(R.style.AppThemeLight) .primaryColorRes(R.color.colorPrimaryLightDefault) .accentColorRes(R.color.colorAccentLightDefault) .coloredNavigationBar(false) .usingMaterialDialogs(true) .commit(); } if (!ATE.config(this, "dark_theme").isConfigured()) { ATE.config(this, "dark_theme") .activityTheme(R.style.AppThemeDark) .primaryColorRes(R.color.colorPrimaryDarkDefault) .accentColorRes(R.color.colorAccentDarkDefault) .coloredNavigationBar(false) .usingMaterialDialogs(true) .commit(); } if (!ATE.config(this, "light_theme_notoolbar").isConfigured()) { ATE.config(this, "light_theme_notoolbar") .activityTheme(R.style.AppThemeLight) .coloredActionBar(false) .primaryColorRes(R.color.colorPrimaryLightDefault) .accentColorRes(R.color.colorAccentLightDefault) .coloredNavigationBar(false) .usingMaterialDialogs(true) .commit(); } if (!ATE.config(this, "dark_theme_notoolbar").isConfigured()) { ATE.config(this, "dark_theme_notoolbar") .activityTheme(R.style.AppThemeDark) .coloredActionBar(false) .primaryColorRes(R.color.colorPrimaryDarkDefault) .accentColorRes(R.color.colorAccentDarkDefault) .coloredNavigationBar(true) .usingMaterialDialogs(true) .commit(); } } }