adding Leak Canary

This commit is contained in:
tibbi 2017-11-21 15:58:24 +01:00
parent 2bd75568ac
commit 9799148e3d
4 changed files with 24 additions and 4 deletions

View File

@ -20,10 +20,14 @@ android {
}
buildTypes {
debug {
buildConfigField "boolean", "USE_LEAK_CANARY", "true"
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField "boolean", "USE_LEAK_CANARY", "false"
}
}
@ -37,8 +41,15 @@ android {
}
}
ext {
leakCanaryVersion = '1.5.4'
}
dependencies {
compile 'com.simplemobiletools:commons:2.41.5'
implementation 'com.simplemobiletools:commons:2.41.5'
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
}
Properties props = new Properties()

View File

@ -1,12 +1,20 @@
package com.simplemobiletools.camera
import android.app.Application
import com.simplemobiletools.camera.BuildConfig.USE_LEAK_CANARY
import com.simplemobiletools.camera.extensions.config
import com.squareup.leakcanary.LeakCanary
import java.util.*
class App : Application() {
override fun onCreate() {
super.onCreate()
if (USE_LEAK_CANARY) {
if (LeakCanary.isInAnalyzerProcess(this)) {
return
}
LeakCanary.install(this)
}
if (config.useEnglish) {
val conf = resources.configuration

View File

@ -141,8 +141,8 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
}
private fun hideToggleModeAbout() {
toggle_photo_video.visibility = View.GONE
settings.visibility = View.GONE
toggle_photo_video.beGone()
settings.beGone()
}
private fun tryInitCamera() {

View File

@ -13,6 +13,7 @@ import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.extensions.useEnglishToggled
import com.simplemobiletools.commons.helpers.LICENSE_GLIDE
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
import com.simplemobiletools.commons.helpers.LICENSE_LEAK_CANARY
import kotlinx.android.synthetic.main.activity_settings.*
import java.io.File
import java.util.*
@ -48,7 +49,7 @@ class SettingsActivity : SimpleActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.about -> startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_GLIDE, BuildConfig.VERSION_NAME)
R.id.about -> startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_GLIDE or LICENSE_LEAK_CANARY, BuildConfig.VERSION_NAME)
else -> super.onOptionsItemSelected(item)
}
return true