From 2e563d7d0c08e7c25a8908ac342b3a5bb70166e0 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Mon, 29 Mar 2021 14:47:42 -0400 Subject: [PATCH] Rename SourceController and title to Browse --- .../kanade/tachiyomi/ui/base/CenteredToolbar.kt | 2 +- .../ui/extension/ExtensionBottomSheet.kt | 6 +++--- .../eu/kanade/tachiyomi/ui/main/MainActivity.kt | 6 +++--- .../tachiyomi/ui/manga/MangaDetailsController.kt | 4 ++-- .../{SourceController.kt => BrowseController.kt} | 16 +++++++--------- .../kanade/tachiyomi/ui/source/SourceAdapter.kt | 4 ++-- .../tachiyomi/ui/source/SourcePresenter.kt | 8 ++++---- .../ui/source/browse/BrowseSourceController.kt | 4 ++-- ...urce_controller.xml => browse_controller.xml} | 3 ++- 9 files changed, 26 insertions(+), 27 deletions(-) rename app/src/main/java/eu/kanade/tachiyomi/ui/source/{SourceController.kt => BrowseController.kt} (97%) rename app/src/main/res/layout/{source_controller.xml => browse_controller.xml} (94%) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/CenteredToolbar.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/CenteredToolbar.kt index 54ebc4048f..42e708ce73 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/CenteredToolbar.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/CenteredToolbar.kt @@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.R class CenteredToolbar@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : MaterialToolbar(context, attrs) { - private lateinit var toolbarTitle:TextView + private lateinit var toolbarTitle: TextView override fun onFinishInflate() { super.onFinishInflate() toolbarTitle = findViewById(R.id.toolbar_title) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomSheet.kt index 942b436685..41580339de 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomSheet.kt @@ -21,7 +21,7 @@ import eu.kanade.tachiyomi.ui.migration.MangaItem import eu.kanade.tachiyomi.ui.migration.SourceAdapter import eu.kanade.tachiyomi.ui.migration.SourceItem import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController -import eu.kanade.tachiyomi.ui.source.SourceController +import eu.kanade.tachiyomi.ui.source.BrowseController import eu.kanade.tachiyomi.util.view.collapse import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets import eu.kanade.tachiyomi.util.view.expand @@ -60,14 +60,14 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At private var extensions: List = emptyList() var canExpand = false - lateinit var controller: SourceController + lateinit var controller: BrowseController val extensionFrameLayout = inflate(context, R.layout.recycler_with_scroller, null) as FrameLayout val migrationFrameLayout = inflate(context, R.layout.recycler_with_scroller, null) as FrameLayout - fun onCreate(controller: SourceController) { + fun onCreate(controller: BrowseController) { // Initialize adapter, scroll listener and recycler views adapter = ExtensionAdapter(this) migAdapter = ExtensionAdapter(this) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 0c5b8bd301..a083244a5b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -59,7 +59,7 @@ import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate import eu.kanade.tachiyomi.ui.setting.AboutController import eu.kanade.tachiyomi.ui.setting.SettingsController import eu.kanade.tachiyomi.ui.setting.SettingsMainController -import eu.kanade.tachiyomi.ui.source.SourceController +import eu.kanade.tachiyomi.ui.source.BrowseController import eu.kanade.tachiyomi.util.system.contextCompatDrawable import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.hasSideNavBar @@ -194,7 +194,7 @@ open class MainActivity : BaseActivity(), DownloadServiceLi when (id) { R.id.nav_library -> LibraryController() R.id.nav_recents -> RecentsController() - else -> SourceController() + else -> BrowseController() }, id ) @@ -485,7 +485,7 @@ open class MainActivity : BaseActivity(), DownloadServiceLi router.popToRoot() binding.bottomNav.post { val controller = - router.backstack.firstOrNull()?.controller() as? SourceController + router.backstack.firstOrNull()?.controller() as? BrowseController controller?.showSheet() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt index 5c224f44f2..03fce67159 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt @@ -81,7 +81,7 @@ import eu.kanade.tachiyomi.ui.manga.track.TrackingBottomSheet import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate -import eu.kanade.tachiyomi.ui.source.SourceController +import eu.kanade.tachiyomi.ui.source.BrowseController import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController import eu.kanade.tachiyomi.ui.webview.WebViewActivity import eu.kanade.tachiyomi.util.storage.getUriCompat @@ -123,7 +123,7 @@ class MangaDetailsController : constructor( manga: Manga?, fromCatalogue: Boolean = false, - smartSearchConfig: SourceController.SmartSearchConfig? = null, + smartSearchConfig: BrowseController.SmartSearchConfig? = null, update: Boolean = false ) : super( Bundle().apply { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/BrowseController.kt similarity index 97% rename from app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceController.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/source/BrowseController.kt index 1fb34f6816..a9d9ec72be 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/BrowseController.kt @@ -24,7 +24,7 @@ import eu.davidea.flexibleadapter.items.IFlexible import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault -import eu.kanade.tachiyomi.databinding.SourceControllerBinding +import eu.kanade.tachiyomi.databinding.BrowseControllerBinding import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.ui.base.controller.NucleusController @@ -59,12 +59,10 @@ import kotlinx.android.synthetic.main.extensions_bottom_sheet.ext_bottom_sheet import kotlinx.android.synthetic.main.extensions_bottom_sheet.sheet_layout import kotlinx.android.synthetic.main.extensions_bottom_sheet.view.* import kotlinx.android.synthetic.main.filter_bottom_sheet.* -import kotlinx.android.synthetic.main.library_list_controller.* import kotlinx.android.synthetic.main.main_activity.* import kotlinx.android.synthetic.main.recycler_with_scroller.view.* import kotlinx.android.synthetic.main.rounded_category_hopper.* -import kotlinx.android.synthetic.main.source_controller.* -import kotlinx.android.synthetic.main.source_controller.shadow2 +import kotlinx.android.synthetic.main.browse_controller.* import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import kotlin.math.max @@ -76,8 +74,8 @@ import kotlin.math.min * [SourceAdapter.SourceListener] call function data on browse item click. * [SourceAdapter.OnLatestClickListener] call function data on latest item click */ -class SourceController : - NucleusController(), +class BrowseController : + NucleusController(), FlexibleAdapter.OnItemClickListener, SourceAdapter.SourceListener, RootSearchInterface, @@ -117,7 +115,7 @@ class SourceController : else -> R.string.source_migration } ) - } else view?.context?.getString(R.string.sources) + } else view?.context?.getString(R.string.browse) } override fun createPresenter(): SourcePresenter { @@ -125,14 +123,14 @@ class SourceController : } /** - * Initiate the view with [R.layout.source_controller]. + * Initiate the view with [R.layout.browse_controller]. * * @param inflater used to load the layout xml. * @param container containing parent views. * @return inflated view. */ override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { - return inflater.inflate(R.layout.source_controller, container, false) + return inflater.inflate(R.layout.browse_controller, container, false) } override fun onViewCreated(view: View) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceAdapter.kt index aaf0440b04..f732cd60ea 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceAdapter.kt @@ -6,9 +6,9 @@ import eu.davidea.flexibleadapter.items.IFlexible /** * Adapter that holds the catalogue cards. * - * @param controller instance of [SourceController]. + * @param controller instance of [BrowseController]. */ -class SourceAdapter(val controller: SourceController) : +class SourceAdapter(val controller: BrowseController) : FlexibleAdapter>(null, controller, true) { init { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourcePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourcePresenter.kt index 3babd2154b..2cee43ddd2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourcePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourcePresenter.kt @@ -16,7 +16,7 @@ import java.util.TreeMap import java.util.concurrent.TimeUnit /** - * Presenter of [SourceController] + * Presenter of [BrowseController] * Function calls should be done from here. UI calls should be done from the controller. * * @param sourceManager manages the different sources. @@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit class SourcePresenter( val sourceManager: SourceManager = Injekt.get(), private val preferences: PreferencesHelper = Injekt.get() -) : BasePresenter() { +) : BasePresenter() { var sources = getEnabledSources() @@ -78,7 +78,7 @@ class SourcePresenter( } sourceSubscription = Observable.just(sourceItems) - .subscribeLatestCache(SourceController::setSources) + .subscribeLatestCache(BrowseController::setSources) } private fun loadLastUsedSource() { @@ -96,7 +96,7 @@ class SourcePresenter( if (isPinned) null else SourceItem(source, null, isPinned) } - }.subscribeLatestCache(SourceController::setLastUsedSource) + }.subscribeLatestCache(BrowseController::setLastUsedSource) } fun updateSources() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt index 0f94d492a8..48af8b1182 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt @@ -31,7 +31,7 @@ import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.library.AddToLibraryCategoriesDialog import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaDetailsController -import eu.kanade.tachiyomi.ui.source.SourceController +import eu.kanade.tachiyomi.ui.source.BrowseController import eu.kanade.tachiyomi.ui.webview.WebViewActivity import eu.kanade.tachiyomi.util.system.connectivityManager import eu.kanade.tachiyomi.util.system.dpToPx @@ -67,7 +67,7 @@ open class BrowseSourceController(bundle: Bundle) : constructor( source: CatalogueSource, searchQuery: String? = null, - smartSearchConfig: SourceController.SmartSearchConfig? = null + smartSearchConfig: BrowseController.SmartSearchConfig? = null ) : this( Bundle().apply { putLong(SOURCE_ID_KEY, source.id) diff --git a/app/src/main/res/layout/source_controller.xml b/app/src/main/res/layout/browse_controller.xml similarity index 94% rename from app/src/main/res/layout/source_controller.xml rename to app/src/main/res/layout/browse_controller.xml index 7dfa076efa..1efdc0541c 100644 --- a/app/src/main/res/layout/source_controller.xml +++ b/app/src/main/res/layout/browse_controller.xml @@ -32,7 +32,8 @@ app:layout_anchorGravity="top" app:layout_anchor="@id/ext_bottom_sheet" /> - +