fixed some memory leaks, close #744
This commit is contained in:
parent
952dddba03
commit
ab96713b8e
|
@ -611,7 +611,6 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||||
context: Context,
|
context: Context,
|
||||||
val firsSyncLoad: Boolean
|
val firsSyncLoad: Boolean
|
||||||
) : FixedAsyncTaskLoader<AccountsInfo>(context) {
|
) : FixedAsyncTaskLoader<AccountsInfo>(context) {
|
||||||
private val am = AccountManager.get(context)
|
|
||||||
|
|
||||||
private var contentObserver: ContentObserver? = null
|
private var contentObserver: ContentObserver? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
|
@ -624,6 +623,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||||
}
|
}
|
||||||
private var accountListener: OnAccountsUpdateListener? = null
|
private var accountListener: OnAccountsUpdateListener? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
|
val am = AccountManager.get(context)
|
||||||
field?.let {
|
field?.let {
|
||||||
am.removeOnAccountsUpdatedListenerSafe(it)
|
am.removeOnAccountsUpdatedListenerSafe(it)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,9 @@ class AccountDetailsLoader(
|
||||||
val filter: (AccountDetails.() -> Boolean)? = null
|
val filter: (AccountDetails.() -> Boolean)? = null
|
||||||
) : FixedAsyncTaskLoader<List<AccountDetails>>(context) {
|
) : FixedAsyncTaskLoader<List<AccountDetails>>(context) {
|
||||||
|
|
||||||
private val am: AccountManager = AccountManager.get(context)
|
|
||||||
|
|
||||||
private var accountUpdateListener: OnAccountsUpdateListener? = null
|
private var accountUpdateListener: OnAccountsUpdateListener? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
|
val am: AccountManager = AccountManager.get(context)
|
||||||
field?.let {
|
field?.let {
|
||||||
am.removeOnAccountsUpdatedListenerSafe(it)
|
am.removeOnAccountsUpdatedListenerSafe(it)
|
||||||
}
|
}
|
||||||
|
@ -31,6 +30,7 @@ class AccountDetailsLoader(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun loadInBackground(): List<AccountDetails> {
|
override fun loadInBackground(): List<AccountDetails> {
|
||||||
|
val am: AccountManager = AccountManager.get(context)
|
||||||
return AccountUtils.getAllAccountDetails(am, true).filter {
|
return AccountUtils.getAllAccountDetails(am, true).filter {
|
||||||
filter?.invoke(it) ?: true
|
filter?.invoke(it) ?: true
|
||||||
}.sortedBy(AccountDetails::position)
|
}.sortedBy(AccountDetails::position)
|
||||||
|
|
Loading…
Reference in New Issue