Rename catalogue classes/layouts -> source

This commit is contained in:
arkon 2020-04-12 12:21:47 -04:00
parent c784d24fa6
commit a1e7592bd8
74 changed files with 294 additions and 300 deletions

View File

@ -1,3 +0,0 @@
package eu.kanade.tachiyomi.ui.catalogue.browse
class NoResultsException : Exception()

View File

@ -6,15 +6,15 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.util.view.visibleIf import eu.kanade.tachiyomi.util.view.visibleIf
import kotlinx.android.synthetic.main.catalogue_grid_item.download_text import kotlinx.android.synthetic.main.source_grid_item.download_text
import kotlinx.android.synthetic.main.catalogue_grid_item.local_text import kotlinx.android.synthetic.main.source_grid_item.local_text
import kotlinx.android.synthetic.main.catalogue_grid_item.thumbnail import kotlinx.android.synthetic.main.source_grid_item.thumbnail
import kotlinx.android.synthetic.main.catalogue_grid_item.title import kotlinx.android.synthetic.main.source_grid_item.title
import kotlinx.android.synthetic.main.catalogue_grid_item.unread_text import kotlinx.android.synthetic.main.source_grid_item.unread_text
/** /**
* Class used to hold the displayed data of a manga in the library, like the cover or the title. * Class used to hold the displayed data of a manga in the library, like the cover or the title.
* All the elements from the layout file "item_catalogue_grid" are available in this class. * All the elements from the layout file "item_source_grid" are available in this class.
* *
* @param view the inflated view for this holder. * @param view the inflated view for this holder.
* @param adapter the adapter handling this holder. * @param adapter the adapter handling this holder.

View File

@ -15,8 +15,8 @@ import eu.kanade.tachiyomi.data.database.models.LibraryManga
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.widget.AutofitRecyclerView import eu.kanade.tachiyomi.widget.AutofitRecyclerView
import kotlinx.android.synthetic.main.catalogue_grid_item.view.card import kotlinx.android.synthetic.main.source_grid_item.view.card
import kotlinx.android.synthetic.main.catalogue_grid_item.view.gradient import kotlinx.android.synthetic.main.source_grid_item.view.gradient
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -29,9 +29,9 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference
override fun getLayoutRes(): Int { override fun getLayoutRes(): Int {
return if (libraryAsList.getOrDefault()) return if (libraryAsList.getOrDefault())
R.layout.catalogue_list_item R.layout.source_list_item
else else
R.layout.catalogue_grid_item R.layout.source_grid_item
} }
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): LibraryHolder { override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): LibraryHolder {

View File

@ -6,11 +6,11 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.util.view.visibleIf import eu.kanade.tachiyomi.util.view.visibleIf
import kotlinx.android.synthetic.main.catalogue_list_item.download_text import kotlinx.android.synthetic.main.source_list_item.download_text
import kotlinx.android.synthetic.main.catalogue_list_item.local_text import kotlinx.android.synthetic.main.source_list_item.local_text
import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail import kotlinx.android.synthetic.main.source_list_item.thumbnail
import kotlinx.android.synthetic.main.catalogue_list_item.title import kotlinx.android.synthetic.main.source_list_item.title
import kotlinx.android.synthetic.main.catalogue_list_item.unread_text import kotlinx.android.synthetic.main.source_list_item.unread_text
/** /**
* Class used to hold the displayed data of a manga in the library, like the cover or the title. * Class used to hold the displayed data of a manga in the library, like the cover or the title.

View File

@ -21,8 +21,6 @@ import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController
import eu.kanade.tachiyomi.ui.base.controller.RootController import eu.kanade.tachiyomi.ui.base.controller.RootController
import eu.kanade.tachiyomi.ui.base.controller.TabbedController import eu.kanade.tachiyomi.ui.base.controller.TabbedController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.catalogue.CatalogueController
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchController
import eu.kanade.tachiyomi.ui.download.DownloadController import eu.kanade.tachiyomi.ui.download.DownloadController
import eu.kanade.tachiyomi.ui.extension.ExtensionController import eu.kanade.tachiyomi.ui.extension.ExtensionController
import eu.kanade.tachiyomi.ui.library.LibraryController import eu.kanade.tachiyomi.ui.library.LibraryController
@ -30,6 +28,8 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
import eu.kanade.tachiyomi.ui.more.MoreController import eu.kanade.tachiyomi.ui.more.MoreController
import eu.kanade.tachiyomi.ui.recent.history.HistoryController import eu.kanade.tachiyomi.ui.recent.history.HistoryController
import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController
import eu.kanade.tachiyomi.ui.source.SourceController
import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController
import java.util.Date import java.util.Date
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -83,7 +83,7 @@ class MainActivity : BaseActivity() {
R.id.nav_library -> setRoot(LibraryController(), id) R.id.nav_library -> setRoot(LibraryController(), id)
R.id.nav_updates -> setRoot(UpdatesController(), id) R.id.nav_updates -> setRoot(UpdatesController(), id)
R.id.nav_history -> setRoot(HistoryController(), id) R.id.nav_history -> setRoot(HistoryController(), id)
R.id.nav_sources -> setRoot(CatalogueController(), id) R.id.nav_sources -> setRoot(SourceController(), id)
R.id.nav_more -> setRoot(MoreController(), id) R.id.nav_more -> setRoot(MoreController(), id)
} }
} else if (!isHandlingShortcut) { } else if (!isHandlingShortcut) {
@ -228,7 +228,7 @@ class MainActivity : BaseActivity() {
if (router.backstackSize > 1) { if (router.backstackSize > 1) {
router.popToRoot() router.popToRoot()
} }
router.pushController(CatalogueSearchController(query).withFadeTransaction()) router.pushController(GlobalSearchController(query).withFadeTransaction())
} }
} }
INTENT_SEARCH -> { INTENT_SEARCH -> {
@ -238,7 +238,7 @@ class MainActivity : BaseActivity() {
if (router.backstackSize > 1) { if (router.backstackSize > 1) {
router.popToRoot() router.popToRoot()
} }
router.pushController(CatalogueSearchController(query, filter).withFadeTransaction()) router.pushController(GlobalSearchController(query, filter).withFadeTransaction())
} }
} }
else -> { else -> {

View File

@ -44,12 +44,12 @@ import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.NucleusController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCatalogueController
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchController
import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog
import eu.kanade.tachiyomi.ui.library.LibraryController import eu.kanade.tachiyomi.ui.library.LibraryController
import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.main.MainActivity
import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.manga.MangaController
import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController
import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController
import eu.kanade.tachiyomi.ui.webview.WebViewActivity import eu.kanade.tachiyomi.ui.webview.WebViewActivity
import eu.kanade.tachiyomi.util.lang.truncateCenter import eu.kanade.tachiyomi.util.lang.truncateCenter
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
@ -549,7 +549,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
*/ */
private fun performGlobalSearch(query: String) { private fun performGlobalSearch(query: String) {
val router = parentController?.router ?: return val router = parentController?.router ?: return
router.pushController(CatalogueSearchController(query).withFadeTransaction()) router.pushController(GlobalSearchController(query).withFadeTransaction())
} }
/** /**
@ -570,7 +570,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
router.handleBack() router.handleBack()
previousController.search(query) previousController.search(query)
} }
is BrowseCatalogueController -> { is BrowseSourceController -> {
router.handleBack() router.handleBack()
previousController.searchWithQuery(query) previousController.searchWithQuery(query)
} }

View File

@ -5,8 +5,8 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail import kotlinx.android.synthetic.main.source_list_item.thumbnail
import kotlinx.android.synthetic.main.catalogue_list_item.title import kotlinx.android.synthetic.main.source_list_item.title
class MangaHolder( class MangaHolder(
private val view: View, private val view: View,

View File

@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga
class MangaItem(val manga: Manga) : AbstractFlexibleItem<MangaHolder>() { class MangaItem(val manga: Manga) : AbstractFlexibleItem<MangaHolder>() {
override fun getLayoutRes(): Int { override fun getLayoutRes(): Int {
return R.layout.catalogue_list_item return R.layout.source_list_item
} }
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): MangaHolder { override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): MangaHolder {

View File

@ -9,17 +9,17 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.ui.base.controller.popControllerWithTag import eu.kanade.tachiyomi.ui.base.controller.popControllerWithTag
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchController import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchPresenter import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchPresenter
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
class SearchController( class SearchController(
private var manga: Manga? = null private var manga: Manga? = null
) : CatalogueSearchController(manga?.title) { ) : GlobalSearchController(manga?.title) {
private var newManga: Manga? = null private var newManga: Manga? = null
override fun createPresenter(): CatalogueSearchPresenter { override fun createPresenter(): GlobalSearchPresenter {
return SearchPresenter(initialQuery, manga!!) return SearchPresenter(initialQuery, manga!!)
} }

View File

@ -9,9 +9,9 @@ import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchCardItem import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchCardItem
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchItem import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchItem
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchPresenter import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchPresenter
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
import rx.Observable import rx.Observable
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
@ -20,7 +20,7 @@ import rx.schedulers.Schedulers
class SearchPresenter( class SearchPresenter(
initialQuery: String? = "", initialQuery: String? = "",
private val manga: Manga private val manga: Manga
) : CatalogueSearchPresenter(initialQuery) { ) : GlobalSearchPresenter(initialQuery) {
private val replacingMangaRelay = BehaviorRelay.create<Boolean>() private val replacingMangaRelay = BehaviorRelay.create<Boolean>()
@ -36,9 +36,9 @@ class SearchPresenter(
.sortedByDescending { it.id == manga.source } .sortedByDescending { it.id == manga.source }
} }
override fun createCatalogueSearchItem(source: CatalogueSource, results: List<CatalogueSearchCardItem>?): CatalogueSearchItem { override fun createCatalogueSearchItem(source: CatalogueSource, results: List<GlobalSearchCardItem>?): GlobalSearchItem {
// Set the catalogue search item as highlighted if the source matches that of the selected manga // Set the catalogue search item as highlighted if the source matches that of the selected manga
return CatalogueSearchItem(source, results, source.id == manga.source) return GlobalSearchItem(source, results, source.id == manga.source)
} }
override fun networkToLocalManga(sManga: SManga, sourceId: Long): Manga { override fun networkToLocalManga(sManga: SManga, sourceId: Long): Manga {

View File

@ -7,7 +7,7 @@ import eu.davidea.flexibleadapter.items.AbstractHeaderItem
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import kotlinx.android.synthetic.main.catalogue_main_controller_card.title import kotlinx.android.synthetic.main.source_main_controller_card.title
/** /**
* Item that contains the selection header. * Item that contains the selection header.
@ -18,7 +18,7 @@ class SelectionHeader : AbstractHeaderItem<SelectionHeader.Holder>() {
* Returns the layout resource of this item. * Returns the layout resource of this item.
*/ */
override fun getLayoutRes(): Int { override fun getLayoutRes(): Int {
return R.layout.catalogue_main_controller_card return R.layout.source_main_controller_card
} }
/** /**

View File

@ -8,11 +8,11 @@ import eu.kanade.tachiyomi.ui.base.holder.SlicedHolder
import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.roundTextIcon import eu.kanade.tachiyomi.util.view.roundTextIcon
import io.github.mthli.slice.Slice import io.github.mthli.slice.Slice
import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.card import kotlinx.android.synthetic.main.source_main_controller_card_item.card
import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.image import kotlinx.android.synthetic.main.source_main_controller_card_item.image
import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.source_browse import kotlinx.android.synthetic.main.source_main_controller_card_item.source_browse
import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.source_latest import kotlinx.android.synthetic.main.source_main_controller_card_item.source_latest
import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.title import kotlinx.android.synthetic.main.source_main_controller_card_item.title
class SourceHolder(view: View, override val adapter: SourceAdapter) : class SourceHolder(view: View, override val adapter: SourceAdapter) :
BaseFlexibleViewHolder(view, adapter), BaseFlexibleViewHolder(view, adapter),

View File

@ -21,7 +21,7 @@ data class SourceItem(val source: Source, val header: SelectionHeader? = null) :
* Returns the layout resource of this item. * Returns the layout resource of this item.
*/ */
override fun getLayoutRes(): Int { override fun getLayoutRes(): Int {
return R.layout.catalogue_main_controller_card_item return R.layout.source_main_controller_card_item
} }
/** /**

View File

@ -1,10 +1,10 @@
package eu.kanade.tachiyomi.ui.catalogue package eu.kanade.tachiyomi.ui.source
import android.view.View import android.view.View
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
import kotlinx.android.synthetic.main.catalogue_main_controller_card.title import kotlinx.android.synthetic.main.source_main_controller_card.title
class LangHolder(view: View, adapter: FlexibleAdapter<*>) : class LangHolder(view: View, adapter: FlexibleAdapter<*>) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue package eu.kanade.tachiyomi.ui.source
import android.view.View import android.view.View
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -18,7 +18,7 @@ data class LangItem(val code: String) : AbstractHeaderItem<LangHolder>() {
* Returns the layout resource of this item. * Returns the layout resource of this item.
*/ */
override fun getLayoutRes(): Int { override fun getLayoutRes(): Int {
return R.layout.catalogue_main_controller_card return R.layout.source_main_controller_card
} }
/** /**

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue package eu.kanade.tachiyomi.ui.source
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
@ -8,9 +8,9 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
/** /**
* Adapter that holds the catalogue cards. * Adapter that holds the catalogue cards.
* *
* @param controller instance of [CatalogueController]. * @param controller instance of [SourceController].
*/ */
class CatalogueAdapter(val controller: CatalogueController) : class SourceAdapter(val controller: SourceController) :
FlexibleAdapter<IFlexible<*>>(null, controller, true) { FlexibleAdapter<IFlexible<*>>(null, controller, true) {
val cardBackground = controller.activity!!.getResourceColor(R.attr.colorSurface) val cardBackground = controller.activity!!.getResourceColor(R.attr.colorSurface)
@ -31,7 +31,7 @@ class CatalogueAdapter(val controller: CatalogueController) :
/** /**
* Listener which should be called when user clicks browse. * Listener which should be called when user clicks browse.
* Note: Should only be handled by [CatalogueController] * Note: Should only be handled by [SourceController]
*/ */
interface OnBrowseClickListener { interface OnBrowseClickListener {
fun onBrowseClick(position: Int) fun onBrowseClick(position: Int)
@ -39,7 +39,7 @@ class CatalogueAdapter(val controller: CatalogueController) :
/** /**
* Listener which should be called when user clicks latest. * Listener which should be called when user clicks latest.
* Note: Should only be handled by [CatalogueController] * Note: Should only be handled by [SourceController]
*/ */
interface OnLatestClickListener { interface OnLatestClickListener {
fun onLatestClick(position: Int) fun onLatestClick(position: Int)

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue package eu.kanade.tachiyomi.ui.source
import android.Manifest.permission.WRITE_EXTERNAL_STORAGE import android.Manifest.permission.WRITE_EXTERNAL_STORAGE
import android.view.LayoutInflater import android.view.LayoutInflater
@ -20,41 +20,41 @@ import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.databinding.CatalogueMainControllerBinding import eu.kanade.tachiyomi.databinding.SourceMainControllerBinding
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.NucleusController
import eu.kanade.tachiyomi.ui.base.controller.RootController import eu.kanade.tachiyomi.ui.base.controller.RootController
import eu.kanade.tachiyomi.ui.base.controller.requestPermissionsSafe import eu.kanade.tachiyomi.ui.base.controller.requestPermissionsSafe
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCatalogueController
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchController
import eu.kanade.tachiyomi.ui.catalogue.latest.LatestUpdatesController
import eu.kanade.tachiyomi.ui.setting.SettingsSourcesController import eu.kanade.tachiyomi.ui.setting.SettingsSourcesController
import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController
import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController
import eu.kanade.tachiyomi.ui.source.latest.LatestUpdatesController
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
/** /**
* This controller shows and manages the different catalogues enabled by the user. * This controller shows and manages the different catalogues enabled by the user.
* This controller should only handle UI actions, IO actions should be done by [CataloguePresenter] * This controller should only handle UI actions, IO actions should be done by [SourcePresenter]
* [CatalogueAdapter.OnBrowseClickListener] call function data on browse item click. * [SourceAdapter.OnBrowseClickListener] call function data on browse item click.
* [CatalogueAdapter.OnLatestClickListener] call function data on latest item click * [SourceAdapter.OnLatestClickListener] call function data on latest item click
*/ */
class CatalogueController : NucleusController<CataloguePresenter>(), class SourceController : NucleusController<SourcePresenter>(),
RootController, RootController,
FlexibleAdapter.OnItemClickListener, FlexibleAdapter.OnItemClickListener,
FlexibleAdapter.OnItemLongClickListener, FlexibleAdapter.OnItemLongClickListener,
CatalogueAdapter.OnBrowseClickListener, SourceAdapter.OnBrowseClickListener,
CatalogueAdapter.OnLatestClickListener { SourceAdapter.OnLatestClickListener {
private val preferences: PreferencesHelper = Injekt.get() private val preferences: PreferencesHelper = Injekt.get()
/** /**
* Adapter containing sources. * Adapter containing sources.
*/ */
private var adapter: CatalogueAdapter? = null private var adapter: SourceAdapter? = null
private lateinit var binding: CatalogueMainControllerBinding private lateinit var binding: SourceMainControllerBinding
init { init {
setHasOptionsMenu(true) setHasOptionsMenu(true)
@ -64,26 +64,26 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
return applicationContext?.getString(R.string.label_sources) return applicationContext?.getString(R.string.label_sources)
} }
override fun createPresenter(): CataloguePresenter { override fun createPresenter(): SourcePresenter {
return CataloguePresenter() return SourcePresenter()
} }
/** /**
* Initiate the view with [R.layout.catalogue_main_controller]. * Initiate the view with [R.layout.source_main_controller].
* *
* @param inflater used to load the layout xml. * @param inflater used to load the layout xml.
* @param container containing parent views. * @param container containing parent views.
* @return inflated view. * @return inflated view.
*/ */
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
binding = CatalogueMainControllerBinding.inflate(inflater) binding = SourceMainControllerBinding.inflate(inflater)
return binding.root return binding.root
} }
override fun onViewCreated(view: View) { override fun onViewCreated(view: View) {
super.onViewCreated(view) super.onViewCreated(view)
adapter = CatalogueAdapter(this) adapter = SourceAdapter(this)
// Create recycler and set adapter. // Create recycler and set adapter.
binding.recycler.layoutManager = LinearLayoutManager(view.context) binding.recycler.layoutManager = LinearLayoutManager(view.context)
@ -109,7 +109,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
override fun onItemClick(view: View, position: Int): Boolean { override fun onItemClick(view: View, position: Int): Boolean {
val item = adapter?.getItem(position) as? SourceItem ?: return false val item = adapter?.getItem(position) as? SourceItem ?: return false
val source = item.source val source = item.source
openCatalogue(source, BrowseCatalogueController(source)) openCatalogue(source, BrowseSourceController(source))
return false return false
} }
@ -117,7 +117,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
val activity = activity ?: return val activity = activity ?: return
val item = adapter?.getItem(position) as? SourceItem ?: return val item = adapter?.getItem(position) as? SourceItem ?: return
val isPinned = item.header?.code?.equals(CataloguePresenter.PINNED_KEY) ?: false val isPinned = item.header?.code?.equals(SourcePresenter.PINNED_KEY) ?: false
MaterialDialog.Builder(activity) MaterialDialog.Builder(activity)
.title(item.source.name) .title(item.source.name)
@ -152,14 +152,14 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
} }
/** /**
* Called when browse is clicked in [CatalogueAdapter] * Called when browse is clicked in [SourceAdapter]
*/ */
override fun onBrowseClick(position: Int) { override fun onBrowseClick(position: Int) {
onItemClick(view!!, position) onItemClick(view!!, position)
} }
/** /**
* Called when latest is clicked in [CatalogueAdapter] * Called when latest is clicked in [SourceAdapter]
*/ */
override fun onLatestClick(position: Int) { override fun onLatestClick(position: Int) {
val item = adapter?.getItem(position) as? SourceItem ?: return val item = adapter?.getItem(position) as? SourceItem ?: return
@ -169,7 +169,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
/** /**
* Opens a catalogue with the given controller. * Opens a catalogue with the given controller.
*/ */
private fun openCatalogue(source: CatalogueSource, controller: BrowseCatalogueController) { private fun openCatalogue(source: CatalogueSource, controller: BrowseSourceController) {
preferences.lastUsedCatalogueSource().set(source.id) preferences.lastUsedCatalogueSource().set(source.id)
router.pushController(controller.withFadeTransaction()) router.pushController(controller.withFadeTransaction())
} }
@ -182,7 +182,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
*/ */
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
// Inflate menu // Inflate menu
inflater.inflate(R.menu.catalogue_main, menu) inflater.inflate(R.menu.source_main, menu)
// Initialize search option. // Initialize search option.
val searchItem = menu.findItem(R.id.action_search) val searchItem = menu.findItem(R.id.action_search)
@ -198,7 +198,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
} }
fun performGlobalSearch(query: String) { fun performGlobalSearch(query: String) {
router.pushController(CatalogueSearchController(query).withFadeTransaction()) router.pushController(GlobalSearchController(query).withFadeTransaction())
} }
/** /**

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue package eu.kanade.tachiyomi.ui.source
import android.content.Context import android.content.Context
import android.graphics.Canvas import android.graphics.Canvas

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue package eu.kanade.tachiyomi.ui.source
import android.view.View import android.view.View
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -9,13 +9,13 @@ import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.roundTextIcon import eu.kanade.tachiyomi.util.view.roundTextIcon
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
import io.github.mthli.slice.Slice import io.github.mthli.slice.Slice
import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.card import kotlinx.android.synthetic.main.source_main_controller_card_item.card
import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.image import kotlinx.android.synthetic.main.source_main_controller_card_item.image
import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.source_browse import kotlinx.android.synthetic.main.source_main_controller_card_item.source_browse
import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.source_latest import kotlinx.android.synthetic.main.source_main_controller_card_item.source_latest
import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.title import kotlinx.android.synthetic.main.source_main_controller_card_item.title
class SourceHolder(view: View, override val adapter: CatalogueAdapter) : class SourceHolder(view: View, override val adapter: SourceAdapter) :
BaseFlexibleViewHolder(view, adapter), BaseFlexibleViewHolder(view, adapter),
SlicedHolder { SlicedHolder {

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue package eu.kanade.tachiyomi.ui.source
import android.view.View import android.view.View
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -21,14 +21,14 @@ data class SourceItem(val source: CatalogueSource, val header: LangItem? = null)
* Returns the layout resource of this item. * Returns the layout resource of this item.
*/ */
override fun getLayoutRes(): Int { override fun getLayoutRes(): Int {
return R.layout.catalogue_main_controller_card_item return R.layout.source_main_controller_card_item
} }
/** /**
* Creates a new view holder for this item. * Creates a new view holder for this item.
*/ */
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): SourceHolder { override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): SourceHolder {
return SourceHolder(view, adapter as CatalogueAdapter) return SourceHolder(view, adapter as SourceAdapter)
} }
/** /**

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue package eu.kanade.tachiyomi.ui.source
import android.os.Bundle import android.os.Bundle
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
@ -16,16 +16,16 @@ import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
/** /**
* Presenter of [CatalogueController] * Presenter of [SourceController]
* Function calls should be done from here. UI calls should be done from the controller. * Function calls should be done from here. UI calls should be done from the controller.
* *
* @param sourceManager manages the different sources. * @param sourceManager manages the different sources.
* @param preferences application preferences. * @param preferences application preferences.
*/ */
class CataloguePresenter( class SourcePresenter(
val sourceManager: SourceManager = Injekt.get(), val sourceManager: SourceManager = Injekt.get(),
private val preferences: PreferencesHelper = Injekt.get() private val preferences: PreferencesHelper = Injekt.get()
) : BasePresenter<CatalogueController>() { ) : BasePresenter<SourceController>() {
var sources = getEnabledSources() var sources = getEnabledSources()
@ -76,7 +76,7 @@ class CataloguePresenter(
} }
sourceSubscription = Observable.just(sourceItems) sourceSubscription = Observable.just(sourceItems)
.subscribeLatestCache(CatalogueController::setSources) .subscribeLatestCache(SourceController::setSources)
} }
private fun loadLastUsedSource() { private fun loadLastUsedSource() {
@ -88,7 +88,7 @@ class CataloguePresenter(
sharedObs.skip(1).delay(500, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())) sharedObs.skip(1).delay(500, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread()))
.distinctUntilChanged() .distinctUntilChanged()
.map { (sourceManager.get(it) as? CatalogueSource)?.let { SourceItem(it) } } .map { (sourceManager.get(it) as? CatalogueSource)?.let { SourceItem(it) } }
.subscribeLatestCache(CatalogueController::setLastUsedSource) .subscribeLatestCache(SourceController::setLastUsedSource)
} }
fun updateSources() { fun updateSources() {

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.browse package eu.kanade.tachiyomi.ui.source.browse
import android.content.res.Configuration import android.content.res.Configuration
import android.os.Bundle import android.os.Bundle
@ -23,7 +23,7 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.data.database.models.Category
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.databinding.CatalogueControllerBinding import eu.kanade.tachiyomi.databinding.SourceControllerBinding
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
@ -51,8 +51,8 @@ import uy.kohesive.injekt.injectLazy
/** /**
* Controller to manage the catalogues available in the app. * Controller to manage the catalogues available in the app.
*/ */
open class BrowseCatalogueController(bundle: Bundle) : open class BrowseSourceController(bundle: Bundle) :
NucleusController<BrowseCataloguePresenter>(bundle), NucleusController<BrowseSourcePresenter>(bundle),
FlexibleAdapter.OnItemClickListener, FlexibleAdapter.OnItemClickListener,
FlexibleAdapter.OnItemLongClickListener, FlexibleAdapter.OnItemLongClickListener,
FlexibleAdapter.EndlessScrollListener, FlexibleAdapter.EndlessScrollListener,
@ -77,7 +77,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
/** /**
* Sheet containing filter items. * Sheet containing filter items.
*/ */
private var filterSheet: CatalogueFilterSheet? = null private var filterSheet: SourceFilterSheet? = null
/** /**
* Recycler view with the list of results. * Recycler view with the list of results.
@ -99,7 +99,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
*/ */
private var progressItem: ProgressItem? = null private var progressItem: ProgressItem? = null
private lateinit var binding: CatalogueControllerBinding private lateinit var binding: SourceControllerBinding
init { init {
setHasOptionsMenu(true) setHasOptionsMenu(true)
@ -109,12 +109,12 @@ open class BrowseCatalogueController(bundle: Bundle) :
return presenter.source.name return presenter.source.name
} }
override fun createPresenter(): BrowseCataloguePresenter { override fun createPresenter(): BrowseSourcePresenter {
return BrowseCataloguePresenter(args.getLong(SOURCE_ID_KEY)) return BrowseSourcePresenter(args.getLong(SOURCE_ID_KEY))
} }
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
binding = CatalogueControllerBinding.inflate(inflater) binding = SourceControllerBinding.inflate(inflater)
return binding.root return binding.root
} }
@ -136,7 +136,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
return return
} }
filterSheet = CatalogueFilterSheet( filterSheet = SourceFilterSheet(
activity!!, activity!!,
onSearchClicked = { onSearchClicked = {
val allDefault = presenter.sourceFilters == presenter.source.getFilterList() val allDefault = presenter.sourceFilters == presenter.source.getFilterList()
@ -188,17 +188,17 @@ open class BrowseCatalogueController(bundle: Bundle) :
addItemDecoration(DividerItemDecoration(context, DividerItemDecoration.VERTICAL)) addItemDecoration(DividerItemDecoration(context, DividerItemDecoration.VERTICAL))
} }
} else { } else {
(binding.catalogueView.inflate(R.layout.catalogue_recycler_autofit) as AutofitRecyclerView).apply { (binding.catalogueView.inflate(R.layout.source_recycler_autofit) as AutofitRecyclerView).apply {
numColumnsSubscription = getColumnsPreferenceForCurrentOrientation().asObservable() numColumnsSubscription = getColumnsPreferenceForCurrentOrientation().asObservable()
.doOnNext { spanCount = it } .doOnNext { spanCount = it }
.skip(1) .skip(1)
// Set again the adapter to recalculate the covers height // Set again the adapter to recalculate the covers height
.subscribe { adapter = this@BrowseCatalogueController.adapter } .subscribe { adapter = this@BrowseSourceController.adapter }
(layoutManager as GridLayoutManager).spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { (layoutManager as GridLayoutManager).spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int { override fun getSpanSize(position: Int): Int {
return when (adapter?.getItemViewType(position)) { return when (adapter?.getItemViewType(position)) {
R.layout.catalogue_grid_item, null -> 1 R.layout.source_grid_item, null -> 1
else -> spanCount else -> spanCount
} }
} }
@ -231,7 +231,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
} }
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.catalogue_list, menu) inflater.inflate(R.menu.source_browse, menu)
// Initialize search menu // Initialize search menu
val searchItem = menu.findItem(R.id.action_search) val searchItem = menu.findItem(R.id.action_search)
@ -246,7 +246,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
val searchEventsObservable = searchView.queryTextChangeEvents() val searchEventsObservable = searchView.queryTextChangeEvents()
.skip(1) .skip(1)
.filter { router.backstack.lastOrNull()?.controller() == this@BrowseCatalogueController } .filter { router.backstack.lastOrNull()?.controller() == this@BrowseSourceController }
.share() .share()
val writingObservable = searchEventsObservable val writingObservable = searchEventsObservable
.filter { !it.isSubmitted } .filter { !it.isSubmitted }
@ -323,7 +323,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
* @param page the current page. * @param page the current page.
* @param mangas the list of manga of the page. * @param mangas the list of manga of the page.
*/ */
fun onAddPage(page: Int, mangas: List<CatalogueItem>) { fun onAddPage(page: Int, mangas: List<SourceItem>) {
val adapter = adapter ?: return val adapter = adapter ?: return
hideProgressBar() hideProgressBar()
if (page == 1) { if (page == 1) {
@ -434,7 +434,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
if (!isListMode || !view.context.connectivityManager.isActiveNetworkMetered) { if (!isListMode || !view.context.connectivityManager.isActiveNetworkMetered) {
// Initialize mangas if going to grid view or if over wifi when going to list view // Initialize mangas if going to grid view or if over wifi when going to list view
val mangas = (0 until adapter.itemCount).mapNotNull { val mangas = (0 until adapter.itemCount).mapNotNull {
(adapter.getItem(it) as? CatalogueItem)?.manga (adapter.getItem(it) as? SourceItem)?.manga
} }
presenter.initializeMangas(mangas) presenter.initializeMangas(mangas)
} }
@ -458,13 +458,13 @@ open class BrowseCatalogueController(bundle: Bundle) :
* @param manga the manga to find. * @param manga the manga to find.
* @return the holder of the manga or null if it's not bound. * @return the holder of the manga or null if it's not bound.
*/ */
private fun getHolder(manga: Manga): CatalogueHolder? { private fun getHolder(manga: Manga): SourceHolder? {
val adapter = adapter ?: return null val adapter = adapter ?: return null
adapter.allBoundViewHolders.forEach { holder -> adapter.allBoundViewHolders.forEach { holder ->
val item = adapter.getItem(holder.adapterPosition) as? CatalogueItem val item = adapter.getItem(holder.adapterPosition) as? SourceItem
if (item != null && item.manga.id!! == manga.id!!) { if (item != null && item.manga.id!! == manga.id!!) {
return holder as CatalogueHolder return holder as SourceHolder
} }
} }
@ -495,7 +495,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
* @return true if the item should be selected, false otherwise. * @return true if the item should be selected, false otherwise.
*/ */
override fun onItemClick(view: View, position: Int): Boolean { override fun onItemClick(view: View, position: Int): Boolean {
val item = adapter?.getItem(position) as? CatalogueItem ?: return false val item = adapter?.getItem(position) as? SourceItem ?: return false
router.pushController(MangaController(item.manga, true).withFadeTransaction()) router.pushController(MangaController(item.manga, true).withFadeTransaction())
return false return false
@ -512,7 +512,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
*/ */
override fun onItemLongClick(position: Int) { override fun onItemLongClick(position: Int) {
val activity = activity ?: return val activity = activity ?: return
val manga = (adapter?.getItem(position) as? CatalogueItem?)?.manga ?: return val manga = (adapter?.getItem(position) as? SourceItem?)?.manga ?: return
if (manga.favorite) { if (manga.favorite) {
MaterialDialog.Builder(activity) MaterialDialog.Builder(activity)
@ -576,7 +576,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
presenter.changeMangaFavorite(manga) presenter.changeMangaFavorite(manga)
presenter.updateMangaCategories(manga, categories) presenter.updateMangaCategories(manga, categories)
val position = adapter?.currentItems?.indexOfFirst { it -> (it as CatalogueItem).manga.id == manga.id } val position = adapter?.currentItems?.indexOfFirst { it -> (it as SourceItem).manga.id == manga.id }
if (position != null) { if (position != null) {
adapter?.notifyItemChanged(position) adapter?.notifyItemChanged(position)
} }

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.browse package eu.kanade.tachiyomi.ui.source.browse
import android.os.Bundle import android.os.Bundle
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
@ -15,19 +15,19 @@ import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
import eu.kanade.tachiyomi.ui.catalogue.filter.CheckboxItem import eu.kanade.tachiyomi.ui.source.filter.CheckboxItem
import eu.kanade.tachiyomi.ui.catalogue.filter.CheckboxSectionItem import eu.kanade.tachiyomi.ui.source.filter.CheckboxSectionItem
import eu.kanade.tachiyomi.ui.catalogue.filter.GroupItem import eu.kanade.tachiyomi.ui.source.filter.GroupItem
import eu.kanade.tachiyomi.ui.catalogue.filter.HeaderItem import eu.kanade.tachiyomi.ui.source.filter.HeaderItem
import eu.kanade.tachiyomi.ui.catalogue.filter.SelectItem import eu.kanade.tachiyomi.ui.source.filter.SelectItem
import eu.kanade.tachiyomi.ui.catalogue.filter.SelectSectionItem import eu.kanade.tachiyomi.ui.source.filter.SelectSectionItem
import eu.kanade.tachiyomi.ui.catalogue.filter.SeparatorItem import eu.kanade.tachiyomi.ui.source.filter.SeparatorItem
import eu.kanade.tachiyomi.ui.catalogue.filter.SortGroup import eu.kanade.tachiyomi.ui.source.filter.SortGroup
import eu.kanade.tachiyomi.ui.catalogue.filter.SortItem import eu.kanade.tachiyomi.ui.source.filter.SortItem
import eu.kanade.tachiyomi.ui.catalogue.filter.TextItem import eu.kanade.tachiyomi.ui.source.filter.TextItem
import eu.kanade.tachiyomi.ui.catalogue.filter.TextSectionItem import eu.kanade.tachiyomi.ui.source.filter.TextSectionItem
import eu.kanade.tachiyomi.ui.catalogue.filter.TriStateItem import eu.kanade.tachiyomi.ui.source.filter.TriStateItem
import eu.kanade.tachiyomi.ui.catalogue.filter.TriStateSectionItem import eu.kanade.tachiyomi.ui.source.filter.TriStateSectionItem
import rx.Observable import rx.Observable
import rx.Subscription import rx.Subscription
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
@ -38,15 +38,15 @@ import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
/** /**
* Presenter of [BrowseCatalogueController]. * Presenter of [BrowseSourceController].
*/ */
open class BrowseCataloguePresenter( open class BrowseSourcePresenter(
sourceId: Long, sourceId: Long,
sourceManager: SourceManager = Injekt.get(), sourceManager: SourceManager = Injekt.get(),
private val db: DatabaseHelper = Injekt.get(), private val db: DatabaseHelper = Injekt.get(),
private val prefs: PreferencesHelper = Injekt.get(), private val prefs: PreferencesHelper = Injekt.get(),
private val coverCache: CoverCache = Injekt.get() private val coverCache: CoverCache = Injekt.get()
) : BasePresenter<BrowseCatalogueController>() { ) : BasePresenter<BrowseSourceController>() {
/** /**
* Selected source. * Selected source.
@ -151,7 +151,7 @@ open class BrowseCataloguePresenter(
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())
.map { it.first to it.second.map { networkToLocalManga(it, sourceId) } } .map { it.first to it.second.map { networkToLocalManga(it, sourceId) } }
.doOnNext { initializeMangas(it.second) } .doOnNext { initializeMangas(it.second) }
.map { it.first to it.second.map { CatalogueItem(it, catalogueAsList) } } .map { it.first to it.second.map { SourceItem(it, catalogueAsList) } }
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribeReplay({ view, (page, mangas) -> .subscribeReplay({ view, (page, mangas) ->
view.onAddPage(page, mangas) view.onAddPage(page, mangas)
@ -173,7 +173,7 @@ open class BrowseCataloguePresenter(
pageSubscription = Observable.defer { pager.requestNext() } pageSubscription = Observable.defer { pager.requestNext() }
.subscribeFirst({ _, _ -> .subscribeFirst({ _, _ ->
// Nothing to do when onNext is emitted. // Nothing to do when onNext is emitted.
}, BrowseCatalogueController::onAddPageError) }, BrowseSourceController::onAddPageError)
} }
/** /**
@ -288,7 +288,7 @@ open class BrowseCataloguePresenter(
} }
open fun createPager(query: String, filters: FilterList): Pager { open fun createPager(query: String, filters: FilterList): Pager {
return CataloguePager(source, query, filters) return SourcePager(source, query, filters)
} }
private fun FilterList.toItems(): List<IFlexible<*>> { private fun FilterList.toItems(): List<IFlexible<*>> {

View File

@ -0,0 +1,3 @@
package eu.kanade.tachiyomi.ui.source.browse
class NoResultsException : Exception()

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.browse package eu.kanade.tachiyomi.ui.source.browse
import com.jakewharton.rxrelay.PublishRelay import com.jakewharton.rxrelay.PublishRelay
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.MangasPage

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.browse package eu.kanade.tachiyomi.ui.source.browse
import android.view.View import android.view.View
import android.widget.ProgressBar import android.widget.ProgressBar
@ -17,7 +17,7 @@ class ProgressItem : AbstractFlexibleItem<ProgressItem.Holder>() {
private var loadMore = true private var loadMore = true
override fun getLayoutRes(): Int { override fun getLayoutRes(): Int {
return R.layout.catalogue_progress_item return R.layout.source_progress_item
} }
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): Holder { override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): Holder {

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.browse package eu.kanade.tachiyomi.ui.source.browse
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
@ -10,10 +10,10 @@ import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.view.inflate import eu.kanade.tachiyomi.util.view.inflate
import eu.kanade.tachiyomi.widget.SimpleNavigationView import eu.kanade.tachiyomi.widget.SimpleNavigationView
import kotlinx.android.synthetic.main.catalogue_drawer_content.view.reset_btn import kotlinx.android.synthetic.main.source_filter_sheet.view.reset_btn
import kotlinx.android.synthetic.main.catalogue_drawer_content.view.search_btn import kotlinx.android.synthetic.main.source_filter_sheet.view.search_btn
class CatalogueFilterSheet( class SourceFilterSheet(
activity: Activity, activity: Activity,
onSearchClicked: () -> Unit, onSearchClicked: () -> Unit,
onResetClicked: () -> Unit onResetClicked: () -> Unit
@ -49,7 +49,7 @@ class CatalogueFilterSheet(
init { init {
recycler.adapter = adapter recycler.adapter = adapter
recycler.setHasFixedSize(true) recycler.setHasFixedSize(true)
val view = inflate(R.layout.catalogue_drawer_content) val view = inflate(R.layout.source_filter_sheet)
((view as ViewGroup).getChildAt(1) as ViewGroup).addView(recycler) ((view as ViewGroup).getChildAt(1) as ViewGroup).addView(recycler)
addView(view) addView(view)
search_btn.setOnClickListener { onSearchClicked() } search_btn.setOnClickListener { onSearchClicked() }

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.browse package eu.kanade.tachiyomi.ui.source.browse
import android.view.View import android.view.View
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
@ -6,20 +6,20 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.widget.StateImageViewTarget import eu.kanade.tachiyomi.widget.StateImageViewTarget
import kotlinx.android.synthetic.main.catalogue_grid_item.progress import kotlinx.android.synthetic.main.source_grid_item.progress
import kotlinx.android.synthetic.main.catalogue_grid_item.thumbnail import kotlinx.android.synthetic.main.source_grid_item.thumbnail
import kotlinx.android.synthetic.main.catalogue_grid_item.title import kotlinx.android.synthetic.main.source_grid_item.title
/** /**
* Class used to hold the displayed data of a manga in the catalogue, like the cover or the title. * Class used to hold the displayed data of a manga in the catalogue, like the cover or the title.
* All the elements from the layout file "item_catalogue_grid" are available in this class. * All the elements from the layout file "item_source_grid" are available in this class.
* *
* @param view the inflated view for this holder. * @param view the inflated view for this holder.
* @param adapter the adapter handling this holder. * @param adapter the adapter handling this holder.
* @constructor creates a new catalogue holder. * @constructor creates a new catalogue holder.
*/ */
class CatalogueGridHolder(private val view: View, private val adapter: FlexibleAdapter<*>) : class SourceGridHolder(private val view: View, private val adapter: FlexibleAdapter<*>) :
CatalogueHolder(view, adapter) { SourceHolder(view, adapter) {
/** /**
* Method called from [CatalogueAdapter.onBindViewHolder]. It updates the data for this * Method called from [CatalogueAdapter.onBindViewHolder]. It updates the data for this

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.browse package eu.kanade.tachiyomi.ui.source.browse
import android.view.View import android.view.View
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
* @param view the inflated view for this holder. * @param view the inflated view for this holder.
* @param adapter the adapter handling this holder. * @param adapter the adapter handling this holder.
*/ */
abstract class CatalogueHolder(view: View, adapter: FlexibleAdapter<*>) : abstract class SourceHolder(view: View, adapter: FlexibleAdapter<*>) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
/** /**

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.browse package eu.kanade.tachiyomi.ui.source.browse
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
@ -13,23 +13,23 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.widget.AutofitRecyclerView import eu.kanade.tachiyomi.widget.AutofitRecyclerView
import kotlinx.android.synthetic.main.catalogue_grid_item.view.card import kotlinx.android.synthetic.main.source_grid_item.view.card
import kotlinx.android.synthetic.main.catalogue_grid_item.view.gradient import kotlinx.android.synthetic.main.source_grid_item.view.gradient
class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Boolean>) : class SourceItem(val manga: Manga, private val catalogueAsList: Preference<Boolean>) :
AbstractFlexibleItem<CatalogueHolder>() { AbstractFlexibleItem<SourceHolder>() {
override fun getLayoutRes(): Int { override fun getLayoutRes(): Int {
return if (catalogueAsList.getOrDefault()) return if (catalogueAsList.getOrDefault())
R.layout.catalogue_list_item R.layout.source_list_item
else else
R.layout.catalogue_grid_item R.layout.source_grid_item
} }
override fun createViewHolder( override fun createViewHolder(
view: View, view: View,
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>> adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
): CatalogueHolder { ): SourceHolder {
val parent = adapter.recyclerView val parent = adapter.recyclerView
return if (parent is AutofitRecyclerView) { return if (parent is AutofitRecyclerView) {
view.apply { view.apply {
@ -38,15 +38,15 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Bo
gradient.layoutParams = FrameLayout.LayoutParams( gradient.layoutParams = FrameLayout.LayoutParams(
MATCH_PARENT, parent.itemWidth / 3 * 4 / 2, Gravity.BOTTOM) MATCH_PARENT, parent.itemWidth / 3 * 4 / 2, Gravity.BOTTOM)
} }
CatalogueGridHolder(view, adapter) SourceGridHolder(view, adapter)
} else { } else {
CatalogueListHolder(view, adapter) SourceListHolder(view, adapter)
} }
} }
override fun bindViewHolder( override fun bindViewHolder(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: CatalogueHolder, holder: SourceHolder,
position: Int, position: Int,
payloads: List<Any?>? payloads: List<Any?>?
) { ) {
@ -55,7 +55,7 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Bo
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true
if (other is CatalogueItem) { if (other is SourceItem) {
return manga.id!! == other.manga.id!! return manga.id!! == other.manga.id!!
} }
return false return false

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.browse package eu.kanade.tachiyomi.ui.source.browse
import android.view.View import android.view.View
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
@ -6,8 +6,8 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail import kotlinx.android.synthetic.main.source_list_item.thumbnail
import kotlinx.android.synthetic.main.catalogue_list_item.title import kotlinx.android.synthetic.main.source_list_item.title
/** /**
* Class used to hold the displayed data of a manga in the catalogue, like the cover or the title. * Class used to hold the displayed data of a manga in the catalogue, like the cover or the title.
@ -17,8 +17,8 @@ import kotlinx.android.synthetic.main.catalogue_list_item.title
* @param adapter the adapter handling this holder. * @param adapter the adapter handling this holder.
* @constructor creates a new catalogue holder. * @constructor creates a new catalogue holder.
*/ */
class CatalogueListHolder(private val view: View, adapter: FlexibleAdapter<*>) : class SourceListHolder(private val view: View, adapter: FlexibleAdapter<*>) :
CatalogueHolder(view, adapter) { SourceHolder(view, adapter) {
private val favoriteColor = view.context.getResourceColor(android.R.attr.textColorHint) private val favoriteColor = view.context.getResourceColor(android.R.attr.textColorHint)
private val unfavoriteColor = view.context.getResourceColor(android.R.attr.textColorPrimary) private val unfavoriteColor = view.context.getResourceColor(android.R.attr.textColorPrimary)

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.browse package eu.kanade.tachiyomi.ui.source.browse
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
@ -7,7 +7,7 @@ import rx.Observable
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers import rx.schedulers.Schedulers
open class CataloguePager(val source: CatalogueSource, val query: String, val filters: FilterList) : Pager() { open class SourcePager(val source: CatalogueSource, val query: String, val filters: FilterList) : Pager() {
override fun requestNext(): Observable<MangasPage> { override fun requestNext(): Observable<MangasPage> {
val page = currentPage val page = currentPage

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.source.filter
import android.view.View import android.view.View
import android.widget.CheckBox import android.widget.CheckBox

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.source.filter
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.source.filter
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.view.View import android.view.View

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.source.filter
import eu.davidea.flexibleadapter.items.ISectionable import eu.davidea.flexibleadapter.items.ISectionable
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.source.filter
import android.view.View import android.view.View
import android.widget.ArrayAdapter import android.widget.ArrayAdapter

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.source.filter
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.view.View import android.view.View

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.source.filter
import android.view.View import android.view.View
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.source.filter
import android.view.View import android.view.View
import android.widget.CheckedTextView import android.widget.CheckedTextView

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.source.filter
import android.view.View import android.view.View
import android.widget.EditText import android.widget.EditText

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.filter package eu.kanade.tachiyomi.ui.source.filter
import android.view.View import android.view.View
import android.widget.CheckedTextView import android.widget.CheckedTextView

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.global_search package eu.kanade.tachiyomi.ui.source.global_search
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
@ -9,10 +9,10 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
/** /**
* Adapter that holds the search cards. * Adapter that holds the search cards.
* *
* @param controller instance of [CatalogueSearchController]. * @param controller instance of [GlobalSearchController].
*/ */
class CatalogueSearchAdapter(val controller: CatalogueSearchController) : class GlobalSearchAdapter(val controller: GlobalSearchController) :
FlexibleAdapter<CatalogueSearchItem>(null, controller, true) { FlexibleAdapter<GlobalSearchItem>(null, controller, true) {
/** /**
* Bundle where the view state of the holders is saved. * Bundle where the view state of the holders is saved.

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.global_search package eu.kanade.tachiyomi.ui.source.global_search
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
@ -6,10 +6,10 @@ import eu.kanade.tachiyomi.data.database.models.Manga
/** /**
* Adapter that holds the manga items from search results. * Adapter that holds the manga items from search results.
* *
* @param controller instance of [CatalogueSearchController]. * @param controller instance of [GlobalSearchController].
*/ */
class CatalogueSearchCardAdapter(controller: CatalogueSearchController) : class GlobalSearchCardAdapter(controller: GlobalSearchController) :
FlexibleAdapter<CatalogueSearchCardItem>(null, controller, true) { FlexibleAdapter<GlobalSearchCardItem>(null, controller, true) {
/** /**
* Listen for browse item clicks. * Listen for browse item clicks.
@ -18,7 +18,7 @@ class CatalogueSearchCardAdapter(controller: CatalogueSearchController) :
/** /**
* Listener which should be called when user clicks browse. * Listener which should be called when user clicks browse.
* Note: Should only be handled by [CatalogueSearchController] * Note: Should only be handled by [GlobalSearchController]
*/ */
interface OnMangaClickListener { interface OnMangaClickListener {
fun onMangaClick(manga: Manga) fun onMangaClick(manga: Manga)

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.global_search package eu.kanade.tachiyomi.ui.source.global_search
import android.view.View import android.view.View
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
@ -6,11 +6,11 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.widget.StateImageViewTarget import eu.kanade.tachiyomi.widget.StateImageViewTarget
import kotlinx.android.synthetic.main.catalogue_global_search_controller_card_item.itemImage import kotlinx.android.synthetic.main.global_search_controller_card_item.itemImage
import kotlinx.android.synthetic.main.catalogue_global_search_controller_card_item.progress import kotlinx.android.synthetic.main.global_search_controller_card_item.progress
import kotlinx.android.synthetic.main.catalogue_global_search_controller_card_item.tvTitle import kotlinx.android.synthetic.main.global_search_controller_card_item.tvTitle
class CatalogueSearchCardHolder(view: View, adapter: CatalogueSearchCardAdapter) : class GlobalSearchCardHolder(view: View, adapter: GlobalSearchCardAdapter) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
init { init {

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.global_search package eu.kanade.tachiyomi.ui.source.global_search
import android.view.View import android.view.View
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -8,19 +8,19 @@ import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
class CatalogueSearchCardItem(val manga: Manga) : AbstractFlexibleItem<CatalogueSearchCardHolder>() { class GlobalSearchCardItem(val manga: Manga) : AbstractFlexibleItem<GlobalSearchCardHolder>() {
override fun getLayoutRes(): Int { override fun getLayoutRes(): Int {
return R.layout.catalogue_global_search_controller_card_item return R.layout.global_search_controller_card_item
} }
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): CatalogueSearchCardHolder { override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): GlobalSearchCardHolder {
return CatalogueSearchCardHolder(view, adapter as CatalogueSearchCardAdapter) return GlobalSearchCardHolder(view, adapter as GlobalSearchCardAdapter)
} }
override fun bindViewHolder( override fun bindViewHolder(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: CatalogueSearchCardHolder, holder: GlobalSearchCardHolder,
position: Int, position: Int,
payloads: List<Any?>? payloads: List<Any?>?
) { ) {
@ -28,7 +28,7 @@ class CatalogueSearchCardItem(val manga: Manga) : AbstractFlexibleItem<Catalogue
} }
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (other is CatalogueSearchCardItem) { if (other is GlobalSearchCardItem) {
return manga.id == other.manga.id return manga.id == other.manga.id
} }
return false return false

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.global_search package eu.kanade.tachiyomi.ui.source.global_search
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -12,7 +12,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.jakewharton.rxbinding.support.v7.widget.queryTextChangeEvents import com.jakewharton.rxbinding.support.v7.widget.queryTextChangeEvents
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.databinding.CatalogueGlobalSearchControllerBinding import eu.kanade.tachiyomi.databinding.GlobalSearchControllerBinding
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.NucleusController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
@ -20,21 +20,21 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
/** /**
* This controller shows and manages the different search result in global search. * This controller shows and manages the different search result in global search.
* This controller should only handle UI actions, IO actions should be done by [CatalogueSearchPresenter] * This controller should only handle UI actions, IO actions should be done by [GlobalSearchPresenter]
* [CatalogueSearchCardAdapter.OnMangaClickListener] called when manga is clicked in global search * [GlobalSearchCardAdapter.OnMangaClickListener] called when manga is clicked in global search
*/ */
open class CatalogueSearchController( open class GlobalSearchController(
protected val initialQuery: String? = null, protected val initialQuery: String? = null,
protected val extensionFilter: String? = null protected val extensionFilter: String? = null
) : NucleusController<CatalogueSearchPresenter>(), ) : NucleusController<GlobalSearchPresenter>(),
CatalogueSearchCardAdapter.OnMangaClickListener { GlobalSearchCardAdapter.OnMangaClickListener {
/** /**
* Adapter containing search results grouped by lang. * Adapter containing search results grouped by lang.
*/ */
protected var adapter: CatalogueSearchAdapter? = null protected var adapter: GlobalSearchAdapter? = null
private lateinit var binding: CatalogueGlobalSearchControllerBinding private lateinit var binding: GlobalSearchControllerBinding
/** /**
* Called when controller is initialized. * Called when controller is initialized.
@ -44,14 +44,14 @@ open class CatalogueSearchController(
} }
/** /**
* Initiate the view with [R.layout.catalogue_global_search_controller]. * Initiate the view with [R.layout.global_search_controller].
* *
* @param inflater used to load the layout xml. * @param inflater used to load the layout xml.
* @param container containing parent views. * @param container containing parent views.
* @return inflated view * @return inflated view
*/ */
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
binding = CatalogueGlobalSearchControllerBinding.inflate(inflater) binding = GlobalSearchControllerBinding.inflate(inflater)
return binding.root return binding.root
} }
@ -65,12 +65,12 @@ open class CatalogueSearchController(
} }
/** /**
* Create the [CatalogueSearchPresenter] used in controller. * Create the [GlobalSearchPresenter] used in controller.
* *
* @return instance of [CatalogueSearchPresenter] * @return instance of [GlobalSearchPresenter]
*/ */
override fun createPresenter(): CatalogueSearchPresenter { override fun createPresenter(): GlobalSearchPresenter {
return CatalogueSearchPresenter(initialQuery, extensionFilter) return GlobalSearchPresenter(initialQuery, extensionFilter)
} }
/** /**
@ -101,7 +101,7 @@ open class CatalogueSearchController(
*/ */
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
// Inflate menu. // Inflate menu.
inflater.inflate(R.menu.catalogue_new_list, menu) inflater.inflate(R.menu.global_search, menu)
// Initialize search menu // Initialize search menu
val searchItem = menu.findItem(R.id.action_search) val searchItem = menu.findItem(R.id.action_search)
@ -136,7 +136,7 @@ open class CatalogueSearchController(
override fun onViewCreated(view: View) { override fun onViewCreated(view: View) {
super.onViewCreated(view) super.onViewCreated(view)
adapter = CatalogueSearchAdapter(this) adapter = GlobalSearchAdapter(this)
// Create recycler and set adapter. // Create recycler and set adapter.
binding.recycler.layoutManager = LinearLayoutManager(view.context) binding.recycler.layoutManager = LinearLayoutManager(view.context)
@ -164,13 +164,13 @@ open class CatalogueSearchController(
* @param source used to find holder containing source * @param source used to find holder containing source
* @return the holder of the manga or null if it's not bound. * @return the holder of the manga or null if it's not bound.
*/ */
private fun getHolder(source: CatalogueSource): CatalogueSearchHolder? { private fun getHolder(source: CatalogueSource): GlobalSearchHolder? {
val adapter = adapter ?: return null val adapter = adapter ?: return null
adapter.allBoundViewHolders.forEach { holder -> adapter.allBoundViewHolders.forEach { holder ->
val item = adapter.getItem(holder.adapterPosition) val item = adapter.getItem(holder.adapterPosition)
if (item != null && source.id == item.source.id) { if (item != null && source.id == item.source.id) {
return holder as CatalogueSearchHolder return holder as GlobalSearchHolder
} }
} }
@ -182,7 +182,7 @@ open class CatalogueSearchController(
* *
* @param searchResult result of search. * @param searchResult result of search.
*/ */
fun setItems(searchResult: List<CatalogueSearchItem>) { fun setItems(searchResult: List<GlobalSearchItem>) {
adapter?.updateDataSet(searchResult) adapter?.updateDataSet(searchResult)
} }

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.global_search package eu.kanade.tachiyomi.ui.source.global_search
import android.view.View import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -6,26 +6,26 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
import kotlinx.android.synthetic.main.catalogue_global_search_controller_card.progress import kotlinx.android.synthetic.main.global_search_controller_card.progress
import kotlinx.android.synthetic.main.catalogue_global_search_controller_card.recycler import kotlinx.android.synthetic.main.global_search_controller_card.recycler
import kotlinx.android.synthetic.main.catalogue_global_search_controller_card.source_card import kotlinx.android.synthetic.main.global_search_controller_card.source_card
import kotlinx.android.synthetic.main.catalogue_global_search_controller_card.title import kotlinx.android.synthetic.main.global_search_controller_card.title
/** /**
* Holder that binds the [CatalogueSearchItem] containing catalogue cards. * Holder that binds the [GlobalSearchItem] containing catalogue cards.
* *
* @param view view of [CatalogueSearchItem] * @param view view of [GlobalSearchItem]
* @param adapter instance of [CatalogueSearchAdapter] * @param adapter instance of [GlobalSearchAdapter]
*/ */
class CatalogueSearchHolder(view: View, val adapter: CatalogueSearchAdapter) : class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
/** /**
* Adapter containing manga from search results. * Adapter containing manga from search results.
*/ */
private val mangaAdapter = CatalogueSearchCardAdapter(adapter.controller) private val mangaAdapter = GlobalSearchCardAdapter(adapter.controller)
private var lastBoundResults: List<CatalogueSearchCardItem>? = null private var lastBoundResults: List<GlobalSearchCardItem>? = null
init { init {
// Set layout horizontal. // Set layout horizontal.
@ -38,7 +38,7 @@ class CatalogueSearchHolder(view: View, val adapter: CatalogueSearchAdapter) :
* *
* @param item item of card. * @param item item of card.
*/ */
fun bind(item: CatalogueSearchItem) { fun bind(item: GlobalSearchItem) {
val source = item.source val source = item.source
val results = item.results val results = item.results
@ -83,11 +83,11 @@ class CatalogueSearchHolder(view: View, val adapter: CatalogueSearchAdapter) :
* @param manga the manga to find. * @param manga the manga to find.
* @return the holder of the manga or null if it's not bound. * @return the holder of the manga or null if it's not bound.
*/ */
private fun getHolder(manga: Manga): CatalogueSearchCardHolder? { private fun getHolder(manga: Manga): GlobalSearchCardHolder? {
mangaAdapter.allBoundViewHolders.forEach { holder -> mangaAdapter.allBoundViewHolders.forEach { holder ->
val item = mangaAdapter.getItem(holder.adapterPosition) val item = mangaAdapter.getItem(holder.adapterPosition)
if (item != null && item.manga.id!! == manga.id!!) { if (item != null && item.manga.id!! == manga.id!!) {
return holder as CatalogueSearchCardHolder return holder as GlobalSearchCardHolder
} }
} }

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.global_search package eu.kanade.tachiyomi.ui.source.global_search
import android.view.View import android.view.View
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -15,8 +15,8 @@ import eu.kanade.tachiyomi.source.CatalogueSource
* @param results the search results. * @param results the search results.
* @param highlighted whether this search item should be highlighted/marked in the catalogue search view. * @param highlighted whether this search item should be highlighted/marked in the catalogue search view.
*/ */
class CatalogueSearchItem(val source: CatalogueSource, val results: List<CatalogueSearchCardItem>?, val highlighted: Boolean = false) : class GlobalSearchItem(val source: CatalogueSource, val results: List<GlobalSearchCardItem>?, val highlighted: Boolean = false) :
AbstractFlexibleItem<CatalogueSearchHolder>() { AbstractFlexibleItem<GlobalSearchHolder>() {
/** /**
* Set view. * Set view.
@ -24,16 +24,16 @@ class CatalogueSearchItem(val source: CatalogueSource, val results: List<Catalog
* @return id of view * @return id of view
*/ */
override fun getLayoutRes(): Int { override fun getLayoutRes(): Int {
return R.layout.catalogue_global_search_controller_card return R.layout.global_search_controller_card
} }
/** /**
* Create view holder (see [CatalogueSearchAdapter]. * Create view holder (see [GlobalSearchAdapter].
* *
* @return holder of view. * @return holder of view.
*/ */
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): CatalogueSearchHolder { override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): GlobalSearchHolder {
return CatalogueSearchHolder(view, adapter as CatalogueSearchAdapter) return GlobalSearchHolder(view, adapter as GlobalSearchAdapter)
} }
/** /**
@ -41,7 +41,7 @@ class CatalogueSearchItem(val source: CatalogueSource, val results: List<Catalog
*/ */
override fun bindViewHolder( override fun bindViewHolder(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: CatalogueSearchHolder, holder: GlobalSearchHolder,
position: Int, position: Int,
payloads: List<Any?>? payloads: List<Any?>?
) { ) {
@ -54,7 +54,7 @@ class CatalogueSearchItem(val source: CatalogueSource, val results: List<Catalog
* @return items are equal? * @return items are equal?
*/ */
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (other is CatalogueSearchItem) { if (other is GlobalSearchItem) {
return source.id == other.source.id return source.id == other.source.id
} }
return false return false

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.ui.catalogue.global_search package eu.kanade.tachiyomi.ui.source.global_search
import android.os.Bundle import android.os.Bundle
import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.DatabaseHelper
@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
import eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCataloguePresenter import eu.kanade.tachiyomi.ui.source.browse.BrowseSourcePresenter
import rx.Observable import rx.Observable
import rx.Subscription import rx.Subscription
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
@ -25,20 +25,20 @@ import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
/** /**
* Presenter of [CatalogueSearchController] * Presenter of [GlobalSearchController]
* Function calls should be done from here. UI calls should be done from the controller. * Function calls should be done from here. UI calls should be done from the controller.
* *
* @param sourceManager manages the different sources. * @param sourceManager manages the different sources.
* @param db manages the database calls. * @param db manages the database calls.
* @param preferences manages the preference calls. * @param preferences manages the preference calls.
*/ */
open class CatalogueSearchPresenter( open class GlobalSearchPresenter(
val initialQuery: String? = "", val initialQuery: String? = "",
val initialExtensionFilter: String? = null, val initialExtensionFilter: String? = null,
val sourceManager: SourceManager = Injekt.get(), val sourceManager: SourceManager = Injekt.get(),
val db: DatabaseHelper = Injekt.get(), val db: DatabaseHelper = Injekt.get(),
val preferences: PreferencesHelper = Injekt.get() val preferences: PreferencesHelper = Injekt.get()
) : BasePresenter<CatalogueSearchController>() { ) : BasePresenter<GlobalSearchController>() {
/** /**
* Enabled sources. * Enabled sources.
@ -73,11 +73,11 @@ open class CatalogueSearchPresenter(
override fun onCreate(savedState: Bundle?) { override fun onCreate(savedState: Bundle?) {
super.onCreate(savedState) super.onCreate(savedState)
extensionFilter = savedState?.getString(CatalogueSearchPresenter::extensionFilter.name) extensionFilter = savedState?.getString(GlobalSearchPresenter::extensionFilter.name)
?: initialExtensionFilter ?: initialExtensionFilter
// Perform a search with previous or initial state // Perform a search with previous or initial state
search(savedState?.getString(BrowseCataloguePresenter::query.name) search(savedState?.getString(BrowseSourcePresenter::query.name)
?: initialQuery.orEmpty()) ?: initialQuery.orEmpty())
} }
@ -88,8 +88,8 @@ open class CatalogueSearchPresenter(
} }
override fun onSave(state: Bundle) { override fun onSave(state: Bundle) {
state.putString(BrowseCataloguePresenter::query.name, query) state.putString(BrowseSourcePresenter::query.name, query)
state.putString(CatalogueSearchPresenter::extensionFilter.name, extensionFilter) state.putString(GlobalSearchPresenter::extensionFilter.name, extensionFilter)
super.onSave(state) super.onSave(state)
} }
@ -133,8 +133,8 @@ open class CatalogueSearchPresenter(
/** /**
* Creates a catalogue search item * Creates a catalogue search item
*/ */
protected open fun createCatalogueSearchItem(source: CatalogueSource, results: List<CatalogueSearchCardItem>?): CatalogueSearchItem { protected open fun createCatalogueSearchItem(source: CatalogueSource, results: List<GlobalSearchCardItem>?): GlobalSearchItem {
return CatalogueSearchItem(source, results) return GlobalSearchItem(source, results)
} }
/** /**
@ -165,7 +165,7 @@ open class CatalogueSearchPresenter(
.map { it.mangas.take(10) } // Get at most 10 manga from search result. .map { it.mangas.take(10) } // Get at most 10 manga from search result.
.map { it.map { networkToLocalManga(it, source.id) } } // Convert to local manga. .map { it.map { networkToLocalManga(it, source.id) } } // Convert to local manga.
.doOnNext { fetchImage(it, source) } // Load manga covers. .doOnNext { fetchImage(it, source) } // Load manga covers.
.map { createCatalogueSearchItem(source, it.map { CatalogueSearchCardItem(it) }) } .map { createCatalogueSearchItem(source, it.map { GlobalSearchCardItem(it) }) }
}, 5) }, 5)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
// Update matching source with the obtained results // Update matching source with the obtained results

View File

@ -1,22 +1,22 @@
package eu.kanade.tachiyomi.ui.catalogue.latest package eu.kanade.tachiyomi.ui.source.latest
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCatalogueController import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController
import eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCataloguePresenter import eu.kanade.tachiyomi.ui.source.browse.BrowseSourcePresenter
/** /**
* Controller that shows the latest manga from the catalogue. Inherit [BrowseCatalogueController]. * Controller that shows the latest manga from the catalogue. Inherit [BrowseSourceController].
*/ */
class LatestUpdatesController(bundle: Bundle) : BrowseCatalogueController(bundle) { class LatestUpdatesController(bundle: Bundle) : BrowseSourceController(bundle) {
constructor(source: CatalogueSource) : this(Bundle().apply { constructor(source: CatalogueSource) : this(Bundle().apply {
putLong(SOURCE_ID_KEY, source.id) putLong(SOURCE_ID_KEY, source.id)
}) })
override fun createPresenter(): BrowseCataloguePresenter { override fun createPresenter(): BrowseSourcePresenter {
return LatestUpdatesPresenter(args.getLong(SOURCE_ID_KEY)) return LatestUpdatesPresenter(args.getLong(SOURCE_ID_KEY))
} }

View File

@ -1,8 +1,8 @@
package eu.kanade.tachiyomi.ui.catalogue.latest package eu.kanade.tachiyomi.ui.source.latest
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.ui.catalogue.browse.Pager import eu.kanade.tachiyomi.ui.source.browse.Pager
import rx.Observable import rx.Observable
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers import rx.schedulers.Schedulers

View File

@ -1,13 +1,13 @@
package eu.kanade.tachiyomi.ui.catalogue.latest package eu.kanade.tachiyomi.ui.source.latest
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCataloguePresenter import eu.kanade.tachiyomi.ui.source.browse.BrowseSourcePresenter
import eu.kanade.tachiyomi.ui.catalogue.browse.Pager import eu.kanade.tachiyomi.ui.source.browse.Pager
/** /**
* Presenter of [LatestUpdatesController]. Inherit BrowseCataloguePresenter. * Presenter of [LatestUpdatesController]. Inherit BrowseCataloguePresenter.
*/ */
class LatestUpdatesPresenter(sourceId: Long) : BrowseCataloguePresenter(sourceId) { class LatestUpdatesPresenter(sourceId: Long) : BrowseSourcePresenter(sourceId) {
override fun createPager(query: String, filters: FilterList): Pager { override fun createPager(query: String, filters: FilterList): Pager {
return LatestUpdatesPager(source) return LatestUpdatesPager(source)

View File

@ -7,7 +7,7 @@ import android.os.Build
import android.view.ContextThemeWrapper import android.view.ContextThemeWrapper
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.ui.catalogue.CataloguePresenter import eu.kanade.tachiyomi.ui.source.SourcePresenter
import java.util.Locale import java.util.Locale
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
@ -51,7 +51,7 @@ object LocaleHelper {
return when (lang) { return when (lang) {
null -> "" null -> ""
"" -> context.getString(R.string.other_source) "" -> context.getString(R.string.other_source)
CataloguePresenter.PINNED_KEY -> context.getString(R.string.pinned_sources) SourcePresenter.PINNED_KEY -> context.getString(R.string.pinned_sources)
"all" -> context.getString(R.string.all_lang) "all" -> context.getString(R.string.all_lang)
else -> { else -> {
val locale = getLocale(lang) val locale = getLocale(lang)

View File

@ -5,7 +5,7 @@
android:id="@id/swipe_refresh" android:id="@id/swipe_refresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCatalogueController"> tools:context="eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -11,6 +11,6 @@
android:clipToPadding="false" android:clipToPadding="false"
android:paddingTop="4dp" android:paddingTop="4dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
tools:listitem="@layout/catalogue_global_search_controller_card" /> tools:listitem="@layout/global_search_controller_card" />
</FrameLayout> </FrameLayout>

View File

@ -43,7 +43,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="4dp" android:paddingStart="4dp"
android:paddingEnd="4dp" android:paddingEnd="4dp"
tools:listitem="@layout/catalogue_global_search_controller_card_item" /> tools:listitem="@layout/global_search_controller_card_item" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View File

@ -2,9 +2,9 @@
<eu.kanade.tachiyomi.widget.AutofitRecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <eu.kanade.tachiyomi.widget.AutofitRecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/library_grid" android:id="@+id/library_grid"
style="@style/Theme.Widget.GridView.Catalogue" style="@style/Theme.Widget.GridView.Source"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false" android:clipToPadding="false"
android:columnWidth="140dp" android:columnWidth="140dp"
tools:listitem="@layout/catalogue_grid_item" /> tools:listitem="@layout/source_grid_item" />

View File

@ -4,4 +4,4 @@
android:id="@+id/library_list" android:id="@+id/library_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:listitem="@layout/catalogue_list_item" /> tools:listitem="@layout/source_list_item" />

View File

@ -5,7 +5,7 @@
android:id="@id/swipe_refresh" android:id="@id/swipe_refresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCatalogueController"> tools:context="eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -14,7 +14,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context="eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCatalogueController"> tools:context="eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController">
<ProgressBar <ProgressBar
android:id="@+id/progress" android:id="@+id/progress"

View File

@ -9,7 +9,7 @@
android:id="@+id/recycler" android:id="@+id/recycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:listitem="@layout/catalogue_main_controller_card" /> tools:listitem="@layout/source_main_controller_card" />
<eu.davidea.fastscroller.FastScroller <eu.davidea.fastscroller.FastScroller
android:id="@+id/fast_scroller" android:id="@+id/fast_scroller"

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<eu.kanade.tachiyomi.widget.AutofitRecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <eu.kanade.tachiyomi.widget.AutofitRecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/catalogue_grid" android:id="@+id/source_grid"
style="@style/Theme.Widget.GridView.Catalogue" style="@style/Theme.Widget.GridView.Source"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false" android:clipToPadding="false"
android:columnWidth="140dp" android:columnWidth="140dp"
tools:listitem="@layout/catalogue_grid_item" /> tools:listitem="@layout/source_grid_item" />

View File

@ -1,7 +1,5 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:tools="http://schemas.android.com/tools"
tools:context=".CatalogueListActivity">
<item <item
android:id="@+id/action_search" android:id="@+id/action_search"

View File

@ -1,7 +1,5 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:tools="http://schemas.android.com/tools"
tools:context=".CatalogueListActivity">
<item <item
android:id="@+id/action_search" android:id="@+id/action_search"

View File

@ -1,7 +1,5 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:tools="http://schemas.android.com/tools"
tools:context=".CatalogueListActivity">
<item <item
android:id="@+id/action_search" android:id="@+id/action_search"

View File

@ -176,7 +176,7 @@
<item name="android:scrollbarStyle">outsideOverlay</item> <item name="android:scrollbarStyle">outsideOverlay</item>
</style> </style>
<style name="Theme.Widget.GridView.Catalogue"> <style name="Theme.Widget.GridView.Source">
<item name="android:padding">5dp</item> <item name="android:padding">5dp</item>
<item name="android:gravity">top|left</item> <item name="android:gravity">top|left</item>
<item name="android:smoothScrollbar">true</item> <item name="android:smoothScrollbar">true</item>