aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-04 11:15:37 -0700
committerAllan Wang <me@allanwang.ca>2017-06-04 11:15:37 -0700
commitbb49bd9c9f4fe44426c9a576827ad6a96a3ebda4 (patch)
tree483ed9b5d0da645053ef6f3ab3cea3e821d95e7d
parent5aac1cda7b1ad561131de109d1f29e8e7b730e82 (diff)
downloadfrost-bb49bd9c9f4fe44426c9a576827ad6a96a3ebda4.tar.gz
frost-bb49bd9c9f4fe44426c9a576827ad6a96a3ebda4.tar.bz2
frost-bb49bd9c9f4fe44426c9a576827ad6a96a3ebda4.zip
Clean up Refwatcher
-rw-r--r--app/build.gradle1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/BaseLeakActivity.kt14
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt20
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/SelectorActivity.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/events/FbAccountEvent.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/events/WebLaunchEvent.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/ContextUtils.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/ViewUtils.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt1
18 files changed, 20 insertions, 49 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 891db44d..0603b0da 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -85,6 +85,7 @@ dependencies {
compile "com.jakewharton.timber:timber:${TIMBER}"
debugCompile "com.squareup.leakcanary:leakcanary-android:${LEAK_CANARY}"
+ releaseTestCompile "com.squareup.leakcanary:leakcanary-android-no-op:${LEAK_CANARY}"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:${LEAK_CANARY}"
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:${LEAK_CANARY}"
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/BaseLeakActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/BaseLeakActivity.kt
deleted file mode 100644
index ab91f044..00000000
--- a/app/src/main/kotlin/com/pitchedapps/frost/BaseLeakActivity.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.pitchedapps.frost
-
-import android.support.v7.app.AppCompatActivity
-import com.pitchedapps.frost.utils.refWatch
-
-/**
- * Created by Allan Wang on 2017-06-04.
- */
-open class BaseLeakActivity : AppCompatActivity() {
- override fun onDestroy() {
- super.onDestroy()
- refWatch()
- }
-} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
index 5527e434..b7b6b2d5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
@@ -29,21 +29,19 @@ import timber.log.Timber.DebugTree
*/
class FrostApp : Application() {
- companion object {
- fun refWatcher(c: Context) = (c.applicationContext as FrostApp).refWatcher
- }
+// companion object {
+// fun refWatcher(c: Context) = (c.applicationContext as FrostApp).refWatcher
+// }
lateinit var refWatcher: RefWatcher
override fun onCreate() {
- if (LeakCanary.isInAnalyzerProcess(this)) {
- // This process is dedicated to LeakCanary for heap analysis.
- // You should not init your app in this process.
- return;
- }
- refWatcher = LeakCanary.install(this);
- if (BuildConfig.DEBUG) Timber.plant(DebugTree())
- else {
+ if (LeakCanary.isInAnalyzerProcess(this)) return
+ refWatcher = LeakCanary.install(this)
+ if (BuildConfig.DEBUG) {
+ Timber.plant(DebugTree())
+ LeakCanary.enableDisplayLeakActivity(this)
+ } else {
Fabric.with(this, Crashlytics(), Answers())
Timber.plant(CrashReportingTree())
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt
index 914e27b2..244953a7 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt
@@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable
import android.os.Bundle
import android.os.Handler
import android.support.v4.widget.SwipeRefreshLayout
+import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.AppCompatTextView
import android.support.v7.widget.Toolbar
import android.widget.ImageView
@@ -39,7 +40,7 @@ import kotlin.concurrent.thread
/**
* Created by Allan Wang on 2017-06-01.
*/
-class LoginActivity : BaseLeakActivity() {
+class LoginActivity : AppCompatActivity() {
val toolbar: Toolbar by bindView(R.id.toolbar)
val web: LoginWebView by bindView(R.id.login_webview)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
index fa666aa4..b9118c60 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
@@ -7,6 +7,7 @@ import android.support.design.widget.TabLayout
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.support.v4.view.ViewPager
+import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import android.view.Menu
import android.view.MenuItem
@@ -31,7 +32,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.subjects.PublishSubject
-class MainActivity : BaseLeakActivity() {
+class MainActivity : AppCompatActivity() {
lateinit var adapter: SectionsPagerAdapter
val toolbar: Toolbar by bindView(R.id.toolbar)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/SelectorActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/SelectorActivity.kt
index 85eea240..5cbd08bc 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/SelectorActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/SelectorActivity.kt
@@ -1,8 +1,10 @@
package com.pitchedapps.frost
+import android.support.v7.app.AppCompatActivity
+
/**
* Created by Allan Wang on 2017-06-04.
*/
-class SelectorActivity : BaseLeakActivity() {
+class SelectorActivity : AppCompatActivity() {
} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
index 7245b9c5..04056043 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
@@ -9,7 +9,7 @@ import com.pitchedapps.frost.utils.launchNewTask
/**
* Created by Allan Wang on 2017-05-28.
*/
-class StartActivity : BaseLeakActivity() {
+class StartActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
index 9bf6f500..3ec47a10 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
@@ -1,6 +1,7 @@
package com.pitchedapps.frost
import android.os.Bundle
+import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import butterknife.ButterKnife
import com.jude.swipbackhelper.SwipeBackHelper
@@ -12,7 +13,7 @@ import com.pitchedapps.frost.web.FrostWebView
/**
* Created by Allan Wang on 2017-06-01.
*/
-class WebOverlayActivity : BaseLeakActivity() {
+class WebOverlayActivity : AppCompatActivity() {
val toolbar: Toolbar by bindView(R.id.overlay_toolbar)
val frostWeb: FrostWebView by bindView(R.id.overlay_frost_webview)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/events/FbAccountEvent.kt b/app/src/main/kotlin/com/pitchedapps/frost/events/FbAccountEvent.kt
index 10173de2..051407cf 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/events/FbAccountEvent.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/events/FbAccountEvent.kt
@@ -4,7 +4,6 @@ import com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.facebook.PROFILE_PICTURE_URL
-import com.pitchedapps.frost.facebook.UsernameFetcher
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.web.FrostWebViewCore
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/events/WebLaunchEvent.kt b/app/src/main/kotlin/com/pitchedapps/frost/events/WebLaunchEvent.kt
index 13a8187a..5ba35237 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/events/WebLaunchEvent.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/events/WebLaunchEvent.kt
@@ -1,7 +1,6 @@
package com.pitchedapps.frost.events
import android.content.Context
-import com.pitchedapps.frost.WebOverlayActivity
import com.pitchedapps.frost.utils.launchWebOverlay
/**
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt
index af7e086a..2146ae26 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt
@@ -5,10 +5,8 @@ import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.dbflow.loadFbCookie
import com.pitchedapps.frost.dbflow.removeCookie
import com.pitchedapps.frost.dbflow.saveFbCookie
-import com.pitchedapps.frost.events.FbAccountEvent
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
-import org.greenrobot.eventbus.EventBus
/**
* Created by Allan Wang on 2017-05-30.
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
index 3882260e..e8fb5a21 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
@@ -3,7 +3,6 @@ package com.pitchedapps.frost.fragments
import android.content.Context
import android.os.Bundle
import android.support.v4.app.Fragment
-import android.support.v4.widget.SwipeRefreshLayout
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/ContextUtils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/ContextUtils.kt
index 702196bb..b8d76f40 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/ContextUtils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/ContextUtils.kt
@@ -4,9 +4,7 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.support.v4.app.ActivityOptionsCompat
-import android.support.v4.app.Fragment
import android.support.v4.content.ContextCompat
-import com.pitchedapps.frost.FrostApp
import com.pitchedapps.frost.R
import com.pitchedapps.frost.WebOverlayActivity
import com.pitchedapps.frost.dbflow.CookieModel
@@ -48,9 +46,3 @@ fun Activity.restart() {
startActivity(intent);
overridePendingTransition(0, 0)
}
-
-fun Context.refWatch() {
- FrostApp.refWatcher(this).watch(this)
-}
-
-fun Fragment.refWatch() = context.refWatch() \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt
index e7a38227..f945c90a 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/FragmentUtils.kt
@@ -2,7 +2,6 @@ package com.pitchedapps.frost.utils
import android.os.Bundle
import android.support.v4.app.Fragment
-import com.pitchedapps.frost.fragments.BaseFragment
/**
* Created by Allan Wang on 2017-05-29.
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
index d5bb2502..c754f6ff 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -1,7 +1,6 @@
package com.pitchedapps.frost.utils
import android.content.Context
-import android.content.res.Resources
import android.net.ConnectivityManager
/**
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/ViewUtils.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/ViewUtils.kt
index 474889ba..8dc3f01f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/ViewUtils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/ViewUtils.kt
@@ -9,7 +9,6 @@ import android.support.v4.content.ContextCompat
import android.view.View
import android.view.ViewGroup
import android.widget.ProgressBar
-import android.widget.TextView
/**
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt
index f9deb3b8..439ab6fa 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt
@@ -10,9 +10,7 @@ import android.widget.ProgressBar
import butterknife.ButterKnife
import com.pitchedapps.frost.R
import com.pitchedapps.frost.utils.bindView
-import io.reactivex.Scheduler
import io.reactivex.android.schedulers.AndroidSchedulers
-import io.reactivex.disposables.Disposable
/**
* Created by Allan Wang on 2017-06-01.
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt
index 7073f645..ede07710 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt
@@ -10,7 +10,6 @@ import com.pitchedapps.frost.facebook.FACEBOOK_COM
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.injectors.CssAssets
import com.pitchedapps.frost.utils.L
-import com.pitchedapps.frost.views.circularReveal
import com.pitchedapps.frost.views.fadeIn
import com.pitchedapps.frost.views.snackbar
import io.reactivex.subjects.PublishSubject