Minor cleanup

This commit is contained in:
Jobobby04
2022-07-18 09:59:09 -04:00
parent 6f4a46b437
commit cec181f444
8 changed files with 21 additions and 98 deletions
@@ -349,7 +349,7 @@ class LibraryUpdateService(
}
}
LibraryGroup.BY_SOURCE -> {
val sourceExtra = groupExtra.nullIfBlank()?.toIntOrNull()
val sourceExtra = groupExtra?.nullIfBlank()?.toIntOrNull()
val source = libraryManga.map { it.source }
.distinct()
.sorted()
@@ -124,7 +124,7 @@ open class SourceFeedController :
}
override fun onSearchViewQueryTextSubmit(query: String?) {
onBrowseClick(query.nullIfBlank())
onBrowseClick(query?.nullIfBlank())
}
override fun onSearchViewQueryTextChange(newText: String?) {
@@ -54,7 +54,6 @@ import exh.source.PERV_EDEN_IT_SOURCE_ID
import exh.source.isEhBasedManga
import exh.source.mangaDexSourceIds
import exh.source.nHentaiSourceIds
import exh.ui.LoaderManager
import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel
import kotlinx.coroutines.delay
@@ -121,7 +120,6 @@ class LibraryController(
// Favorites
private var favoritesSyncJob: Job? = null
val loaderManager = LoaderManager()
// <-- EH
init {
@@ -462,7 +460,7 @@ class LibraryController(
.setTitle(R.string.favorites_sync)
.setMessage(R.string.favorites_sync_conformation_message)
.setPositiveButton(android.R.string.ok) { _, _ ->
presenter.favoritesSync.runSync()
presenter.runSync()
}
.setNegativeButton(android.R.string.cancel, null)
.show()
@@ -168,13 +168,12 @@ class LibraryPresenter(
var groupType = preferences.groupLibraryBy().get()
private val libraryIsGrouped
get() = groupType != LibraryGroup.UNGROUPED
private val loggedServices by lazy { trackManager.services.filter { it.isLogged } }
private val services = trackManager.services.associate { service ->
service.id to context.getString(service.nameRes())
private val services by lazy {
trackManager.services.associate { service ->
service.id to context.getString(service.nameRes())
}
}
/**
@@ -570,7 +569,7 @@ class LibraryPresenter(
var editedCategories = categories
val items = if (groupType == LibraryGroup.BY_DEFAULT) {
map
} else if (!libraryIsGrouped) {
} else if (groupType == LibraryGroup.UNGROUPED) {
editedCategories = listOf(Category(0, "All", 0, 0))
mapOf(
0L to map.values.flatten().distinctBy { it.manga.id },
@@ -1123,9 +1122,8 @@ class LibraryPresenter(
return map to categories
}
override fun onDestroy() {
super.onDestroy()
favoritesSync.onDestroy()
fun runSync() {
favoritesSync.runSync(presenterScope)
}
// SY <--
}