mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
add some cleanup on low memory
doesnt help by much but its here now
This commit is contained in:
parent
92b98cef5c
commit
077b5ab916
4 changed files with 24 additions and 0 deletions
|
@ -20,7 +20,10 @@ import eu.kanade.tachiyomi.data.image.coil.CoilSetup
|
|||
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryPresenter
|
||||
import eu.kanade.tachiyomi.ui.recents.RecentsPresenter
|
||||
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
||||
import eu.kanade.tachiyomi.ui.source.SourcePresenter
|
||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil
|
||||
import eu.kanade.tachiyomi.util.system.notification
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
|
@ -120,6 +123,13 @@ open class App : Application(), DefaultLifecycleObserver {
|
|||
MultiDex.install(this)
|
||||
}
|
||||
|
||||
override fun onLowMemory() {
|
||||
super.onLowMemory()
|
||||
LibraryPresenter.onLowMemory()
|
||||
RecentsPresenter.onLowMemory()
|
||||
SourcePresenter.onLowMemory()
|
||||
}
|
||||
|
||||
protected open fun setupAcra() {
|
||||
initAcra {
|
||||
reportFormat = StringFormat.JSON
|
||||
|
|
|
@ -1132,6 +1132,11 @@ class LibraryPresenter(
|
|||
private const val randomGroupOfTagsNormal = 1
|
||||
private const val randomGroupOfTagsNegate = 2
|
||||
|
||||
fun onLowMemory() {
|
||||
lastLibraryItems = null
|
||||
lastCategories = null
|
||||
}
|
||||
|
||||
suspend fun setSearchSuggestion(
|
||||
preferences: PreferencesHelper,
|
||||
db: DatabaseHelper,
|
||||
|
|
|
@ -505,6 +505,10 @@ class RecentsPresenter(
|
|||
companion object {
|
||||
private var lastRecents: List<RecentMangaItem>? = null
|
||||
|
||||
fun onLowMemory() {
|
||||
lastRecents = null
|
||||
}
|
||||
|
||||
const val VIEW_TYPE_GROUP_ALL = 0
|
||||
const val VIEW_TYPE_UNGROUP_ALL = 1
|
||||
const val VIEW_TYPE_ONLY_HISTORY = 2
|
||||
|
|
|
@ -145,5 +145,10 @@ class SourcePresenter(
|
|||
|
||||
private var lastSources: List<SourceItem>? = null
|
||||
private var lastUsedItemRem: SourceItem? = null
|
||||
|
||||
fun onLowMemory() {
|
||||
lastSources = null
|
||||
lastUsedItemRem = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue