package de.markusfisch.android.shadereditor.app;

import de.markusfisch.android.shadereditor.database.DataSource;
import de.markusfisch.android.shadereditor.preference.Preferences;
import de.markusfisch.android.shadereditor.BuildConfig;

import android.app.Application;
import android.os.StrictMode;

public class ShaderEditorApplication extends Application {
	public static final Preferences preferences = new Preferences();
	public static final DataSource dataSource = new DataSource();

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

		preferences.init(this);
		dataSource.openAsync(this);

		if (BuildConfig.DEBUG) {
			StrictMode.setThreadPolicy(
					new StrictMode.ThreadPolicy.Builder()
							.detectAll()
							.penaltyLog()
							.build());

			StrictMode.setVmPolicy(
					new StrictMode.VmPolicy.Builder()
							.detectLeakedSqlLiteObjects()
							.penaltyLog()
							.penaltyDeath()
							.build());
		}
	}
}

@@ -545,65 +545,8 @@
 );%0A%0A
-%09%09preferences.init(this);%0A%09%09dataSource.openAsync(this);%0A%0A
 %09%09if
@@ -870,14 +870,71 @@
 ());%0A%09%09%7D
+%0A%0A%09%09preferences.init(this);%0A%09%09dataSource.openAsync(this);
 %0A%09%7D%0A%7D%0A

Initialize strict mode before anything else