1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-10 04:52:38 +01:00

Clean up Refwatcher

This commit is contained in:
Allan Wang 2017-06-04 11:15:37 -07:00
parent 5aac1cda7b
commit bb49bd9c9f
18 changed files with 20 additions and 49 deletions

View File

@ -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}"

View File

@ -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()
}
}

View File

@ -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())
}

View File

@ -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)

View File

@ -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)

View File

@ -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() {
}

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -1,7 +1,6 @@
package com.pitchedapps.frost.events
import android.content.Context
import com.pitchedapps.frost.WebOverlayActivity
import com.pitchedapps.frost.utils.launchWebOverlay
/**

View File

@ -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.

View File

@ -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

View File

@ -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()

View File

@ -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.

View File

@ -1,7 +1,6 @@
package com.pitchedapps.frost.utils
import android.content.Context
import android.content.res.Resources
import android.net.ConnectivityManager
/**

View File

@ -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
/**

View File

@ -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.

View File

@ -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