diff --git a/.gitignore b/.gitignore index 664a333..3531ff2 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ freeline/ freeline_project_description.json /.idea/markdown-navigator.xml /.idea/markdown-navigator/profiles_settings.xml +/app/fabric.properties diff --git a/app/build.gradle b/app/build.gradle index db6cbee..f09a141 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,4 +1,19 @@ +buildscript { + repositories { + maven { url 'https://maven.fabric.io/public' } + } + + dependencies { + classpath 'io.fabric.tools:gradle:1.+' + } +} apply plugin: 'com.android.application' +apply plugin: 'io.fabric' + +repositories { + maven { url 'https://maven.fabric.io/public' } +} + android { compileSdkVersion 25 @@ -17,6 +32,7 @@ android { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + buildConfigField "boolean", "USE_CRASHLYTICS", "true" ext.enableCrashlytics = true } @@ -25,6 +41,7 @@ android { versionNameSuffix "-build-" + getDate() minifyEnabled false + buildConfigField "boolean", "USE_CRASHLYTICS", "false" ext.enableCrashlytics = false } @@ -48,4 +65,7 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile "com.android.support:appcompat-v7:$supportLibVersion" compile "com.android.support:design:$supportLibVersion" + compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { + transitive = true; + } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dff83af..1ae531a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,9 +2,11 @@ + - \ No newline at end of file + diff --git a/app/src/main/java/ca/mudar/rotationquicksetting/RotationQSApp.java b/app/src/main/java/ca/mudar/rotationquicksetting/RotationQSApp.java new file mode 100644 index 0000000..75aa4f3 --- /dev/null +++ b/app/src/main/java/ca/mudar/rotationquicksetting/RotationQSApp.java @@ -0,0 +1,27 @@ +package ca.mudar.rotationquicksetting; + +import android.app.Application; + +import com.crashlytics.android.Crashlytics; + +import ca.mudar.rotationquicksetting.data.UserPrefs; +import io.fabric.sdk.android.Fabric; + +/** + * Created by mudar on 22/05/17. + */ + +public class RotationQSApp extends Application { + @Override + public void onCreate() { + super.onCreate(); + + if (BuildConfig.USE_CRASHLYTICS) { + Fabric.with(this, new Crashlytics()); + } + + UserPrefs.setDefaults(this); + + } + +} diff --git a/app/src/main/java/ca/mudar/rotationquicksetting/ui/MainActivity.java b/app/src/main/java/ca/mudar/rotationquicksetting/ui/MainActivity.java index 05ecd29..256ace2 100644 --- a/app/src/main/java/ca/mudar/rotationquicksetting/ui/MainActivity.java +++ b/app/src/main/java/ca/mudar/rotationquicksetting/ui/MainActivity.java @@ -21,9 +21,6 @@ protected void onCreate(Bundle savedInstanceState) { showOnboardingIfNecessary(); - // Set default preferences - UserPrefs.setDefaults(getApplicationContext()); - if (savedInstanceState == null) { final Fragment fragment = SettingsFragment.newInstance(); getFragmentManager().beginTransaction()