diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationController.kt index 0c4748c83..c5c7c9683 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationController.kt @@ -10,6 +10,11 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.MigrationControllerBinding import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.browse.migration.manga.MangaAdapter +import eu.kanade.tachiyomi.ui.browse.migration.manga.MangaItem +import eu.kanade.tachiyomi.ui.browse.migration.search.SearchController +import eu.kanade.tachiyomi.ui.browse.migration.sources.SourceAdapter +import eu.kanade.tachiyomi.ui.browse.migration.sources.SourceItem import eu.kanade.tachiyomi.ui.browse.source.SourceDividerItemDecoration class MigrationController : @@ -64,7 +69,10 @@ class MigrationController : if (state.selectedSource == null) { title = resources?.getString(R.string.label_migration) if (adapter !is SourceAdapter) { - adapter = SourceAdapter(this) + adapter = + SourceAdapter( + this + ) binding.recycler.adapter = adapter adapter?.fastScroller = binding.fastScroller } @@ -72,7 +80,10 @@ class MigrationController : } else { title = state.selectedSource.toString() if (adapter !is MangaAdapter) { - adapter = MangaAdapter(this) + adapter = + MangaAdapter( + this + ) binding.recycler.adapter = adapter adapter?.fastScroller = binding.fastScroller } @@ -84,7 +95,10 @@ class MigrationController : val item = adapter?.getItem(position) ?: return false if (item is MangaItem) { - val controller = SearchController(item.manga) + val controller = + SearchController( + item.manga + ) controller.targetController = this parentController!!.router.pushController(controller.withFadeTransaction()) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationPresenter.kt index 4e9172ce3..a490589c8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MigrationPresenter.kt @@ -8,6 +8,9 @@ import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter +import eu.kanade.tachiyomi.ui.browse.migration.manga.MangaItem +import eu.kanade.tachiyomi.ui.browse.migration.sources.SelectionHeader +import eu.kanade.tachiyomi.ui.browse.migration.sources.SourceItem import eu.kanade.tachiyomi.util.lang.combineLatest import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers @@ -58,11 +61,17 @@ class MigrationPresenter( } private fun findSourcesWithManga(library: List): List { - val header = SelectionHeader() + val header = + SelectionHeader() return library.map { it.source }.toSet() .mapNotNull { if (it != LocalSource.ID) sourceManager.getOrStub(it) else null } .sortedBy { it.name } - .map { SourceItem(it, header) } + .map { + SourceItem( + it, + header + ) + } } private fun libraryToMigrationItem(library: List, sourceId: Long): List { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/ViewState.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/ViewState.kt index fb5d5f0e0..6ba1d178d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/ViewState.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/ViewState.kt @@ -1,6 +1,8 @@ package eu.kanade.tachiyomi.ui.browse.migration import eu.kanade.tachiyomi.source.Source +import eu.kanade.tachiyomi.ui.browse.migration.manga.MangaItem +import eu.kanade.tachiyomi.ui.browse.migration.sources.SourceItem data class ViewState( val selectedSource: Source? = null, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MangaAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MangaAdapter.kt similarity index 78% rename from app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MangaAdapter.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MangaAdapter.kt index ad6045759..0823357d6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MangaAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MangaAdapter.kt @@ -1,7 +1,8 @@ -package eu.kanade.tachiyomi.ui.browse.migration +package eu.kanade.tachiyomi.ui.browse.migration.manga import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.items.IFlexible +import eu.kanade.tachiyomi.ui.browse.migration.MigrationController class MangaAdapter(controller: MigrationController) : FlexibleAdapter>(null, controller) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MangaHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MangaHolder.kt similarity index 96% rename from app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MangaHolder.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MangaHolder.kt index 56d40f307..0cc61d055 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MangaHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MangaHolder.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.ui.browse.migration +package eu.kanade.tachiyomi.ui.browse.migration.manga import android.view.View import com.bumptech.glide.load.engine.DiskCacheStrategy diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MangaItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MangaItem.kt similarity index 89% rename from app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MangaItem.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MangaItem.kt index 467896534..939b7411e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/MangaItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MangaItem.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.ui.browse.migration +package eu.kanade.tachiyomi.ui.browse.migration.manga import android.view.View import androidx.recyclerview.widget.RecyclerView @@ -15,7 +15,10 @@ class MangaItem(val manga: Manga) : AbstractFlexibleItem() { } override fun createViewHolder(view: View, adapter: FlexibleAdapter>): MangaHolder { - return MangaHolder(view, adapter) + return MangaHolder( + view, + adapter + ) } override fun bindViewHolder( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt similarity index 85% rename from app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SearchController.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt index 330d001d1..dc8e0eeb1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.ui.browse.migration +package eu.kanade.tachiyomi.ui.browse.migration.search import android.app.Dialog import android.os.Bundle @@ -8,6 +8,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.ui.base.controller.DialogController +import eu.kanade.tachiyomi.ui.browse.migration.MigrationFlags import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchPresenter import eu.kanade.tachiyomi.util.view.gone @@ -21,7 +22,10 @@ class SearchController( private var newManga: Manga? = null override fun createPresenter(): GlobalSearchPresenter { - return SearchPresenter(initialQuery, manga!!) + return SearchPresenter( + initialQuery, + manga!! + ) } override fun onSaveInstanceState(outState: Bundle) { @@ -52,7 +56,8 @@ class SearchController( override fun onMangaClick(manga: Manga) { newManga = manga - val dialog = MigrationDialog() + val dialog = + MigrationDialog() dialog.targetController = this dialog.showDialog(router) } @@ -78,7 +83,10 @@ class SearchController( override fun onCreateDialog(savedViewState: Bundle?): Dialog { val prefValue = preferences.migrateFlags().get() - val preselected = MigrationFlags.getEnabledFlagsPositions(prefValue) + val preselected = + MigrationFlags.getEnabledFlagsPositions( + prefValue + ) return MaterialDialog(activity!!) .message(R.string.migration_dialog_what_to_include) @@ -87,7 +95,10 @@ class SearchController( initialSelection = preselected.toIntArray() ) { _, positions, _ -> // Save current settings for the next time - val newValue = MigrationFlags.getFlagsFromPositions(positions.toTypedArray()) + val newValue = + MigrationFlags.getFlagsFromPositions( + positions.toTypedArray() + ) preferences.migrateFlags().set(newValue) } .positiveButton(R.string.migrate) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SearchPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt similarity index 93% rename from app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SearchPresenter.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt index a837ad9c5..1fe62b2aa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SearchPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.ui.browse.migration +package eu.kanade.tachiyomi.ui.browse.migration.search import android.os.Bundle import com.jakewharton.rxrelay.BehaviorRelay @@ -8,6 +8,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga +import eu.kanade.tachiyomi.ui.browse.migration.MigrationFlags import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchCardItem import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchItem import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchPresenter @@ -70,9 +71,18 @@ class SearchPresenter( replace: Boolean ) { val flags = preferences.migrateFlags().get() - val migrateChapters = MigrationFlags.hasChapters(flags) - val migrateCategories = MigrationFlags.hasCategories(flags) - val migrateTracks = MigrationFlags.hasTracks(flags) + val migrateChapters = + MigrationFlags.hasChapters( + flags + ) + val migrateCategories = + MigrationFlags.hasCategories( + flags + ) + val migrateTracks = + MigrationFlags.hasTracks( + flags + ) db.inTransaction { // Update chapters read diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SelectionHeader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SelectionHeader.kt similarity index 92% rename from app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SelectionHeader.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SelectionHeader.kt index f211d6f66..f52fe466f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SelectionHeader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SelectionHeader.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.ui.browse.migration +package eu.kanade.tachiyomi.ui.browse.migration.sources import android.view.View import androidx.recyclerview.widget.RecyclerView @@ -25,7 +25,10 @@ class SelectionHeader : AbstractHeaderItem() { * Creates a new view holder for this item. */ override fun createViewHolder(view: View, adapter: FlexibleAdapter>): Holder { - return Holder(view, adapter) + return Holder( + view, + adapter + ) } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SourceAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceAdapter.kt similarity index 86% rename from app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SourceAdapter.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceAdapter.kt index a556eafbf..82504ea9c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SourceAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceAdapter.kt @@ -1,8 +1,9 @@ -package eu.kanade.tachiyomi.ui.browse.migration +package eu.kanade.tachiyomi.ui.browse.migration.sources import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.items.IFlexible import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.ui.browse.migration.MigrationController import eu.kanade.tachiyomi.util.system.getResourceColor /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt similarity index 95% rename from app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SourceHolder.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt index 04ef0c752..e076bc507 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceHolder.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.ui.browse.migration +package eu.kanade.tachiyomi.ui.browse.migration.sources import android.view.View import eu.kanade.tachiyomi.source.icon diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SourceItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceItem.kt similarity index 89% rename from app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SourceItem.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceItem.kt index 3c6cbe5d6..8bedd67d3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/SourceItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SourceItem.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.ui.browse.migration +package eu.kanade.tachiyomi.ui.browse.migration.sources import android.view.View import androidx.recyclerview.widget.RecyclerView @@ -28,7 +28,10 @@ data class SourceItem(val source: Source, val header: SelectionHeader? = null) : * Creates a new view holder for this item. */ override fun createViewHolder(view: View, adapter: FlexibleAdapter>): SourceHolder { - return SourceHolder(view, adapter as SourceAdapter) + return SourceHolder( + view, + adapter as SourceAdapter + ) } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt index da1fef09e..5b49905b0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt @@ -24,7 +24,7 @@ import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction -import eu.kanade.tachiyomi.ui.browse.migration.SearchController +import eu.kanade.tachiyomi.ui.browse.migration.search.SearchController import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog @@ -554,7 +554,10 @@ class MangaInfoController(private val fromSource: Boolean = false) : * Initiates source migration for the specific manga. */ private fun migrateManga() { - val controller = SearchController(presenter.manga) + val controller = + SearchController( + presenter.manga + ) controller.targetController = this parentController!!.router.pushController(controller.withFadeTransaction()) }