diff options
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/PodcastApp.java')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/PodcastApp.java | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java index 451094909..c1d4bc4fd 100644 --- a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java +++ b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java @@ -1,12 +1,18 @@ package de.danoeh.antennapod; import android.app.Application; -import android.content.res.Configuration; +import android.os.Build; +import android.os.StrictMode; + +import com.joanzapata.iconify.Iconify; +import com.joanzapata.iconify.fonts.FontAwesomeModule; +import com.joanzapata.iconify.fonts.MaterialModule; -import de.danoeh.antennapod.core.asynctask.PicassoProvider; import de.danoeh.antennapod.core.feed.EventDistributor; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.storage.PodDBAdapter; +import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.spa.SPAUtil; /** Main application class. */ @@ -21,10 +27,6 @@ public class PodcastApp extends Application { } } - private static final String TAG = "PodcastApp"; - - private static float LOGICAL_DENSITY; - private static PodcastApp singleton; public static PodcastApp getInstance() { @@ -34,24 +36,36 @@ public class PodcastApp extends Application { @Override public void onCreate() { super.onCreate(); + + Thread.setDefaultUncaughtExceptionHandler(new CrashReportWriter()); + + if(BuildConfig.DEBUG) { + StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder() + .detectLeakedSqlLiteObjects() + .penaltyLog() + .penaltyDropBox(); + if (Build.VERSION.SDK_INT >= 11) { + builder.detectActivityLeaks(); + builder.detectLeakedClosableObjects(); + } + if(Build.VERSION.SDK_INT >= 16) { + builder.detectLeakedRegistrationObjects(); + } + StrictMode.setVmPolicy(builder.build()); + } + singleton = this; - LOGICAL_DENSITY = getResources().getDisplayMetrics().density; - PicassoProvider.setupPicassoInstance(this); - UserPreferences.createInstance(this); - PlaybackPreferences.createInstance(this); + PodDBAdapter.init(this); + UpdateManager.init(this); + UserPreferences.init(this); + PlaybackPreferences.init(this); + NetworkUtils.init(this); EventDistributor.getInstance(); + Iconify.with(new FontAwesomeModule()); + Iconify.with(new MaterialModule()); SPAUtil.sendSPAppsQueryFeedsIntent(this); - } - - public static float getLogicalDensity() { - return LOGICAL_DENSITY; - } - - public boolean isLargeScreen() { - return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE - || (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE; + } - } } |