New All In One Manga interface, its optional and can be disabled

This commit is contained in:
Jobobby04
2020-05-11 15:33:38 -04:00
parent 92af538b0a
commit b09f1fff51
17 changed files with 3015 additions and 67 deletions
@@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.databinding.SmartSearchBinding
import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.SourceManager
@@ -11,6 +12,7 @@ import eu.kanade.tachiyomi.ui.base.controller.NucleusController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.browse.source.SourceController
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController
import eu.kanade.tachiyomi.ui.manga.MangaAllInOneController
import eu.kanade.tachiyomi.ui.manga.MangaController
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.CoroutineScope
@@ -20,6 +22,8 @@ import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
class SmartSearchController(bundle: Bundle? = null) : NucleusController<SmartSearchBinding, SmartSearchPresenter>(), CoroutineScope {
@@ -59,7 +63,11 @@ class SmartSearchController(bundle: Bundle? = null) : NucleusController<SmartSea
for (event in presenter.smartSearchChannel) {
withContext(NonCancellable) {
if (event is SmartSearchPresenter.SearchResults.Found) {
val transaction = MangaController(event.manga, true, smartSearchConfig).withFadeTransaction()
val transaction = if (Injekt.get<PreferencesHelper>().eh_useNewMangaInterface().get()) {
MangaAllInOneController(event.manga, true, smartSearchConfig).withFadeTransaction()
} else {
MangaController(event.manga, true, smartSearchConfig).withFadeTransaction()
}
withContext(Dispatchers.Main) {
router.replaceTopController(transaction)
}