Moved debug warnings into Startup.

This commit is contained in:
Dennis Guse
2019-09-02 15:50:29 +02:00
parent 1ef81c45db
commit 72b1ca82ed
6 changed files with 40 additions and 30 deletions
@@ -1,15 +0,0 @@
package de.dennisguse.opentracks;
import android.app.Application;
import de.dennisguse.opentracks.util.PreferencesUtils;
public class InitPreferences extends Application {
@Override
public void onCreate() {
super.onCreate();
//Set default values of preferences on first start.
PreferencesUtils.resetPreferences(this, false);
}
}
@@ -0,0 +1,37 @@
package de.dennisguse.opentracks;
import android.app.Application;
import android.os.StrictMode;
import android.util.Log;
import de.dennisguse.opentracks.util.PreferencesUtils;
public class Startup extends Application {
private final static String TAG = Startup.class.getSimpleName();
@Override
public void onCreate() {
super.onCreate();
//Include version information into stack traces.
Log.i(TAG, BuildConfig.APPLICATION_ID + "; BuildType: " + BuildConfig.BUILD_TYPE + "; VersionName: " + BuildConfig.VERSION_NAME + " VersionCode: " + BuildConfig.VERSION_CODE);
//Set default values of preferences on first start.
PreferencesUtils.resetPreferences(this, false);
//In debug builds: show thread and VM warnings.
if (BuildConfig.DEBUG) {
Log.d(TAG, "Enabling strict mode");
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
}
}
}
@@ -248,18 +248,6 @@ public class TrackListActivity extends AbstractListActivity implements ConfirmDe
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// if (BuildConfig.DEBUG) {
// Log.d(TAG, "Enabling strict mode");
// StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
// .detectAll()
// .penaltyLog()
// .build());
// StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
// .detectAll()
// .penaltyLog()
// .build());
// }
contentProviderUtils = ContentProviderUtils.Factory.get(this);
sharedPreferences = PreferencesUtils.getSharedPreferences(this);
@@ -40,7 +40,7 @@ public class ShareContentProvider extends CustomContentProvider implements ICont
private static final String[] COLUMNS = {OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE};
public static final String TAG = ShareContentProvider.class.getCanonicalName();
public static final String TAG = ShareContentProvider.class.getSimpleName();
private static final int URI_GPX = 0;
private static final int URI_KML_ONLY = 1;
@@ -46,7 +46,7 @@ import de.dennisguse.opentracks.io.file.TrackFileFormat;
*/
public class IntentUtils {
private final static String TAG = IntentUtils.class.getCanonicalName();
private final static String TAG = IntentUtils.class.getSimpleName();
private IntentUtils() {
}