mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-01-11 11:59:06 +01:00
Remove hashmap for categories, since that causes OOM on some devices
This commit is contained in:
parent
69fd723410
commit
3c77ead449
@ -66,8 +66,6 @@ class LibraryPresenter(
|
|||||||
var categories: List<Category> = emptyList()
|
var categories: List<Category> = emptyList()
|
||||||
private set
|
private set
|
||||||
|
|
||||||
var hashCategories: HashMap<Int, Category> = hashMapOf()
|
|
||||||
|
|
||||||
var removeArticles: Boolean = preferences.removeArticles().getOrDefault()
|
var removeArticles: Boolean = preferences.removeArticles().getOrDefault()
|
||||||
|
|
||||||
/** All categories of the library, in case they are hidden because of hide categories is on */
|
/** All categories of the library, in case they are hidden because of hide categories is on */
|
||||||
@ -415,7 +413,7 @@ class LibraryPresenter(
|
|||||||
* @param categoryId id of the categoty to get
|
* @param categoryId id of the categoty to get
|
||||||
*/
|
*/
|
||||||
private fun getCategory(categoryId: Int): Category {
|
private fun getCategory(categoryId: Int): Category {
|
||||||
val category = hashCategories[categoryId] ?: createDefaultCategory()
|
val category = categories.find { categoryId == it.id } ?: createDefaultCategory()
|
||||||
category.isAlone = categories.size <= 1
|
category.isAlone = categories.size <= 1
|
||||||
return category
|
return category
|
||||||
}
|
}
|
||||||
@ -516,10 +514,6 @@ class LibraryPresenter(
|
|||||||
|
|
||||||
this.allCategories = categories
|
this.allCategories = categories
|
||||||
|
|
||||||
hashCategories = HashMap(this.categories.map {
|
|
||||||
it.id!! to it
|
|
||||||
}.toMap())
|
|
||||||
|
|
||||||
return items
|
return items
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user